Bytecode program interpreter apparatus and method with pre-verification of data type restrictions and object initialization
First Claim
1. A method of operating a computer system, the steps of the method comprising:
- (A) accessing a program in a memory, the program including a sequence of instructions, where each of a subset of the instructions each represents an operation on data of a specific data type;
each instruction in the subset having associated data type restrictions on the data type of data to be manipulated by that instruction;
(B) storing, for each instruction in the program, a data type snapshot, the data type snapshot including data type information concerning data types associated with data stored in an operand stack and registers by the program immediately prior to execution of the corresponding instruction;
(C) emulating operation of a selected instruction in the program by;
(C1) analyzing stack and register usage by the selected instruction so as to generate a current data type usage map for the operand stack and registers, (C2) determining all successor instructions to the selected instruction, (C3) merging the current data type usage map with the data type snapshot of the determined successor instructions, and (C4) marking for further analysis each of the determined successor instructions whose data type snapshot is modified by said merging;
(D) emulating operation of each of the instructions marked for further analysis by performing step C on each of those marked instructions and unmarking each emulated instruction; and
(E) repeating step D until there are no marked instructions;
said step C1 including determining when the stack and register usage by the instruction would violate the data type restrictions, if any, for that instruction and generating a fault signal when execution of the instruction would violate the data type restrictions.
0 Assignments
0 Petitions
Accused Products
Abstract
A program interpreter for computer programs written in a bytecode language, which uses a restricted set of data type specific bytecodes. The interpreter, prior to executing any bytecode program, executes a bytecode program verifier procedure that verifies the integrity of a specified program by identifying any bytecode instruction that would process data of the wrong type for such a bytecode and any bytecode instruction sequences in the specified program that would cause underflow or overflow of the operand stack. If the program verifier finds any instructions that violate predefined stack usage and data type usage restrictions, execution of the program by the interpreter is prevented. After pre-processing of the program by the verifier, if no program faults were found, the interpreter executes the program without performing operand stack overflow and underflow checks and without performing data type checks on operands stored in operand stack. As a result, program execution speed is greatly improved.
167 Citations
18 Claims
-
1. A method of operating a computer system, the steps of the method comprising:
-
(A) accessing a program in a memory, the program including a sequence of instructions, where each of a subset of the instructions each represents an operation on data of a specific data type;
each instruction in the subset having associated data type restrictions on the data type of data to be manipulated by that instruction;(B) storing, for each instruction in the program, a data type snapshot, the data type snapshot including data type information concerning data types associated with data stored in an operand stack and registers by the program immediately prior to execution of the corresponding instruction; (C) emulating operation of a selected instruction in the program by;
(C1) analyzing stack and register usage by the selected instruction so as to generate a current data type usage map for the operand stack and registers, (C2) determining all successor instructions to the selected instruction, (C3) merging the current data type usage map with the data type snapshot of the determined successor instructions, and (C4) marking for further analysis each of the determined successor instructions whose data type snapshot is modified by said merging;(D) emulating operation of each of the instructions marked for further analysis by performing step C on each of those marked instructions and unmarking each emulated instruction; and (E) repeating step D until there are no marked instructions; said step C1 including determining when the stack and register usage by the instruction would violate the data type restrictions, if any, for that instruction and generating a fault signal when execution of the instruction would violate the data type restrictions. - View Dependent Claims (2, 3, 4, 5, 6)
-
-
7. A computer program product for use in conjunction with a computer system, the computer program product comprising a computer readable storage medium and a computer program mechanism embedded therein, the computer program mechanism comprising:
-
a program verifier, stored in the memory, for verifying that any specified program meets predefined data type and program stack usage restrictions, the specified program including a sequence of instructions, where each of a subset of the instructions each represents an operation on data of a specific data type;
each instruction in the subset having associated data type restrictions on the data type of data to be manipulated by that instruction;the program verifier including data type testing instructions for determining whether execution of any instruction in a specified program would violate data type restrictions, if any, for that instruction and generating a program fault signal when execution of any instruction in the specified program would violate the data type restrictions for that instruction; the data type testing instructions including; instructions for storing, for each instruction in the specified program, a data type snapshot, the data type snapshot including data type information concerning data types associated with data stored in an operand stack and registers by the specified program immediately prior to execution of the corresponding instruction; instructions for emulating operation of a selected instruction in the specified program by;
analyzing stack and register usage by the selected instruction so as to generate a current data type usage map for the operand stack and registers, determining all successor instructions to the selected instruction, merging the current data type usage map with the data type snapshot of the determined successor instructions, and marking for further analysis each of the determined successor instructions whose data type snapshot is modified by said merging;instructions for emulating operation of each of the instructions marked for further analysis and unmarking each emulated instruction; and instructions for continuing to emulate operation of any instructions marked for further analysis until there are no marked instructions; the data type testing instructions including instructions for determining when the stack and register usage by the instruction would violate the data type restrictions for that instruction and generating a program fault signal when execution of the instruction would violate the data type restrictions. - View Dependent Claims (8, 9, 10, 11, 12)
-
-
13. A computer data signal embodied in a carrier wave, comprising:
-
a program verifier, stored in the memory, for verifying that any specified program meets predefined data type and program stack usage restrictions, the specified program including a sequence of instructions, where each of a subset of the instructions each represents an operation on data of a specific data type;
each instruction in the subset having associated data type restrictions on the data type of data to be manipulated by that instruction;the program verifier including data type testing instructions for determining whether execution of any instruction in a specified program would violate data type restrictions, if any, for that instruction and generating a program fault signal when execution of any instruction in the specified program would violate the data type restrictions for that instruction; the data type testing instructions including; instructions for storing, for each instruction in the specified program, a data type snapshot, the data type snapshot including data type information concerning data types associated with data stored in an operand stack and registers by the specified program immediately prior to execution of the corresponding instruction; instructions for emulating operation of a selected instruction in the specified program by;
analyzing stack and register usage by the selected instruction so as to generate a current data type usage map for the operand stack and registers, determining all successor instructions to the selected instruction, merging the current data type usage map with the data type snapshot of the determined successor instructions, and marking for further analysis each of the determined successor instructions whose data type snapshot is modified by said merging;instructions for emulating operation of each of the instructions marked for further analysis and unmarking each emulated instruction; and instructions for continuing to emulate operation of any instructions marked for further analysis until there are no marked instructions; the data type testing instructions including instructions for determining when the stack and register usage by the instruction would violate the data type restrictions for that instruction and generating a program fault signal when execution of the instruction would violate the data type restrictions. - View Dependent Claims (14, 15, 16, 17, 18)
-
Specification