Data processing: software development – installation – and managem – Software program development tool – Translation of code
Reissue Patent
1999-03-03
2003-04-29
Heckler, Thomas M. (Department: 2185)
Data processing: software development, installation, and managem
Software program development tool
Translation of code
C717S106000, C717S136000, C717S139000, C717S142000, C717S146000
Reissue Patent
active
RE038104
ABSTRACT:
BACKGROUND OF THE INVENTION
1. Field of the Invention
The present invention relates to the field of computer systems, in particular, programming language compilers and interpreters of these computer systems. More specifically, the present invention relates to resolving references in compiler generated object code.
2. Background
The implementation of modern programming languages, including object oriented programming languages, are generally grouped into two categories: compiled and interpreted.
In a compiled programming language, a computer program (called a compiler) compiles the source program and generates executable code for a specific computer architecture. References to data in the generated code are resolved prior to execution based on the layout of the data objects that the program deals with, thereby, allowing the executable code to reference data by their locations. For example, consider a program that deals with a point data object containing two variables x and y, representing the x and y coordinates of a point, and further assume that the variables x and y are assigned slots
1
and
2
respectively, in each instance of the point data object. Thus, an instruction that accesses or fetches y, such as the Load instruction
14
illustrated in
FIG. 1
, is resolved to reference the variable y by the assigned slot
2
before the instruction sequence is executed. Particular examples of programming language compilers that generate code and resolve data references in the manner described above include C and C++ compilers.
This “compiled” approach presents problems when a program is constructed in pieces, which happens frequently under object oriented programming. For example, a program may be constructed from a library and a main program. If a change is made to the library, such that the layout of one of the data objects it implements is changed, then clients of that library, like the main program, need to be recompiled. Continuing the preceding example, if the point data object had a new field added at the beginning called name, which contains the name of the point, then the variables x and y could be reassigned to slots
2
and
3
. Existing programs compiled assuming that the variables x and y and are in slots
1
and
2
will have to be recompiled for them to execute correctly.
In an interpreted language, a computer program (called a translator) translates the source statements of a program into some intermediate form, typically independent of any computer instruction set. References to data in the intermediate form are not fully resolved before execution based on the layout of the data objects that the program deals with. Instead, references to data are made on a symbolic basis. Thus, an instruction that accesses or fetches y, such as the Load instruction
14
′ illustrated in
FIG. 1
, references the variable y by the symbolic name “y”. The program in intermediate form is executed by another program (called an interpreter) which scans through the code in intermediate form, and performs the indicated actions. Each of the symbolic references is resolved during execution each time the instruction comprising the symbolic reference is interpreted. A particular example of a programming language interpreter that translates source code into intermediate form code and references data in the manner described above is the BASIC interpreter.
The “interpreted” approach avoids the problems encountered with the “compiled” approach, when a program is constructed in pieces. However, because of the extra level of interpretation at execution time, each time an instruction comprising a symbolic reference is interpreted, execution is slowed significantly.
Thus, it is desirable if programming languages can be implemented in a manner that provides the execution performance of the “compiled” approach, and at the same time, the flexibility of the “interpreted” approach for altering data objects, without requiring the compiled programs to be recompiled. As will be disclosed, the present invention provides a method and apparatus for resolving data references in compiler generated object code that achieves the desired results.
SUMMARY OF THE INVENTION
A method and apparatus for generating executable code and resolving data references in the generated code is disclosed. The method and apparatus provides execution performance substantially similar to the traditional compiled approach, as well as the flexibility of altering data objects like the traditional interpreted approach. The method and apparatus has particular application to implementing object oriented programming languages in computer systems.
Under the present invention, 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 static field reference routine for handling numeric references and a dynamic field reference routine for handling symbolic 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 interpreter 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 interpreter. 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.
As a result, the “compiled” intermediate form object code of a program achieves execution performance substantially similar to that of the traditional compiled object code, and yet it has the flexibility of not having to be recompiled when the data objects it deals with are altered like that of the traditional translated code, since data reference resolution is performed at the first execution of a generated instruction comprising a data reference.
REFERENCES:
patent: 4636940 (1987-01-01), Goodwin, Jr.
patent: 4667290 (1987-05-01), Goss et al.
patent: 4667920 (1987-05-01), Goss et al.
patent: 4686623 (1987-08-01), Wallace
patent: 4729096 (1988-03-01), Larson
patent: 4773007 (1988-09-01), Kanada et al.
patent: 5201050 (1993-04-01), McKeeman et al.
patent: 5230050 (1993-07-01), Iitsuka et al.
patent: 5276881 (1994-01-01), Chan et al.
patent: 5280613 (1994-01-01), Chan et al.
patent: 5307492 (1994-04-01), Benson
patent: 5313614 (1994-05-01), Goettelmann et al.
patent: 5339419 (1994-08-01), Chan et al.
patent: 5347632 (1994-09-01), Filepp et al.
patent: 5428792 (1995-06-01), Conner et al.
patent: 5442771 (1995-08-01), Filepp et al.
patent: 5594910 (1997-01-01), Filepp et al.
patent: 5613117 (1997-03-01), Davidson et al.
patent: 5649204 (1997-07-01), Pickett
patent: 5758072 (1998-05-01), Filepp et al.
patent: 5836014 (1998-11-01), Faiman, Jr.
Adele Goldberg and David Robson, “Smalltalk-80-The Language and its Implementation”, Xerox Palo Alto Research Center, 1983 (reprinted with corrections, Jul. 1985) pp. 1-720.
Andrew Black, Norman Hutchinson, Eric Jul and Henry Levy, “Distribution and Abstract Types in Emerald”, University of Washington, Technical Report No. 85-08-05, Aug. 1985, pp. 1-10.
Andrew Black, Norman Hutchinson, Eric Jul, and Henry Levy, “Object Structure in the Emerald System”, University of Washington, Technical Report 86-04-03, Apr. 1986, pp. 1-14.
Andrew Blaine Proudfoot, “Replects: data replication in the Eden System”, Department of Computer Science, University of Washington, Technical Report
Finnegan Henderson Farabow Garrett & Dunner L.L.P.
Heckler Thomas M.
Sun Microsystems Inc.
LandOfFree
Method and apparatus for resolving data references in... does not yet have a rating. At this time, there are no reviews or comments for this patent.
If you have personal experience with Method and apparatus for resolving data references in..., we encourage you to share that experience with our LandOfFree.com community. Your opinion is very important and Method and apparatus for resolving data references in... will most certainly appreciate the feedback.
Profile ID: LFUS-PAI-O-3008485