Sign in to follow this  
Pooya65

questions about the jit

Recommended Posts

1.what is the difference between jit and virtual machines?
2. are there any library for creating and running machine codes at run-time?
3. using jit in my scripting language can help me to increase running performance?

Share this post


Link to post
Share on other sites
[quote name='Pooya65' timestamp='1305837493' post='4813182']
1.what is the difference between jit and virtual machines?
2. are there any library for creating and running machine codes at run-time?
3. using jit in my scripting language can help me to increase running performance?
[/quote]

JIT stand for just in time (a JIT compiler is a compiler that compiles the code while the program is running)

JIT compilers require a virtual machine since the code isn't compiled ahead of time, (Some JIT compilers will compile everything as the program launches, others will only compile code segments that are used heavily).

Basically a VM can use JIT compilation to improve its performance

As far as i know there are no JIT compiler libraries that you can just plug in to be used with your own scripting language that easily.

You could however compile your language to java bytecode and use the JVM to run it or you could build something of the LuaJIT compiler.

and yes, using JIT compilation will boost runtime performance allthough the actual compilation isn't free so for a game it might be a good idea to compile your scripts when the game starts or a level is loaded and then cache the compiled code.

Share this post


Link to post
Share on other sites
[quote name='SimonForsman' timestamp='1305843566' post='4813218']
As far as i know there are no JIT compiler libraries that you can just plug in to be used with your own scripting language that easily.
[/quote]

Indeed, the closest you are likely to get to that is using LLVM as a code compiling backend and that requires a fair chunk of work to get going with and isn't simple.. but then JIT compiling code isn't simple anyway :)

Share this post


Link to post
Share on other sites
[color=#1C2837][size=2]2. are there any library for creating and running machine codes at run-time?[/size][/color]
[color=#1C2837][size=2]
[/size][/color]
[color=#1C2837][size=2]yes, [/size][/color]simply put the bytes in memory and call.
[url="http://code.google.com/p/jitasm/"]http://code.google.com/p/jitasm/[/url]

and others i not remember..

you can see others jit compilers in projects like

[url="http://code.google.com/p/pcsx2/"]http://code.google.com/p/pcsx2/[/url]
or
[url="http://code.google.com/p/dolphin-emu/"]http://code.google.com/p/dolphin-emu/[/url]

a nice introduction in
[url="http://www.strchr.com/code_generator"]http://www.strchr.com/code_generator[/url]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this