tags:

views:

54

answers:

3

Since so there are so many JIT implementation out there, every JIT emits native code. Then why hasn't someone made a tool like JIT2EXE, to save the native code to a native executable?

+3  A: 

You mean something like ngen?

Blindy
+1  A: 

As a matter of fact, there are many Java (or other interpreted languages)-to-native compilers. Ever heard of gcj?

http://gcc.gnu.org/java/

There are also mixed compilers that compile some critical parts to native code and keep the others as bytecode to save space. Harissa did this more than 10 years ago.

http://www.usenix.org/publications/library/proceedings/coots97/full_papers/muller/muller_html/usenix.html

The Java code is first compiled to C code, which is then passed to the regular C compiler in order to take advantage of its optimizations. Such code can turn out to be very fast.

Of course, such ahead-of-time compilation (as opposed to just-in-time compilation) cancels some of the advantages of the bytecode form (especially portability and low memory footprint), so real-world applications are rather rare.

Gnurou
+2  A: 

The question is kind of vague as you have not clearly specified what language you are talking about, in my area of .NET, the .NET executables are pre-jitted at runtime in order to speed up the loading times. The code can be generated to native code by a process known as NGEN which takes the .NET IL code and converts it in the process of a binary in which can be understood by the processor. Usually NGEN code are stored in the folder within 'C:\Windows\Assembly\NativeImages_{version}' where the version represents the .NET Framework version. Have a look here on CodeGuru by Jeffrey Richter, about NGEN and where it could be used and when to use it. Have a look here on Codeproject about this article on the statistics/comparisons with native binary code and also here as well by Daniel Pistelli.

Hope this helps, Best regards, Tom.

tommieb75