Compiler: Implementation Notes”, Jul. 1976, pp. 1-53.
Glanville et al., “A New Method for Compiler Code Generation (Extended Abstract)”, Computer Science Division, University of California, Berkeley, CA, pp. 231-240.
Colusa Software White Paper: “Omniware Technical Overview”, Colusa Software, Inc., 1995, pp. 1-14.
Colusa Software White Paper: Omniware: A Universal Substrate for Mobile Code: Colusa Software, Inc., pp. 1-13.
Ali-Reza Adl-Tabatabai et al., “Efficient and Language-Independent Mobile Programs”, Proceedings of PLDI '96, ACM SIGPLAN '96 Conf. on Programming Language Design and Implementation, May, 1996, pp. 1-10.
Lucco et al., “Omniware: A Universal Substrate for Web Programming”, pp. 1-11.
Wahbe et al., “Efficient Software-Based Fault Isolation”, Computer Science Division, University of California, Berkeley, CA, pp. 203-216.
Graham et al., “Adaptable Binary Programs”, 1995 Usenix Technical Conference—Jan., 1995, New Orleans, LA, pp. 315-325.
Steven Lucco, “High-Performance Microkernel Systems”, School of Computer Science, Carengie Mellon University. p. 1.
Sawdon et al., “A Preliminary Report on Software Prefetching in the Instruction Stream”, School of Computer Science, Carnegie Mellon University, Pittsburgh, PA, pp. 1-7.
Bolosky, et al., “Operating System Directions for the Next Millennium”, Microsoft Research, Redmond, WA, pp. 1-7.
1995 Project Summaries: “Software System Support for High Performance Multicomputing”, School of Computer Science, Carnegie Mellon University, Jul. 1995, pp. 1-4.
Ernst et al., “Code Compression”, 1997, pp. 358-365.
Peter Deutsch et al., “Efficient Implementation of the Smalltalk-80 System”, 1983, pp. 297-302.
Engelstad et al., “A Dynamic C-Based Object-Oriented System for UNIX”, IEEE Software, May, 1991, pp. 73-85.
Gerring, et al., “S-1 U-Code, A Universal P-Code for the S-1 Project (PAIL-6)”, Stanford University, Computer Science Department, Technical Note No. 159, Aug., 1979, pp. 1-7.
Gary McWilliams, “Digital's Architectural Gamble”, Datamation, Mar., 1989, pp. 14-24.
“Architecture-Neutral Distribution Format”, Open Software Foundation, Cambridge, MA, pp. 1-3.
Wolf et al., “Portable Compiler Eases Problems of Software Migration”, System Design/Software, pp. 147-153.
Fischer et al., “Crafting a Compiler”, 1988, pp. 551-555, 632-641.
Anklam et al., “Engineering a Compiler, VAX-11 Code Generation and Optimization”, 1982 Digital Equipment Corporation, pp. 124-137.
Tanenbaum et al., “A Practical Tool Kit for Making Portable Compilers”, Computing Practices, Communications of the ACM, Sep., 1983, vol. 26, No. 9, pp. 654-660.
Almasi et al., “Highly Parallel Computing”, pp. 247-277.
Ann Sussman, “OSF Eyes Shrink-Wrap RFT”, Unix Today, pp. 1, 43.
Evan Grossman, “OSF Adds Ingredients to Operating System”, PC Week, Mar. 27, 1989.
Sites et al., Universal P-Code Definition, Version 0.3, Department of Electrical Engineering and Computer Sciences, University of California at San Diego, Jul. 1979, pp. 5-9.
Goldberg et al., “Smalltalk-80: The Language and Its Implementation”, Addison-Wesley, Reading, MA, 1983, pp. 594-598.
Richard L. Sites and Daniel R. Perkins, “Universal P-Code Definition, version (0.3),” Dept. of Electrical Engineering and Computer Sciences, University of California at San Diego, Jul., 1979, pp. 1-40.
Richard L. Sites et al., “Machine-Independent Pascal Optimizer Project,” UCSD/CS-79/038, Nov. 1979, pp. 1-94.
Peter Nye, U-CODE: An Intermediate Language for Pascal and Fortran (PAIL-8), Feb. 16, 1980, pp. 1-37-2.
Chung, Kin-Man and Yuen, Herbert, “A ‘Tiny’ Pascal Compiler: the P-Code Interpreter,” BYTE Publications, Inc., Sep. 1978.
Chung, Kin-Man and Yuen, Herbert, “A ‘Tiny’ Pascal Compiler: Part 2: The P-Compiler,” BYTE Publications, Inc., Oct. 1978.
Thompson, Ken, “Regular Expression Search Algorithm,” Communications of the ACM, vol. II, No. 6, p. 149 et seq., Jun. 1968.
Mitchell, James G., Maybury, William, and Sweet, Richard, Mesa Language Manual, Xerox Corporation.
McDaniel, Gene, “An Analysis of a Mesa Instruction Set,” Xerox Corporation, May 1982.
Pier, Kenneth A., “A Retrospective on the Dorado, A High-Performance Personal Computer,” Xerox Corporation, Aug. 1983.
Pier, Kenneth A., “A Retrospective on the Dorado, A High-Performance Personal Computer,” IEEE Conference Proceedings, The 10th Annual International Symposium on Computer Architecture, 1983.
Goldberg, Adele and Robson, David, “Smalltalk—80: The Language,” ParcPlace Systems and Xerox PARC, Addison-Wesley Publishing Company, 1989, Chap. 21, pp. 417-442.
Budd, Timothy, “A Little Smalltalk,” Oregon State University, Addison-Wesley Publishing Company, 1987, Chap. 13, pp. 150-160, Chapter 14, pp. 161-175, Chapter 15, pp. 176-192.
Krasner, Glenn, “The Smalltalk-80 Virtual Machine” BYTE Publications Inc., Aug. 1991, pp. 300-320.
Engelstad, Steve, et al., “A Dynamic C-Based Object-Oriented System for Unix,” Software, May 1991, pp. 73-85.
Deutsch, L. Peter, et al., “Efficient Implementation of the Smartalk-80 System,” Conference Record of the Eleventh Annual ACM Symposium on Principles of Programming Languages, Jan. 15-18, 1984, pp. 297-302.
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
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
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
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.
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.
The objects, features, and advantages of the present invention will be apparent from the following detailed description of the presently preferred and alternate embodiments of the invention with references to the drawings in which:
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 the following description for purposes of explanation, specific numbers, materials and configurations are set forth in order to provide a thorough understanding of the present invention. However, it will be apparent to one skilled in the art that the present invention may be practiced without the specific details. In other instances, well known systems are shown in diagrammatical or block diagram form in order not to obscure the present invention unnecessarily.
Referring now to
Except for the manner they are used to practice the present invention, the CPU
As shown in
Referring now to
As shown in
For further descriptions on various parsers, intermediate representation builders, semantic analyzers, and code generators, see A. V. Aho, R. Sethi, and J. D. Ullman, Compilers Principles, Techniques and Tools. Addision-Wesley, 1986, pp. 25-388, and 463-512.
Referring now to
As shown in
On the other hand, if the data reference is determined to be a numeric reference, branch
Referring now to
While the present invention has been described in terms of presently preferred and alternate embodiments, those skilled in the art will recognize that the invention is not limited to the embodiments described. The method and apparatus of the present invention can be practiced with modification and alteration within the spirit and scope of the appended claims. The description is thus to be regarded as illustrative instead of limiting on the present invention.