EP0989488A2

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 rewriting, 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 instruction is a symbolic or a numeric reference.

EP0989488A2, drawing sheet 1
Sheet 1 of 6

Term

Term ended

Projected expiry passed 14 October 2013, 12.9 years ago.

  1. Priority
  2. Filed
  3. Published
  4. Projected expiry
  5. Today

42 claims: 20 independent, 22 dependent

  1. 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 an 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 we being interpreted;said steps b) through d) being performed iteratively and interleavingly.
  2. 5
    The method as at 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 sod step c) without incrementing said program counter, and said continuing interpretation in sod step d) is achieved by performing said step b) after said d) after incrementing said program counter.
  3. 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 -ad 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 d) static reference handling means coupled to said 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.
  4. 11
    A method for interpreting software in intermediate form code, said intermediate form code comprising 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;operative when an instruction being interpreted contains an unresolved symbolic reference, resolving said unresolved symbolic reference in an instruction being interpreted, said step of resolving said unresolved symbolic reference including substeps of: determining a numerical value corresponding to said unresolved symbolic reference, and storing said numerical value reference in a memory;and operative when an instruction being interpreted contains a resolved symbolic reference, interpreting said instruction by reading said stored numerical value.
  5. 22
    A method for compiling software into intermediate form code, said method comprising the steps of:lexically analyzing source code of said software, parsing output of said lexical analysis step, building an intermediate representation from said parsed output, and generating intermediate form code containing symbolic field references from said intermediate representation.
  6. 25
    In a computer, an apparatus for interpreting software in intermediate form code, said intermediate form code comprising instructions, certain of said instructions containing one or more symbolic references, said apparatus comprising:a first device configured to interpret said instructions in accordance with a program execution control;a second device configured, operative when an instruction being interpreted contains an unresolved symbolic reference, to resolve said unresolved symbolic reference, said second device comprising;a third device configured to determine a numerical value corresponding to said unresolved symbolic reference, and a fourth device configured to store said numerical value in a memory;and a fifth device configured, operative when an instruction being interpreted contains a resolved symbolic reference, to interpret said instruction by reading said stored numerical value.
  7. 26
    An apparatus for compiling software into intermediate form code, said apparatus comprising:a first device configured to lexically analyze the source code of said software, a second device configured to parse output of said first device, a third device configured to build an intermediate representation from said parsed output, and a fourth device configured to generate intermediate form code containing symbolic field references from said intermediate representation.
  8. 27
    A computer system, comprising a plurality of one or more interconnected computers, at least one of said plurality of computers comprising an apparatus for interpreting software in an intermediate form code, said intermediate form code comprising instructions. certain of said instructions containing one or more symbolic references, said apparatus comprising:a first device configured to interpret said instructions in accordance with a program execution control;a second device configured, operative when an instruction being interpreted contains an unresolved symbolic reference, to resolve said unresolved symbolic reference, said second device comprising: a third device configured to determine a numerical value corresponding to said unresolved symbolic reference, and a fourth device configured to store said numerical value in a memory of said at least one of said plurality of computers;and a fifth device configured, operative when an instruction being interpreted contains a resolved symbolic reference, to interpret said instruction by reading said stored numerical value.
  9. 28
    A computer system, comprising a plurality of one or more interconnected computers, at least one of said plurality of computers comprising an apparatus for compiling software into intermediate form code, said apparatus comprising:a first device configured to lexically analyze the source code of said software. a second device configured to parse the output of said device configured to lexically analyze, a third device configured to build an intermediate representation from said parsed output. and a fourth device configured to generate intermediate form code containing symbolic field references from said intermediate representation.
  10. 29
    A computer program product comprising:a computer readable medium having computer readable code embodied therein for interpreting software in an intermediate form code, said intermediate form code comprising instructions, certain of said instructions containing one or more symbolic references, said computer readable medium comprising: a computer readable program code device configured to interpret said instructions in accordance with a program execution control;a second computer readable program code device configured, operative when an instruction being interpreted contains an unresolved symbolic reference, to resolve said unresolved symbolic reference, said second computer readable program code device comprising: a third computer readable program code device configured to determine a numerical value corresponding to said unresolved symbolic reference, and a fourth computer readable program code device configured to store said numerical value in a memory of said at least one of said plurality of computers: and a fifth computer readable program code device configured, operative when an instruction being interpreted contains a resolved symbolic reference, to interpret said instruction by reading said stored numerical value.
  11. 30
    A computer program product comprising:a computer readable medium having computer readable code embodied therein for compiling software into intermediate form code, said computer readable medium comprising: a first computer readable program code device configured to lexically analyze source code of said software, a second computer readable program code device configured to parse the output of said first computer readable program code device, a third computer readable program code device configured to build an intermediate representation of said parsed output, and a fourth computer readable program code device configured to generate intermediate form code containing symbolic field references from said intermediate representation.
  12. 31
    A system for distributing code stored on a computer readable medium, said code comprising computer readable code for interpreting software in an intermediate form code, said intermediate form code comprising instructions, certain of said instructions containing one or more symbolic references, said computer readable medium comprising:a computer readable program code device configured to interpret said instructions in accordance with a program execution control;a second computer readable program code device configured, operative when an instruction being interpreted contains an unresolved symbolic reference, to resolve said unresolved symbolic reference, said second computer readable program code device comprising: a third computer readable program code device configured to determine a numerical value corresponding to said unresolved symbolic reference, and a fourth computer readable program code device configured to store said numerical value in a memory of said at least one of said plurality of computers;and a fifth computer readable program code device configured, operative when an instruction being interpreted contains a resolved symbolic reference, to interpret said instruction by reading said stored numerical value.
  13. 32
    A system for distributing code stored on a computer readable medium, said code comprising computer readable code for compiling software into intermediate form code, said computer readable medium comprising:a first computer readable program code device configured to lexically analyze source code of said software, a second computer readable program code device configured to parse the output of said first computer readable program code device, a third computer readable program code device configured to build an intermediate representation of said parsed output, and a fourth computer readable program code device configured to generate intermediate form code containing symbolic field references from said intermediate representation.
  14. 33
    A method for distributing code stored on a computer readable medium, said code comprising computer readable code for interpreting software in an intermediate form code, said intermediate form code comprising instructions, certain of said instructions containing one or more symbolic references, said computer readable medium comprising:a computer readable program code device configured to interpret said instructions in accordance with a program execution control;a second computer readable program code device configured, operative when an instruction being interpreted contains an unresolved symbolic reference, to resolve said unresolved symbolic reference, said second computer readable program code device comprising: a third computer readable program code device configured to determine a numerical value corresponding to said unresolved symbolic reference, and a fourth computer readable program code device configured to store said numerical value in a memory of said at least one of said plurality of computers;and a fifth computer readable program code device configured, operative when an instruction being interpreted contains a resolved symbolic reference, to interpret said instruction by reading said stored numerical value, said method comprising the steps of reading a portion said computer readable code from said computer readable medium into a memory and writing said portion of said code to a second computer readable medium.
  15. 34
    A method for distributing code stored on a computer readable medium, said code comprising computer readable code for compiling software into intermediate form code, said computer readable medium comprising:a first computer readable program code device configured to lexically analyze source code of said software, a second computer readable program code device configured to parse the output of said first computer readable program code device, a third computer readable program code device configured to build an intermediate representation of said parsed output, and a fourth computer readable program code device configured to generate intermediate form code containing symbolic field references from said intermediate representation, said method comprising the steps of reading a portion of said computer readable code from said computer readable medium into a memory and writing said portion of said code to a second computer readable medium.
  16. 35
    A computer implemented method for interpreting intermediate form 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.
  17. 39
    A computer-implemented method for executing a compiled program containing instructions in an intermediate form code, at least one of the instructions containing a symbolic reference, said method comprising the steps of:resolving the symbolic reference in 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.
  18. 40
    A memory encoded with a compiled program, 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, such that when the program is executed by a processor each symbolic field reference is resolved by determining a numerical reference corresponding to the symbolic field reference and data is obtained in accordance with the numerical reference without recompiling the program or any portion thereof.
  19. 41
    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.
  20. 42
    A computer-readable medium containing instructions for controlling a data processing system to perform a method for interpreting a compiled program in intermediate form object code comprised of instructions, at least one of the instructions containing a symbolic reference, said method comprising the steps of:resolving the symbolic reference in 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.
Independent claims20