3 ms·
Just a clarification: when used as a JIT, Graal does not compile languages defined with the Truffle framework into Java bytecode. Rather it compiles both Java b
by pron 7y ago
Just a clarification: when used as a JIT, Graal does not compile languages defined with the Truffle framework into Java bytecode. Rather it compiles both Java bytecode and Truffle languages directly into machine code (in this case, the Truffle language is Smalltalk bytecode), which it then installs in Hotspot's code cache. The diagram places the Graal compiler above Hotspot when it would be more appropriate to place it as a component inside of Hotspot, where it replaces the C2 compiler (Java bytecode to machine code), as well as directly compiles Truffle languages into machine code.
Graal can also be used as an AOT compiler ("GraalVM Native Image") -- from Java bytecode (only!) to a native executable that runs independently of Hotspot. If the Java program so compiled is itself a Truffle interpreter, the result is a native interpreter for the Truffle language, that contains an optimizing JIT (for the Truffle language only).
To make things even more interesting, when Graal is used as a Hotspot JIT, because Graal itself is written in Java, it must either compile itself (bootstrapped by Hotspot's Java bytecode interpreter) -- in which case it is both a Java component run by Hotspot as well as a component of Hotspot -- or it could be AOT-compiled into a native shared library, which is then loaded by Hotspot like any other shared library.
- fniephaus 7y agoYes, you're right. I've updated the diagram accordingly.
- walkingolof 7y agoAs of Graal 19.1 , libGraal, a pre-compiled C2 JIT compiler, is bundled with GraalVM. You can use it by adding the following JAVA_OPTS: -XX:+UseJVMCICompiler -XX:+UseJVMCINativeLibrary
- chrisseaton 7y ago> libGraal, a pre-compiled C2 JIT compiler, is bundled with GraalVM libgraal isn't a C2 JIT compiler - it's (the clue is in the name here) a Graal compiler. And the person you're replying to already mentioned it: > or it could be AOT-compiled into a native shared library, which is then loaded by Hotspot like any other shared library