JIT compiler implementation ?

Started by
6 comments, last by WitchLord 13 years, 7 months ago
Hi,

I'm quite new to AngelScript and I'm currently in the process of evaluating different scripting solutions for our game pipeline. I must say that before that, I hadn't heard much about AngelScript, but an article on codeplea got my attention. I work for a technology team for which develops a game engine ( and toolset ) used by many internal teams around the world.

I have already integrated a first prototype within our pipeline and I must say that I was quite pleased with the result I got, registering my math & string functions in a matter of 1 day and compiling for every platforms on the market without too much trouble and implementing a little scripted component on top of our existing component system without any trouble. I only add to changed as_debug on Wii and PS3 ( something related to the mkDir macro if I remember correctly. )

In my evaluation process, I also looked at Mono, as used by the Unity Engine, but since I must support the Xbox 360, and Mono doesn't support the platform ( or we could say the Xbox 360 does not support Mono ), I'm a bit screwed. I really liked the JIT aspect of Mono, and I was pleased to see the SetJITCompiler function in the SDK ( really well documented by the way, even better than some huge middleware companies out there ... ). However, I haven't seen any implementation anywhere in the code and I was wondering if anyone got to implement one ? If so, which platforms were successfully implemented ?

Also quick note : I'm working on a platform which isn't supported by the package. Do I only have to define AS_MAX_PORTABILITY in order to make sure that everything works as it should ? Is there a huge performance hits when using AS_MAX_PORTABILITY ? My guess is yes but I haven't had time to check as of today.

Anyway, thanks in advance for any answers to the question above, I look forward to Monday to continue messing with AS at work :)

Pierre
Advertisement
The only JIT compiler that I know has been implemented for AngelScript so far was one for ARM processrs, written by quarnster for his personal projects. It is unfortunately not available to the public.

I would very much like to see a JIT compiler implemented with LLVM library. But I will probably not have time to implement it myself.

AngelScript should automatically define AS_MAX_PORTABILITY for any platform for which native calling conventions isn't supported. But if for some reason this doesn't happen then, yes, you can define this yourself in the project files or in the as_config.h header file.

Actually, I don't think there will be a huge performance hit due to AS_MAX_PORTABILITY. It is quite possible that on some platforms AS_MAX_PORTABILITY is actually faster than the native calling conventions.

May I ask which platform you're targetting for which AngelScript still doesn't have support for native calling conventions? Would you be interested in helping me add that support?

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

Thanks for the quick answer, really appreciated. I'm glad to see that the AS_MAX_PORTABILITY shouldn't incur too much overhead.

As of now, I'm under an NDA restriction regarding this platform and I'm not free to speak about it. However, should I add support for the platform myself, I'll gladly send the code as soon as the NDA's lifted.
Does Xbox360 allow to run dynamically generated native code at all? From what I read on internet it does not - that is why Mono doesn't support JIT there. But imho you can use AOT compiler to pre-JIT your code before deploying on platform. That is how Mono works on iPhone devices (they also doesn't support dynamically generated native code).
No, the 360 does not allow to call JIT dynamically generated code which does not reside in code sections within memory. While you can do something such as what Unity is doing, it limits what you can do with the script, for example Edit & Continue.

Build times are not the only thing that are long when developping huge projects. Just getting to the place in the map where you wish to test something can be long and in those cases edit & continue is a life saver !
Remote debugging is also probably a lot easier with a scripting engine (unless of course the platform provides native debugging capabilities).

So you're under an NDA. Hmm, that just makes me even more curious.

May I ask what company are you working for? Or is that also a secret? ;)

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

Actually I never finished it and haven't touched the code in over a year, so I've decided to enable anonymous svn access if anyone's interested in having a peek. Note though that this code is in very early development and probably completely broken in many ways so unless you intend to improve upon it and take it on as your own, don't use it.

svn co http://asarmjit.svn.beanstalkapp.com/asarmjit/trunk/ asjit
Thanks for showing your implementation. I'm sure it will be interesting to anyone that wishes to write a JIT compiler for AngelScript.

I'll add a link to this on the wiki.

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