Browse Prior Art Database

Efficient Emulation of the Java Virtual Machine on Non-Java processors

IP.com Disclosure Number: IPCOM000006477D
Original Publication Date: 2002-Jan-07
Included in the Prior Art Database: 2002-Jan-07
Document File: 4 page(s) / 26K

Publishing Venue

Motorola

Related People

David W. Trissel: AUTHOR

Abstract

It is becoming important to efficiently emulate the Java Virtual Machine on non-Java processors. Two techniques are used to enhance the execution speed of Java code run in such an environment. The first relates to the concept that if certain attributes are known in a Java method (a "function" in C terms) then substantial speedups may be accomplished during emulation of that method by the Java Virtual Machine (JVM) emulator and in the production of native code by an execution time JIT (Just-In-Time) Compiler. An additional concept relates to an interpreter dynamically adapting to the attributes of the code it is emulating, and doing so with zero execution time overhead.

This text was extracted from a Microsoft Word document.
This is the abbreviated version, containing approximately 50% of the total text.

Efficient Emulation of the Java Virtual Machine on Non-Java processors

By David W. Trissel

Abstract

It is becoming important to efficiently emulate the Java Virtual Machine on non-Java processors.  Two techniques are used to enhance the execution speed of Java code run in such an environment.  The first relates to the concept that if certain attributes are known in a Java method (a "function" in C terms) then substantial speedups may be accomplished during emulation of that method by the Java Virtual Machine (JVM) emulator and in the production of native code by an execution time JIT (Just-In-Time) Compiler.  An additional concept relates to an interpreter dynamically adapting to the attributes of the code it is emulating, and doing so with zero execution time overhead.

It is becoming important to efficiently emulate the Java Virtual Machine on non-Java processors.  This technique introduces a new method to enhance the execution speed of Java code run in such an environment.  If certain attributes are known in a Java method (a "function" in C terms) then substantial speedups may be accomplished during emulation of that method by the Java Virtual Machine (JVM) emulator and in the production of native code by an execution time JIT (Just-In-Time) Compiler.  This technique gathers such information and uses it to enhance run-time execution speed.  Emulators can therefore use analysis on statically-produced code for dynamic runtime adoption.  Previously, compilers have used dynamic runtime statistics to optimize statically-produced code.

The Java language has strict requirements for what Bytecode instruction sequences are legal in a Class file, and these are checked at runtime during a verification pass when the class is admitted into the Java environment.  The gathering and recording of specific attributes during this verification and the subsequent use of these attributes results in substantial run-time execution speedups.  For example, Java requires the compiler to produce NUMLOCALS and NUMSTACK values for each method.  If the NUMSTACK is 2 or less, then the entire stack can be emulated in General Purpose Registers (GPR).  If the NUMLOCALS value is small enough, then all local variables can be held in GPRs.  Java also requires a method verifier pass that can be used to gather further attributes, such as if 64 bit data (long and double) or floating point types are used.  The following are examples of the types of attributes that if known by the JVM emulator or JIT Compiler, permit the execution and generation of significantly faster code:

1)  If a Java method does any 64-bit operations (i.e. uses long and double Java data types).

2)      If the method uses less than n num...