Interpreter generation and implementation utilizing interpreter states and register caching
AssigneeSun Microsystems, Inc.
InventorRobert Griesemer
Life of this patent
Estimating the term…
Abstract
Systems and methods for increasing the execution speed of interpreted programs which utilize an operand stack are provided. The value for the top of the operand stack is stored in one or more registers. A state of the interpreter indicates the data type of the value for the top of the operand stack stored in the one or more registers. An interpreter may be generated that is both fast and efficient in terms of the memory required for the interpreter.
Claims24
In a computer system including a plurality of registers, a method for implementing an interpreter including an operand stack having a top, the method comprising:
- storing a value for the top of the operand stack in at least one register of the plurality of registers;
- and
- utilizing a state of the interpreter to indicate a data type of the value for the top of the operand stack that is stored in the at least one register;
- wherein the data type is selected from a group that includes at least integer and void data types, wherein the void data type indicates that the value for the top of the operand stack is not currently stored in the at least one register;
- and
- wherein the plurality of registers includes at least two registers that are used for storing values of different data types.
In a computer system, a method for generating an interpreter, the method comprising:
- selecting a virtual machine instruction to be interpreted by the interpreter;
- selecting a state of the interpreter, wherein the state of the interpreter indicates a data type of the value associated with the instruction;
- generating computer code for the interpreter to put the interpreter in an expected state for the selected virtual machine instruction if the selected state differs from an expected state;
- and
- generating computer code for the interpreter to execute the selected virtual machine instruction.
A computer program product that generates an interpreter, the computer program product comprising:
- computer code that selects a virtual machine instruction to be interpreted by the interpreter;
- computer code that selects a state of the interpreter, wherein the state of the interpreter indicates a data type of the value associated with the instruction;
- computer code that generates computer code for the interpreter to put the interpreter in an expected state for the selected virtual machine instruction if the selected state differs from the expected state;
- computer code that generates computer code for the interpreter to execute the selected virtual machine instruction;
- and
- a computer readable medium that stores the computer codes.
A data structure stored by a computer readable medium for use in creating an interpreter of virtual machine instructions, comprising:
- a table stored by the computer readable medium, the table indexed by the virtual machine instructions;
- a first field in the table stored by the computer readable medium, the first field storing expected states of the interpreter before execution of the virtual machine instructions;
- a second field in the table stored by the computer readable medium, the second field storing current states of the interpreter after execution of the virtual machine instructions.
A data structure stored by a computer readable medium for use by an interpreter of virtual machine instructions, the data structure being indexed by the virtual machine instructions and including a plurality of fields in the table stored by the computer readable medium, each field being associated with a state of the interpreter, wherein at least some of the fields store associated pointers to locations in the interpreter that execute the associated indexed virtual machine instructions.
Dependencies are inferred from the claim text.