A walkthrough guide to implementing a compiler intrinsic
- Track: Free Java devroom
- Room: H.1302 (Depage)
- Day: Saturday
- Start: 15:50
- End: 16:15
One of the ways Java achieves high performance is to provide a route for accelerated, hand-crafted compilation of certain critical methods via the JIT. This optimization path is available both for native methods implemented as callouts to C code and for methods that are defined in Java. In both cases the method needs to be flagged as a HotspotIntrinsic and provided with a JITted code implementation. The intrinsic implementation defines the hand-crafted definition of as a high-level intermediate representation (IR) graph for the C2 JIT. This means it can be inlined into the IR graph for caller methods, providing even greater opportunities for optimization.
This talk will demonstrate how to implement an intrinsic by walking through a specific real-life example that is currently under review as a JEP candidate. It will start by motivating the need for the intrinsic and defining the candidate as a Java method which relies on an underlying native implementation. It will then show how the candidate can be replaced with an intrinsic implementation, working through the changes required in the VM, the JIT compiler front and back end and, ultimately, the assemblers for x86 and AArch64.
Speakers
Andrew Dinn |