Inlining java native calls at runtime

Levon Stepanian, Angela Demke Brown, Allan Kielstra, Gita Koblents, Kevin Stoodley · 2005

Despite the overheads associated with the Java Native Interface (JNI), its opaque and binary-compatible nature make it the preferred interoperability mechanism for Java applications that use legacy, high-performance and architecture-dependent native code. This thesis addresses the performance issues associated with the JNI by providing a strategy that transforms JNI callbacks into semantically equivalent but significantly cheaper operations at runtime. In order to do so, the strategy first inlines native functions into Java applications us-ing a Just-in-time (JIT) compiler. Native function inlining is performed by leveraging the abil-ity to store statically-generated intermediate language alongside native binaries. Once inlined, transformed native code can be further optimized due to the availability of runtime information to the JIT compiler. Preliminary evaluations on a prototype implementation of our strategy show that it can sub-stantially reduce the overhead of performing native calls and JNI callbacks, while preserving the opaque and binary-compatible characteristics of the JNI. ii

Read the paper · More papers on PaperTik