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) storing a program in a memory, the program including a sequence of instructions, where each of a multiplicity of said instructions each represents an operation on data of a specific data type;
said each instruction having associated data type restrictions on the data type of data to be manipulated by said each instruction;
(B) prior to execution of said program, preprocessing said program by determining whether execution of any instruction in said program would violate said data type restrictions for that instruction and generating a program fault signal when execution of any instruction in said program would violate the data type restrictions for that instruction;
said preprocessing step including;
(B1) storing, for each instruction in said program, a data type snapshot, said data type snapshot including data type information concerning data types associated with data stored in an operand stack and registers by said program immediately prior to execution of the corresponding instruction;
(B2) emulating operation of a selected instruction in the program by;
(B2A) analyzing stack and register usage by said selected instruction so as to generate a current data type usage map for said operand stack and registers, (B2B) determining all successor instructions to said selected instruction, (B2C) merging the current data type usage map with the data type snapshot of said determined successor instructions, and (B2D) marking for further analysis each of said determined successor instruction'"'"'s whose data type snapshot is modified by said merging;
(B3) emulating operation of each of said instructions marked for further analysis by performing step B2 on each of those marked instructions and unmarking each said emulated instruction; and
(B4) repeating step B3 until there are no marked instructions;
said step B2A including determining when said stack and register usage by said instruction would violate said data type restrictions for that instruction and generating a program fault signal when execution of said instruction program would violate said 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.
111 Citations
18 Claims
-
1. A method of operating a computer system, the steps of the method comprising:
-
(A) storing a program in a memory, the program including a sequence of instructions, where each of a multiplicity of said instructions each represents an operation on data of a specific data type;
said each instruction having associated data type restrictions on the data type of data to be manipulated by said each instruction;
(B) prior to execution of said program, preprocessing said program by determining whether execution of any instruction in said program would violate said data type restrictions for that instruction and generating a program fault signal when execution of any instruction in said program would violate the data type restrictions for that instruction;
said preprocessing step including;
(B1) storing, for each instruction in said program, a data type snapshot, said data type snapshot including data type information concerning data types associated with data stored in an operand stack and registers by said program immediately prior to execution of the corresponding instruction;
(B2) emulating operation of a selected instruction in the program by;
(B2A) analyzing stack and register usage by said selected instruction so as to generate a current data type usage map for said operand stack and registers, (B2B) determining all successor instructions to said selected instruction, (B2C) merging the current data type usage map with the data type snapshot of said determined successor instructions, and (B2D) marking for further analysis each of said determined successor instruction'"'"'s whose data type snapshot is modified by said merging;
(B3) emulating operation of each of said instructions marked for further analysis by performing step B2 on each of those marked instructions and unmarking each said emulated instruction; and
(B4) repeating step B3 until there are no marked instructions;
said step B2A including determining when said stack and register usage by said instruction would violate said data type restrictions for that instruction and generating a program fault signal when execution of said instruction program would violate said data type restrictions. - View Dependent Claims (2, 3, 4, 5, 6)
-
-
7. A computer system, comprising:
-
memory for storing a program, the program including a sequence of instructions, where each of a multiplicity of said instructions each represents an operation on data of a specific data type;
said each instruction having associated data type restrictions on the data type of data to be manipulated by said each instruction;
a data processing unit for executing programs stored in said memory;
a program verifier, stored in said memory, said program verifier including data type testing instructions for determining whether execution of any instruction in said program would violate said data type restrictions for that instruction and generating a program fault signal when execution of any instruction in said program would violate the data type restrictions for that instruction;
said data type testing instructions including;
instructions for storing, for each instruction in said program, a data type snapshot, said data type snapshot including data type information concerning data types associated with data stored in an operand stack and registers by said program immediately prior to execution of the corresponding instruction;
instructions for emulating operation of a selected instruction in the program by;
analyzing stack and register usage by said selected instruction so as to generate a current data type usage map for said operand stack and registers, determining all successor instructions to said selected instruction, merging the current data type usage map with the data type snapshot of said determined successor instructions, and marking for further analysis each of said determined successor instruction'"'"'s whose data type snapshot is modified by said merging;
instructions for emulating operation of each of said instructions marked for further analysis and unmarking each said emulated instruction; and
instructions for continuing to emulate operation of any instructions marked for further analysis until there are no marked instructions;
said data type testing instructions including instructions for determining when said stack and register usage by said instruction would violate said data type restrictions for that instruction and generating a program fault signal when execution of said instruction program would violate said data type restrictions. - View Dependent Claims (8, 9, 10, 11, 12)
-
-
13. A memory for storing data for access by programs being executed on a data processing system, said memory comprising:
-
a program stored in said memory, the program including a sequence of instructions, where each of a multiplicity of said instructions each represents an operation on data of a specific data type;
said each instruction having associated data type restrictions on the data type of data to be manipulated by said each instruction;
a program verifier, stored in said memory, said program verifier including data type testing instructions for determining whether execution of any instruction in said program would violate said data type restrictions for that instruction and generating a program fault signal when execution of any instruction in said program would violate the data type restrictions for that instruction;
said data type testing instructions including;
instructions for storing, for each instruction in said program, a data type snapshot, said data type snapshot including data type information concerning data types associated with data stored in an operand stack and registers by said program immediately prior to execution of the corresponding instruction;
instructions for emulating operation of a selected instruction in the program by;
analyzing stack and register usage by said selected instruction so as to generate a current data type usage map for said operand stack and registers, determining all successor instructions to said selected instruction, merging the current data type usage map with the data type snapshot of said determined successor instructions, and marking for further analysis each of said determined successor instruction'"'"'s whose data type snapshot is modified by said merging;
instructions for emulating operation of each of said instructions marked for further analysis and unmarking each said emulated instruction; and
instructions for continuing to emulate operation of any instructions marked for further analysis until there are no marked instructions;
said data type testing instructions including instructions for determining when said stack and register usage by said instruction would violate said data type restrictions for that instruction and generating a program fault signal when execution of said instruction program would violate said data type restrictions. - View Dependent Claims (14, 15, 16, 17, 18)
-
Specification