Native Calling Convention not implemented on iOS when using _arm64_

Started by
4 comments, last by WitchLord 10 years, 5 months ago

Hi All,

Been using angel script for a few months now after trying to integrate a few different scripting languages in to my game engine and finding that I liked angel script the most, so thanks for the all the good work guys!

I haven't got any pressing issues at the moment...it generally works well enough for me and most of the time things go wrong when I'm being stupid.

Anyway, just thought I'd give everyone a heads up regarding the status of angel script when it's running on an iPhone 5S which has the new arm64 architecture based processor inside it, as I hadn't seen it mentioned by anyone yet (note that this is different to running armv7/s builds on iPhone 5S which is also possible and should work fine as it is).

In short, in the last build I tried it with, the platform detection code got confused and thought it was intel x64 instead of arm64 (so the build failed citing the assembly was referencing non-existent registers or something like that). That's not too hard to fix with some additional macro tests and a bit of re-ordering in that file, but obviously there isn't an available native calling convention implementation for arm64 available yet as far as I'm aware, and I don't really know enough about the angel script internals to provide it myself...otherwise I would.

Anyway, it's not an urgent thing, just wanted to make sure it was on the radar.

I'm just building armv7/s builds for the time being, so it's not blocking me in any way and the chances of me getting anywhere near the end of my project so that I have time to implement the NCC myself is pretty much nill... (one man indie team -> design/code/art/audio)

Just thought it was worth mentioning.

Cheers,

Kaz

Advertisement

Hi Kaz,

thanks for the heads up. I wasn't even aware that any system was already using 64bit arm CPUs. :)

While it is true that AngelScript doesn't currently have the assembler code to support native calling conventions on 64bit arm, the as_config.h must definitely be fixed to avoid attempting to use intel native conventions. It should detect the 64bit arm architecture and define AS_MAX_PORTABILITY in this case.

Did you already make the necessary changes in as_config.h to make it compile successfully on arm64 with AS_MAX_PORTABILITY? Can you send me the updated as_config.h file?

Regards,

Andreas

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Hi Andreas.

Unfortunately the changes weren't with a very recent version of AS due to it just being a quick test I performed a few weeks ago when my new iPhone arrived! ;)

If you don't mind waiting, I should have time to download the latest version of AS tomorrow, and then I can verify my (admittedly) minor changes and get you a config file that's probably a bit easier to diff/integrate than my current one!

Cheers,

Kaz

Hi Andreas.

As mentioned yesterday, I found time today to recreate the arm64 related changes from my older version of AS with the current work in progress branch which I switched to today and got using svn.

Just to sum up what I've done and included in the attached zip file:

- Copied the arm sub-section of the iPhone section in the config and changed the test to check for __arm64__ (but didn't change any of the contained #defines).
- Added max portability to the arm64 section (I have no way to test this as I don't use Generic Calling Conventions in my game).
- Reordered the sections, so that the tests are performed in the following order: arm, arm64, i386, x86_64, PPC, PPC64, etc.. This is preferable because the arm tests are simpler and less likely to go wrong, where as previously mentioned, the x86_64 test is a little bit too greedy. I didn't attempt to fix or restrict the x86_64 tests, because it's worked so far, and it's best not to change things unless it's really necessary.
- Added a comment to the arm64 section that just reminds everyone that NCC isn't available or tested yet.

I've also included my Xcode project file in case you find it useful. The one that I got when I checked out the source from the depot seemed quite old, so I figured it might be worth updating. There are a few changes that might not be quite what you want, so feel free to ignore/undo them. It contains two Xcode "schemes": 1 for iOS and 1 for OSX. There are appropriate paths setup for output libs to try and order them nicely which follows the form:

lib/<OS>/<architecture>/<buildvariant>/libangelscript.lib

so because of that, the simulator build for iOS actually ends up at:

lib/iOS/x86_64/debug/libangelscript.lib

because a simulator build is really just the iOS APIs on x86.

I'm not super handy when it comes to working with build stuff in Xcode, so it requires a little bit of leg work to get all the variants out and in the right place, but it's certainly not any more difficult than the previous version of the project file.

The other thing I've done which might not be ideal from your perspective is: I've added the addon source to the project as well so that they can be built in to the same libs. I did this for convenience reasons for people getting started with AS, as they probably just want to get up and running as soon as possible with a minimum of fuss, and so it seems like a reasonable thing to do (especially as those add ons only add to the library size, but don't add any extra dependencies which is pretty much the factor I tend to use in my own libraries for deciding whether I should separate code or not). I suspect that unused addons will probably get stripped out anyway, so I'm not sure there would be any negative effects from a practical perspective. Of course, I understand if you feel it's wrong from a logical perspective! ;-)

Anyway, there you go. I hope some of this stuff helps. I wish I had time to get in to the details of implementing the NCC for arm64 too, but unfortunately I'm a bit overworked as it is!

Cheers,

Kaz


P.S. Attachment removed.

Thanks for the patch. I'll look into this over the weekend.

I've downloaded the zip file, so you can remove it now if you wish.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

I've checked in the changes in revision 1762.

Regards,

Andreas

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement