Linked by Eugenia Loli on Sun 29th Jan 2006 23:52 UTC, submitted by Anonymous
Java Tom Tromey (Red Hat) who wrote the GCJx as a extension to GCC to support Java 1.5 features among other changes has proposed a merge with ECJ, the Eclipse compiler from the Eclipse Foundation. The ramifications of this change are rather interesting.
Thread beginning with comment 90778
To read all comments associated with this story, please click here.
Gcjx explained?
by bubbayank on Mon 30th Jan 2006 06:34 UTC
Member since:

For the uninformed, what exactly is a "java compiler"? Does this mean that one can run java applications without Sun's JRE?

Reply Score: 1

RE: Gcjx explained?
by Matzon on Mon 30th Jan 2006 06:45 in reply to "Gcjx explained?"
Matzon Member since:

a java compiler compiles java source code into java bytecode - which can be run by any Java VM.
In this case however, gcj will compile the bytecode into native code, thereby enabling it to run without a Java VM.

Reply Parent Score: 3

RE[2]: Gcjx explained?
by BryanFeeney on Mon 30th Jan 2006 17:08 in reply to "RE: Gcjx explained?"
BryanFeeney Member since:

Not quite:
GCJ can
1) Convert Java source files created by programmers to bytecode (this is what the Java compiler does)
2) Convert Java source files created by programmers to native code
3) Convert byte-code created by itself or other Java compilers to native code

Byte-Code is an instruction set for a virtual machine. Native code is the instruction set used by an actual machine (e.g. the x86 code used by Intel and AMP chips)

gij is an interpreter that executes a Java byte-code program by converting each individual byte-code instruction to its equivalent native code instruction(s)

This is fairly inefficient, most byte-code runtime systems use "Just-In-Time Compilation". Here, a portion of the byte-code is converted to native code, and the application starts executing. When it finishes with that portion of code, another portion of code is compiled to native code. Some of this native code is cached. As programs tend to do the same thing all the time, they'll tend to use the same native code all the time, so instructions won't have to get compiled that often.

To answer the grandparents post, a traditional compiler takes human-readable instructions entered by a programmer in a programming language like C++, and converts it to the machine code. This is the the set of numbers fed to a CPU like Intels Pentium that consitutes a program.

Because Java compiles to a virtual machine, developers differentiate between "Java compilers" which compile files written by programmers in the Java language to byte-code programs (the machine code of the virtual machine), and the other systems like interpreters and just-in-time compilers that actually convert that to machine code for the maching on which the program is currently running.

Reply Parent Score: 2