Essential JNI: Java Native Interface
Essential JNI: Java Native Interface
Java Native Interface: Programmer's Guide and Reference
Java Native Interface: Programmer's Guide and Reference
An Evaluation of Java for Numerical Computing
ISCOPE '98 Proceedings of the Second International Symposium on Computing in Object-Oriented Parallel Environments
Inlining java native calls at runtime
Proceedings of the 1st ACM/USENIX international conference on Virtual execution environments
Jeannie: granting java native interface developers their wishes
Proceedings of the 22nd annual ACM SIGPLAN conference on Object-oriented programming systems and applications
An empirical security study of the native code in the JDK
SS'08 Proceedings of the 17th conference on Security symposium
A toolkit for efficient numerical applications in Java
Advances in Engineering Software
Self-optimizing AST interpreters
Proceedings of the 8th symposium on Dynamic languages
Truffle: a self-optimizing runtime system
Proceedings of the 3rd annual conference on Systems, programming, and applications: software for humanity
Compilation queuing and graph caching for dynamic compilers
Proceedings of the sixth ACM workshop on Virtual machines and intermediate languages
Hi-index | 0.00 |
We present an efficient and dynamic approach for calling native functions from within Java. Traditionally, programmers use the Java Native Interface (JNI) to call such functions. This paper introduces a new mechanism which we tailored specifically towards calling native functions from Java. We call it the Graal Native Function Interface (GNFI). It is faster than JNI in all relevant cases and more flexible because it avoids the JNI boiler-plate code. GNFI enables the user to directly invoke native code from Java applications. We describe how GNFI creates call stubs for native functions that a just-in-time (JIT) compiler can optimize and how we embed these stubs into Java code. We introduce different approaches for calling native functions from within compiled and interpreted Java code. In particular, we describe how our approach embeds the call stubs into a Java application so that the JIT-compiled code consists of a direct call to a native function. We evaluate the call overhead of GNFI. The measurements demonstrate a significant performance advantage of GNFI compared to JNI and the Java Native Access (JNA). Also, we evaluate our approach against JNI and JNA on a jblas matrix multiplication benchmark. The evaluation shows that GNFI outperforms JNI and JNA in compiled and interpreted mode by a factor of 1.9 in the best case.