|
The coexistence of programs written in a safe language with user-supplied
unsafe (native) code is convenient (it enables direct access to hardware
and operating system resources and can improve application performance),
but at the same time it is problematic (it leads to undesirable
interference with the language runtime, decreases overall reliability, and
lowers debuggability). This work aims at retaining most of the benefits of
interfacing a safe language with native code while addressing its problems.
It is carried out in the context of the Java[tm] Native Interface (JNI).
Our approach is to execute the native code in an operating system process
different from that of the safe language application. A technique presented
in this paper accomplishes this transparently, automatically, and without
sacrificing any of the JNI functionality. No changes to the Java virtual
machine (JVM[tm]) or its runtime are necessary. The resulting prototype does
not depend on a particular implementation of the JVM, and is highly
portable across hardware architectures and operating systems. This approach
can readily be used to improve reliability of applications consisting of a
mix of safe and native code; to enable the execution of user-supplied
native code in multitasking systems based on safe languages and in embedded
virtual machines; and to facilitate mixed-mode debugging, without the need
to re-implement any of the components of the language runtime. The design
and implementation of a prototype system, performance implications, and the
potential of this architecture are discussed in the paper.
|