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 using a Just-in-time (JIT) compiler. Native function inlining is performed by leveraging the ability 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 substantially reduce the overhead of performing native calls and JNI callbacks, while preserving the opaque and binary-compatible characteristics of the JNI. |