HotSpot Internals: Signals, Safepoints and NullPointers

by Volker Simonis 

Friday, 09 June 2017 11.30 @ Room 2

In contrast to unmanaged languages like C/C++, Java is more secure because it catches frequent programming errors like null pointers or out of bounds array accesses. Of course, this security comes at a certain cost and earned Java the reputation of being slow. But current Java implementations are quite smart and can implement many of these checks at virtually zero costs.

Using small and simple examples, we will deep-dive into HotSpot’s implementation of null-pointer and array-out-of-bounds checks. We will see haw an old and relatively heavy-weight mechanism like Posix signals can be leveraged to speed up common Java patterns. Finally we will peek at the JIT compiler which usually optimizes away most of the associated check overhead except in some corner cases where some of the optimizations may fail.