Effective null pointer check elimination utilizing hardware trap
Effective Null Pointer Check Elimination Utilizing Hardware Trap Motohiro Kawahito Hideaki Komatsu Toshio Nakatani IBM Tokyo Research Laboratory 1623-14, Shimotsuruma, Yamato, Kanagawa, 242-8502, Japan { jl25131, komatsu, nakatani }@jp.ibm.com ABSTRACT We present a new algorithm for eliminating null pointer checks from programs written in Javaâ¢. Our new algorithm is split into two phases. In the first phase, it moves null checks backward, and it is iterated for a few times with other optimizations to eliminate redundant null checks and maximize the effectiveness of other optimizations. In the second phase, it moves null checks forward and converts many null checks to hardware traps in order to minimize the execution cost of the remaining null checks. As a result, it eliminates many null checks effectively and exploits the maximum use of hardware traps. This algorithm has been implemented in the IBM cross-platform Java Just-in-Time (JIT) compiler. Our experimental results show that our approach improves performance by up to 71% for jBYTEmark and up to 10% for SPECjvm98 over the previously known best algorithm. They also show that it increases JIT compilation time by only 2.3%. Although we implemented our algorithm for Java, it is also applicable for other languages requiring null checking. ond is that all the null checks cannot necessarily rely on the hardware support mechanism. For example, some operating systems do not generate an interrupt when the offset of the address is larger than a certain size. As another example, AIX does not generate an interrupt for reading from the first page at the address zero. A more subtle example is that when devirtualization [1, 3, 6, 7, 13] is applied, an explicit null check instruction must be generated for an object access to the method table, since this object access will be eliminated by transforming the dynamic (virtual) call to a static (non-virtual) call or inlining its method body. Here, the execution...