2 ms·
I would emphasize that in general Graal isn't a bytecode compiler at all, but a general purpose compiler (somewhat like an LLVM backend) that compiles IR to mac
by pron 11y ago
I would emphasize that in general Graal isn't a bytecode compiler at all, but a general purpose compiler (somewhat like an LLVM backend) that compiles IR to machine code, and that Graal has two frontends: Java bytecode and Truffle.
Also, within HotSpot, Graal isn't necessarily inserted at stage 4; it could also be used in stage 3 (or even 2, instead of interpreting), it's just not recommended because Graal is a slow compiler.
Finally, Graal doesn't need to run in HotSpot at all. Another option of running it is in SubstrateVM, which takes your language's Truffle interpreter, Graal itself and additional Java code (we'll get to that), and AOT-compiles it all to a native binary (which then serves as a JITting VM for your language). If your language requires a GC, that additional code will contain a GC written in Java. I believe Substrate includes a simple GC, but you can write and use your own.