4 ms·
This feels like a repeat of the C1 and C2 compiler tiers in the Java HotSpot virtual machine. https://openjdk.java.net/groups/hotspot/docs/HotSpotGlossary.html
by nayuki 5y ago
This feels like a repeat of the C1 and C2 compiler tiers in the Java HotSpot virtual machine. https://openjdk.java.net/groups/hotspot/docs/HotSpotGlossary.html https://openjdk.java.net/groups/hotspot/docs/HotSpotGlossary...
- titzer 5y agoIt isn't. C1 and C2 are two competing optimizing compilers in HotSpot, originally developed by different teams. There is a big difference in compilation time vs code quality between those, though that narrowed as C1 evolved from almost a template-compiler to an SSA-CFG-based compiler. C2 was and is a graph-based, heavily optimizing compiler with a graph coloring register allocation. It's only been in the past 5-10 years or so that both compilers have been used in concert for tiering. Prior to that, they were selected by the "-client" or "-server" options, once at startup. Sparkplug is designed specifically as a baseline compiler that does not have an IR, in order for maximum compile speed. While the idea of two compilers with different compile time/speed tradeoffs is similar, the constants involved are pretty different. TurboFan is similar to C2, but Sparkplug is not similar to C1. They don't compete, but cooperate.
- kaba0 5y agoIf you happen to be somewhat familiar with GraalVM, could you please give us a very brief comparison to it as well? I am very interested in the topic, but it seems very hard to get into it.
- titzer 5y agoProbably better that a Graal expert chimes in, but AFAIK GraalVM has a single optimizing compiler, the Graal compiler. I think it reuses HotSpot's bytecode interpreter. I am not sure if it can operate with either C1 or C2 also enabled. With Truffle, you can write AST-walking interpreters that get automagically turned into optimizing compilers via partial evaluation. It takes some care and tuning to make work well.