By definition, intrinsics are functions which are handled specially by the compiler or the VM. The HotSpot virtual machine supports intrinsics for specific API functions in the interpreter as well as in the C1 and C2 JIT compilers. In general, intrinsics are a great possibility for optimization. But they also come at a certain cost. First of all, they are inherently platform and implementation dependent. If available, they can lead to consistency problems if they are implemented differently in the interpreter and the JIT compilers. Finally, they can change the program control (e.g. safepoint behavior) and observability (e.g. profiling, instrumentation) in subtle ways.
This talk will give you a short deep dive into the HotSpot Virtual Machine using the example of HotSpot intrinsics. It will explain how they are implemented and the implications this has for the Java VM. Finally, it will demonstrate how you can add a new intrinsic for your favorite Java method.