Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interpreter vs. compiler (JIT)

843829Jan 23 2008 — edited Jan 26 2008
Hello!
I have some questions regarding interpreter vs. compiler.

*1.* In an interpreter each bytecode instruction is read and translated to
machine code. Am I right?

*2.* In a compiler eg. JIT, blocks of byte code are compiled at runtime
to machine code. Am I right?

*3.* How does an interpreter translate the bytecode to machine code?
Isn't the interpreter compiling the bytecode to machine code in
the same way that the JIT does? Or does it retrieve the machine code
instructions from some kind of stack/shelf?

*4.* Is the difference between interpreter and JIT that the interpreter only
reads one bytecode instruction at a time while JIT compiles whole
blocks of code?

*5.* When the interpreter has translated a bytecode instruction, does
it save the translated machine code in some place to be retrieved the
next time the same bytecode instruction appears?

Regards
/Fredrik
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 23 2008
Added on Jan 23 2008
2 comments
848 views