Hi,
I've some difficulties to understand how does the JIT compilers work.
Let's say that a JIT compiler is used, is it running with a virtual
machine or not? How the garbage collection is done?
Same question for AOT compilers, how does the GC work since there is
no virtual machine ? (thread in parallel of the program?)
Thanks
Chris Smith - 04 Aug 2004 18:38 GMT
> I've some difficulties to understand how does the JIT compilers work.
> Let's say that a JIT compiler is used, is it running with a virtual
> machine or not? How the garbage collection is done?
Yes, the application is running inside of a virtual machine. The
virtual machine is responsible for the JIT and garbage collection
functions of the application (among other lesser things, of course).
> Same question for AOT compilers, how does the GC work since there is
> no virtual machine ? (thread in parallel of the program?)
I presume by AOT you mean "ahead of time", i.e. what's commonly known as
a native compiler?
The native compiler will generate code that causes garbage collection to
happen. The exact details of the garbage collector (whether it's a
parallel thread or not, etc.) will depend on the native compiler, and
possibly on which options you give it when compiling.

Signature
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.
Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
zoopy - 04 Aug 2004 19:04 GMT
> Hi,
>
[quoted text clipped - 6 lines]
>
> Thanks
Modern JVM implementations of Sun (and probably of other vendors as well) are based on HotSpot
technology, which includes a bytecode interpreter, a bytecode-to-native compiler (HotSpot compiler),
memory management and garbage collection functionality.
You'll find a more detailed explanation of all of this at
<http://java.sun.com/docs/books/performance/1st_edition/html/JPAppHotspot.fm.html>
Regards,
Z.
Roedy Green - 10 Aug 2004 00:47 GMT
>I've some difficulties to understand how does the JIT compilers work.
>Let's say that a JIT compiler is used, is it running with a virtual
>machine or not? How the garbage collection is done?
There is a run time that converts JVM byte codes to native. Other
modules handle gc in the same sort of a way in a pure interpreter,
though the move is to generational collectors rather than simple
mark/sweep. see http://mindprod.com/jgloss/garbagecollection.html
>Same question for AOT compilers, how does the GC work since there is
>no virtual machine ? (thread in parallel of the program?)
There is nothing that stop there from being dozens of other threads in
an AOT, any more than you could not have dozens of threads in a C++
program.

Signature
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.