• Advertisement
Sign in to follow this  

questions about the jit

This topic is 2421 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement

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?


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

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.


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?
[color=#1C2837][size=2]

[color=#1C2837][size=2]yes, simply put the bytes in memory and call.
http://code.google.com/p/jitasm/

and others i not remember..

you can see others jit compilers in projects like

http://code.google.com/p/pcsx2/
or
http://code.google.com/p/dolphin-emu/

a nice introduction in
http://www.strchr.com/code_generator

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement