Method and apparatus for resolving data references in generated code
Abstract
A hybrid compiler-interpreter comprising a compiler for “compiling” source program code, and an interpreter for interpreting the “compiled” code, is provided to a computer system. The compiler comprises a code generator that generates code in intermediate form with data references made on a symbolic basis. The interpreter comprises a main interpretation routine, and two data reference handling routines, a dynamic field reference routine for handling symbolic references, and a static field reference routine for handling numeric references. The dynamic field reference routine, when invoked, resolves a symbolic reference and rewrites the symbolic reference into a numeric reference. After re-writing, the dynamic field reference routine returns to the main interpretation routine without advancing program execution to the next instruction, thereby allowing the rewritten instruction with numeric reference to be reexecuted. The static field reference routine, when invoked, obtain data for the program from a data object based on the numeric reference. After obtaining data, the static field reference routine advances program execution to the next instruction before returning to the interpretation routine. The main interpretation routine selectively invokes the two data reference handling routines depending on whether the data reference in an interaction in a symbolic or a numeric reference.
Claims
exact text as granted — not AI-modifiedWhat is claimed is:
1. In a computer system comprising a program in source code form, a method for generating executable code for said program and resolving data references in said generated code, said method comprising the steps of:
a) generating executable code in intermediate form for said program in source code form with data references being made in said generated code on a symbolic basis, said generated code comprising a plurality of instructions of said computer system;
b) interpreting said instructions, one at a time, in accordance to a program execution control;
c) resolving said symbolic references to corresponding numeric references, replacing said symbolic references with their corresponding numeric references, and continuing interpretation without advancing program execution, as said symbolic references are encountered while said instructions are being interpreted; and
d) obtaining data in accordance to said numeric references, and continuing interpretation after advancing program execution, as said numeric references are encountered while said instruction are being interpreted;
said steps b) through d) being performed iteratively and interleaving.
2. The method as set forth in claim 1 , wherein, said program in source code form is implemented in source code form of an object oriented programming language.
3. The method as set forth in claim 2 , wherein said programming language is C.
4. The method as set forth in claim 2 , wherein, said programming language is C++.
5. The method as set forth in claim 1 , wherein, said program execution control is a program counter said continuing interpretation in step c) is achieved by performing said step b) after said c) without incrementing said program counter; and
said continuing interpretation in said step d) is achieved by performing said step b) after said d) after incrementing said program counter.
6. In a computer system comprising a program in source code form, an apparatus for generating executable code for said program and resolving data references in said generated code, said apparatus comprising:
a) compilation means for receiving said program in source code form and generating executable code in intermediate form for said program in source code form with data references being made in said generated code on a symbolic basis, said generated code comprising a plurality of instructions of said computer system;
b) interpretation means for receiving said generated code and interpreting said instructions, one at a time;
c) dynamic reference handling means coupled to said interpretation means for resolving said symbolic references to corresponding numeric references, replacing said symbolic references with their corresponding numeric references, and continuing interpretation by said interpretation means without advancing program execution, as said symbolic references are encountered while said instructions are being interpreted by said interpretation means; and
d) static reference handling means coupled to said interpretation means for obtaining data in accordance to said numeric references, and continuing interpretation by said interpretation means after advancing program execution, as said numeric references are encountered while said instruction are being interpreted by said interpretation means;
said interpretation means, said dynamic reference handling means, and said static reference handling means performing their corresponding functions iteratively and interleavingly.
7. The apparatus as set forth in claim 6 , wherein, said program in source code form is implemented in source code form of an object oriented programming language.
8. The apparatus as set forth in claim 7 , wherein, said programming language is C.
9. The apparatus as set forth in claim 7 , wherein, said programming language is C++.
10. The apparatus as set forth in claim 6 , wherein, and program execution control is a program counter.
11. An apparatus comprising:
a memory containing intermediate form object code constituted by a set of instructions, certain of said instructions containing one or more symbolic references; and
a processor configured to execute said instructions containing one or more symbolic references by determining a numerical reference corresponding to said symbolic reference, storing said numerical references, and obtaining data in accordance to said numerical references.
12. A computer- readable medium containing instructions for controlling a data processing system to perform a method for interpreting intermediate form object code comprised of instructions, certain of said instructions containing one or more symbolic references, said method comprising the steps of:
interpreting said instructions in accordance with a program execution control; and
resolving a symbolic reference in an instruction being interpreted, said step of resolving said symbolic reference including the substeps of:
determining a numerical reference corresponding to said symbolic reference, and
storing said numerical reference in a memory.
13. A computer- implemented method for executing instructions, certain of said instructions containing one or more symbolic references, said method comprising the steps of:
resolving a symbolic reference in an instruction, said step of resolving said symbolic reference including the substeps of:
determining a numerical reference corresponding to said symbolic reference, and
storing said numerical reference in a memory.
14. The method of claim 3 , wherein said substep of storing said numerical reference comprises the substep of replacing said symbolic reference with said numerical reference.
15. The method of claim 3 , wherein said step of resolving said symbolic reference further comprises the substep of executing said instruction containing said symbolic reference using the stored numerical reference.
16. The method of claim 3 , wherein said step of resolving said symbolic reference further comprises the substep of advancing program execution control after said substep of executing said instruction containing said symbolic reference.
17. In a computer system comprising a program, a method for executing said program comprising the steps of:
receiving intermediate form object code for said program with symbolic data references in certain instructions of said intermediate form object code; and
converting the instructions of the intermediate form object code having symbolic data references, said converting step comprising the substeps of:
resolving said symbolic references to corresponding numerical references,
storing said numerical references, and
obtaining data in accordance to said numerical references.
18. A computer- implemented method for executing program operations, each operation being comprised of a set of instructions, certain of said instructions containing one or more symbolic references, said method comprising the steps of:
receiving a set of instructions reflecting an operation; and
performing the operation corresponding to the received set of instructions, wherein at least one of said symbolic references is resolved by determining a numerical reference corresponding to said symbolic reference, storing said numerical reference, and obtaining data in accordance to said stored numerical reference.
19. A memory for use in executing a program by a processor, the memory comprising:
intermediate form code containing symbolic field references associated with an intermediate representation of source code for the program,
the intermediate representation having been generated by lexically analyzing the source code and parsing output of said lexical analysis, and
wherein the symbolic field references are resolved by determining a numerical reference corresponding to said symbolic reference, and storing said numerical reference in a memory.
20. A computer- implemented method comprising:
receiving a program that comprises a set instructions written in an intermediate form code;
replacing each instruction in the program with a symbolic data reference with a new instruction containing a numeric reference resulting from invocation of a dynamic field reference routine to resolve the symbolic data reference; and
executing the program by performing an operation in accordance with each instruction or new instruction, depending upon whether an instruction has been replaced with a new instruction in accordance with the replacing step.
21. A data processing system, comprising:
a processor; and
a memory comprising a control program for causing the processor to (i) receive a program that comprises a set instructions written in an intermediate form code, (ii) replace each instruction in the program with a symbolic data reference with a new instruction containing a numeric reference resulting from invocation of a dynamic field reference routine to resolve the symbolic data reference, and (iii) execute the program by performing an operation in accordance with each instruction or new instruction, depending upon whether an instruction has been replaced with a new instruction in accordance with the replacing step.
22. An apparatus comprising:
a memory containing a compiled program in intermediate form object code constituted by a set of instructions, at least one of the instructions containing a symbolic reference; and
a processor configured to execute the instruction by determining a numerical reference corresponding to the symbolic reference, and performing an operation in accordance with the instruction and data obtained in accordance with the numerical reference without recompiling the program or any portion thereof.
23. A computer- implemented method, comprising:
receiving a program with a set instructions written in an intermediate form code;
analyzing each instruction of the program to determine whether the instruction contains a symbolic reference to a data object; and
executing the program, wherein when it was determined that an instruction contains a symbolic reference, data from a storage location identified by a numeric reference correspoding to the symbolic reference is used thereafter to perform an operation corresponding to that instruction.
24. A computer- implemented method for executing a program comprised of bytecodes, the method comprising:
determining immediately prior to execution whether a bytecode of the program contains a symbolic data reference;
when it is determined that the bytecode of the program contains a symbolic data reference, invoking a dynamic field reference routine to resolve the symbolic data reference; and
executing thereafter the bytecode using stored data located using a numeric reference resulting from the resolution of the symbolic reference.
25. A data processing system, comprising:
a processor; and
a memory comprising a program comprised of bytecodes and instructions for causing the processor to ( i ) determine immediately prior to execution of the program whether a bytecode of the program contains a symbolic data reference , ( ii ) when it is determined that the bytecode of the program contains a symbolic data reference, invoke a dynamic field reference routine to resolve the symbolic data reference, and ( iii ) execute thereafter the bytecode using stored data located using a numeric reference resulting from the resolution of the symbolic reference.
26. A computer program product containing instructions for causing a computer to perform a method for executing a program comprised of bytecodes, the method comprising:
determining immediately prior to execution whether a bytecode of the program contains a symbolic data reference;
when it is determined that the bytecode of the program contains a symbolic data reference, invoking a dynamic field reference routine to resolve the symbolic data reference; and
executing thereafter the bytecode using stored data located using a numeric reference resulting from the resolution of the symbolic reference.
27. A computer- implemented method comprising:
receiving a program with a set of original instructions written in an intermediate form code;
generating a set of new instructions for the program that contain numeric references resulting from invocation of a routine to resolve any symbolic data references in the set of original instructions; and
executing the program using the set of new instructions.
28. A data processing system, comprising:
a processor; and
a memory comprising a control program for causing the processor to ( i ) receive a program with a set of original instructions written in an intermediate form code , ( ii ) generate a set of new instructions for the program that contain numeric references resulting from invocation of a routine to resolve any symbolic data references in the set of original instructions, and ( iii ) executing the program using the set of new instructions.
29. A computer program product containing instructions for causing a computer to perform a method, the method comprising:
receiving a program with a set of original instructions written in an intermediate form code;
generating a set of new instructions for the program that contain numeric references resulting from invocation of a routine to resolve any symbolic data references in the set of original instructions; and
executing the program using the set of new instructions.
30. A computer- implemented method comprising:
receiving a program that comprises a set instructions written in an intermediate form code;
replacing each instruction in the program with a symbolic data reference with a new instruction containing a numeric reference resulting from invocation of a dynamic field reference routine to resolve the symbolic data reference; and
executing the program by performing an operation in accordance with each instruction or new instruction, depending upon whether an instruction has been replaced with a new instruction in accordance with the replacing step.
31. A data processing system, comprising:
a processor; and
a memory comprising a control program for causing the processor to ( i ) receive a program that comprises a set instructions written in an intermediate form code, ( ii ) replace each instruction in the program with a symbolic data reference with a new instruction containing a numeric reference resulting from invocation of a dynamic field reference routing to resolve the symbolic data reference, and ( iii ) execute the program by performing an operation in accordance with each instruction or new instruction, depending upon whether an instruction has been replaced with a new instruction in accordance with the replacing step.
32. A computer program product containing control instructions for causing a computer to perform a method, the method comprising:
receiving a program that comprises a set instructions written in an intermediate form code;
replacing each instruction in the program with a symbolic data reference with a new instruction containing a numeric reference resulting from invocation of a dynamic field reference routine to resolve the symbolic data reference; and
executing the program by performing an operation in accordance with each instruction or new instruction, depending upon whether an instruction has been replaced with a new instruction in accordance with the replacing step.
33. A computer- implemented method, comprising:
receiving a program with a set instructions written in an intermediate form code;
analyzing each instruction of the program to determine whether the instruction contains a symbolic reference to a data object; and
executing the program, wherein when it was determined that an instruction contains a symbolic reference, data from a storage location identified by a numeric reference corresponding to the symbolic reference is used thereafter to perform an operation corresponding to that instruction.
34. A data processing system, comprising:
a processor; and
a memory comprising a control program for causing the processor to ( i ) receive a program with a set instructions written in an intermediate form code, ( ii ) analyze each instruction of the program to determine whether the instruction contains a symbolic reference to a data object, and ( iii ) execute the program, wherein when it was determined that an instruction contains a symbolic reference, data from a storage location identified by a numeric reference corresponding to the symbolic reference is used thereafter to perform an operation corresponding to that instruction.
35. A computer program product containing control instructions for causing a computer to perform a method, the method comprising:
receiving a program with a set instructions written in an intermediate form code;
analyzing each instruction of the program to determine whether the instruction contains a symbolic reference to a data object; and
executing the program, wherein when it was determined that an instruction contains a symbolic reference, data from a storage location identified by a numeric reference corresponding to the symbolic reference is used thereafter to perform an operation corresponding to that instruction.
36. A computer- implemented method for executing a program comprised of bytecodes, the method comprising:
determining whether a bytecode of the program contains a symbolic reference;
when it is determined that the bytecode contains a symbolic reference, invoking a dynamic field reference routine to resolve the symbolic reference; and
performing an operation identified by the bytecode thereafter using data from a storage location identified by a numeric reference resulting from the invocation of the dynamic field reference routine.
37. A data processing system, comprising:
a processor; and
a memory comprising a program comprised of bytecodes and instructions for causing the processor to ( i ) determine whether a bytecode of the program contains a symbolic reference, ( ii ) when it is determined that the bytecode contains a symbolic reference, invoke a dynamic field reference routine to resolve the symbolic reference, and ( iii ) perform an operation identified by the bytecode thereafter using data from a storage location identified by a numeric reference resulting from the invocation of the dynamic field reference routine.
38. A computer program product containing instructions for causing a computer to perform a method for executing a program comprised of bytecodes, the method comprising:
determining whether a bytecode of the program contains a symbolic reference;
when it is determined that the bytecode contains a symbolic reference, invoking a dynamic field reference routine to resolve the symbolic reference; and
performing an operation identified by the bytecode therafter using data from a storage location identified by a numeric reference resulting from the invocation of the dynamic field reference routine.
39. A computer- implemented method comprising:
receiving a program formed of instructions written in an intermediate form code compiled from source code;
analyzing each instruction to determine whether it contains a symbolic field reference; and
executing the program by performing an operation identified by each instruction, wherein data from a storage location identified by a numeric reference is thereafter used for the operation when the instruction contains a symbolic field reference, the numeric reference having been resolved from the symbolic field reference.
40. A data processing system, comprising:
a processor; and
a memory comprising a control program for causing the processor to ( i ) receive a program formed of instructions written in an intermediate form code compiled from source code, ( ii ) analyze each instruction to determine whether it contains a symbolic field reference, and ( iii ) execute the program by performing an operation identified by each instruction, wherein data from a storage location identified by a numeric reference is thereafter used for the operation when the instruction contains a symbolic field reference, the numeric reference having been resolved from the symbolic field reference.
41. A computer program product containing control instructions for causing a computer to perform a method, the method comprising:
receiving a program formed of instructions written in an intermediate form code compiled from source code;
analyzing each instruction to determine whether it contains a symbolic field reference; and
executing the program by performing an operation identified by each instruction, wherein data from a storage location identified by a numeric reference is used thereafter for the operation when the instruction contains a symbolic field reference, the numeric reference having been resolved from the symbolic field reference.Join the waitlist — get patent alerts
Track USRE38104E — get alerts on status changes and closely related new filings.
We store only your email — no account needed. See our privacy policy.