Data processing: software development – installation – and managem – Software program development tool – Translation of code
Reexamination Certificate
1998-08-14
2001-03-20
Chaki, Kakali (Department: 2122)
Data processing: software development, installation, and managem
Software program development tool
Translation of code
C717S152000
Reexamination Certificate
active
06205578
ABSTRACT:
FIELD OF THE INVENTION
The present invention relates generally to interpreters and, more particularly, to an interpreter for stack-based languages.
BACKGROUND OF THE INVENTION
Computer programs are typically written in source code that must be translated into a native machine code so that the translated native machine code can be executed by a computer. For example, Java™ technology uses both compilation and interpretation. Compilation is a process of translating computer code from one language to another language, and storing the results of that translation for later execution on a computer. Many well-known programming languages such as C, Pascal, and Fortran are usually compiled straight from source code to native machine code (i.e., native instructions of a microprocessor). In contrast, the Java™ programming language is typically compiled into independent instructions for the well-known Java™ Virtual Machine (e.g., Sun Microsystems, Inc., provides a commercially available package called the Java™ Development Kit (JDK) 1.0.2 and 1.1).
An interpreter is a program which performs the actions as directed by the source code or intermediate code (e.g., Java™ bytecode), at run time. Thus, interpretation involves translating code from one language to another language except that the translation is directly executed instead of stored for later execution. Languages (or language families) such as Lisp and Basic are typically interpreted straight from source code to native machine code. In contrast, in standard Java™ implementations, the interpreter interprets from the Java™ class files. In particular, Java™ Virtual Machine instructions (e.g., Java™ bytecodes), which were compiled from source code, are interpreted by a Java™ interpreter. Thus, the compiled source code is converted on the fly into native machine code, which is then executed rather than stored.
Interpreting Java™ Virtual Machine instructions is common on existing implementations of the Java™ Virtual Machine, but is not required by either the Java™ Language Specification or the Java™ Virtual Machine Specification. A Java™ Virtual Machine implementation can also use Just-In-Time (JIT) compilation: translating Java™ source code into native machine code at run time on the local platform and then executing the translated (stored) native machine code. Further, another approach is to have hardware such as a microprocessor that directly implements the Java™ Virtual Machine instruction set so that the microprocessor executes Java™ bytecodes directly.
SUMMARY OF THE INVENTION
The present invention provides an improved interpreter for stack-based languages. For example, the present invention provides a cost-effective and high performance apparatus and method for a multi-state interpreter that provides reduced memory access.
In one embodiment, a method includes executing a first interpreter for a first state, and executing a second interpreter for a second state. In particular, the first state indicates that no elements of a stack are stored in registers of a microprocessor, and a second state indicates that an element of the stack is stored in a register of the microprocessor. Accordingly, on modern microprocessors on which memory accesses are costly from a performance standpoint, this embodiment provides improved interpreter performance by reducing memory access during interpretation.
In one embodiment, a method includes executing a first interpreter for a first state, executing a second interpreter for a second state, executing a third interpreter for a third state, and executing a fourth interpreter for a fourth state, in which the first interpreter for the first state is based on no elements of a stack being stored in registers of the microprocessor, the second interpreter for the second stack is based on one element from a top of the stack being stored in a register of the microprocessor, the third interpreter for the third state is based on two elements from the top of the stack being stored in the registers of the microprocessor, and the fourth interpreter for the fourth state is based on three elements from the top of the stack being stored in the registers of the microprocessor. In particular, the method includes changing an interpreter state based on the number of elements of the top of the stack that are stored in the registers of the microprocessor after completing execution of a stack operation. The method also includes calculating a bytecode handler address by adding a base address of the first interpreter, the second interpreter, the third interpreter, or the fourth interpreter and a table offset, in which the table offset is performed using a shift operation. Further, the multi-state interpreter can interpret Java™ program bytecode.
In one embodiment, an article of manufacture includes a first interpreter for a first state, and a second interpreter for a second state, in which the first interpreter is based on there being no elements of a stack stored in registers of a microprocessor, and the second interpreter is based on there being an element of a top of the stack stored in a register of the microprocessor. The article of manufacture also includes instructions for transitioning between the first state and the second state depending on a number of elements of the stack stored in the registers of the microprocessor after executing a stack operation. Further, the second interpreter can be based on one element of the top of the stack being stored in a register of the microprocessor, and the article of manufacture can also include a third interpreter for a third state, and a fourth interpreter for a fourth state, in which the third interpreter is based on there being two elements of the top of the stack stored in the registers of the microprocessor, and the fourth interpreter is based on there being at least three elements of the top of the stack stored in the registers of the microprocessor.
In one embodiment, a machine includes a first interpreter for a first state executed on a microprocessor, and a second interpreter for a second state executed on the microprocessor, in which the first interpreter executes a first handler, which is for a first operation, that is based on there being no elements of a stack stored in registers of the microprocessor, and the second interpreter executes a second handler, which is for the first operation, that is based on there being an element of the stack stored in a register of the microprocessor. In particular, the machine includes state transition code executed on the microprocessor for transitioning between the first interpreter and the second interpreter. Further, the machine can also include a third interpreter for a third state executed on the microprocessor, and a fourth interpreter for a fourth state executed on the microprocessor, in which the third interpreter executes a third handler, which is for the first operation, that is based on there being two elements of the stack stored in the registers of the microprocessor, and the fourth interpreter executes a fourth handler, which is for the first operation, that is based on there being at least three elements of the stack stored in the registers of the microprocessor. In one embodiment, the first interpreter, the second interpreter, the third interpreter, and the fourth interpreter interpret Java™ bytecode and are written in assembly.
Other aspects and advantages of the present invention will become apparent from the following detailed description and accompanying drawings.
REFERENCES:
patent: 5668999 (1997-09-01), Gosling
patent: 5748964 (1998-05-01), Gosling
patent: 5848274 (1998-12-01), Hamby et al.
patent: 5905895 (1999-05-01), Halter
patent: 5923878 (1999-07-01), Marsland
patent: 5933635 (1999-08-01), Holzle et al.
patent: 5970249 (1999-10-01), Holzle et al.
patent: 5995754 (1999-11-01), Holzle et al.
patent: 5999731 (1999-12-01), Yellin et al.
patent: 6009517 (2000-06-01), Bak et al.
patent: 6021273 (2000-01-01), Griesemer
patent: 6026485 (2000-02-01), O'Connor et al.
patent: 6028999 (2000-02-01), Pazel
patent:
ATI International SRL
Booker Kelvin E.
Chaki Kakali
Kwok, Esq. Edward C.
Skjerven Morrill & MacPherson LLP
LandOfFree
Interpreter for stack-based languages does not yet have a rating. At this time, there are no reviews or comments for this patent.
If you have personal experience with Interpreter for stack-based languages, we encourage you to share that experience with our LandOfFree.com community. Your opinion is very important and Interpreter for stack-based languages will most certainly appreciate the feedback.
Profile ID: LFUS-PAI-O-2547791