IP Library Granted Patent US 8,453,128
Granted Patent B2
US 8,453,128 · App. 11/864,847 · Granted May 28, 2013

Method and system for implementing a just-in-time compiler

Inventors: Laurent Daynes (Saint-Ismier, FR); Bernd J. Mathiske (Sunnyvale, CA); Gregory M. Wright (Mountain View, CA); Mario I. Wolczko (San Carlos, CA)
Assignee: Oracle America, Inc.
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 8,453,128
App. No.
11/864,847
Granted
May 28, 2013
Kind
B2
Abstract

A method for implementing a just-in-time compiler involves obtaining high-level code templates in a high-level programming language, where the high-level programming language is designed for compilation to an intermediate language capable of execution by a virtual machine, and where each high-level code template represents an instruction in the intermediate language. The method further involves compiling the high-level code templates to native code to obtain optimized native code templates, where compiling the high-level code templates is performed, prior to runtime, using an optimizing static compiler designed for runtime use with the virtual machine. The method further involves implementing the just-in-time compiler using the optimized native code templates, where the just-in-time compiler is configured to substitute an optimized native code template when a corresponding instruction in the intermediate language is encountered at runtime.

Claims (53)

1. A method for implementing a just-in-time compiler, comprising:

obtaining a plurality of high-level code templates in a high-level programming language,

wherein the high-level programming language is designed for compilation to an intermediate language capable of execution by a virtual machine, and

wherein each high-level code template selected from the plurality of high-level code templates represents an instruction in the intermediate language;

compiling the plurality of high-level code templates to native code to obtain a plurality of optimized native code templates,

wherein compiling the plurality of high-level code templates is performed, prior to runtime, using an optimizing static compiler designed for runtime use with the virtual machine;

marking a constant in an optimized native code template selected from the plurality of optimized native code templates with an annotation, wherein the annotation indicates that the constant requires modification by the just-in-time compiler at runtime; and

implementing the just-in-time compiler using the plurality of optimized native code templates, wherein the just-in-time compiler is configured to substitute a copy of an optimized native code template selected from the plurality of optimized native code templates when a corresponding instruction in the intermediate language is encountered at runtime.

2. The method of claim 1 , further comprising:

extending the optimizing static compiler to support a plurality of mapping instructions in the high-level programming language,

wherein the plurality of mapping instruction provides access to native registers and stack manipulation functions, and

wherein a high-level code template selected from the plurality of high-level code templates comprises a mapping instruction selected from the plurality of mapping instructions.

3. The method of claim 1 , wherein the annotation is associated with an instruction editor, and wherein the just-in-time compiler is further configured to modify the constant, using the instruction editor, at runtime.

4. The method of claim 3 , further comprising:

encountering the annotation at runtime; and

executing the instruction editor based on encountering the annotation, wherein executing the instruction editor comprises modifying the constant based on a runtime context of the constant.

5. The method of claim 1 , wherein the constant is one selected from the group consisting of an offset to a field of an object, an index into a virtual method dispatch table, a literal constant, a reference to a runtime representations of a class, and a reference to a statically linked method.

6. The method of claim 1 , wherein the plurality of optimized native code templates comprises different versions of templates for resolved classes and unresolved classes.

7. A computer system for implementing a just-in-time compiler, comprising:

a virtual machine configured to execute instructions in an intermediate language;

an optimizing static compiler adapted for runtime use with the virtual machine;

a plurality of high-level code templates in a high-level programming language,

wherein the high-level programming language is designed for compilation to the intermediate language, and

wherein each high-level code template selected from the plurality of high-level code templates represents an instruction in the intermediate language; and

a software development environment configured to:

compile the plurality of high-level code templates to native code to obtain a plurality of optimized native code templates prior to runtime;

mark a constant in an optimized native code template selected from the plurality of optimized native code templates with an annotation, wherein the annotation indicates that the constant requires modification by the just-in-time compiler at runtime; and

implement the just-in-time compiler using the plurality of optimized native code templates, wherein the just-in-time compiler is configured to substitute a copy of an optimized native code template selected from the plurality of optimized native code templates when a corresponding instruction in the intermediate language is encountered at runtime.

8. The computer system of claim 7 , wherein the software development environment is further configured to:

extend the optimizing static compiler to support a plurality of mapping instructions in the high-level programming language,

wherein the plurality of mapping instruction provides access to native registers and stack manipulation functions, and

wherein a high-level code template selected from the plurality of high-level code templates comprises a mapping instruction selected from the plurality of mapping instructions.

9. The computer system of claim 7 , wherein the annotation is associated with an instruction editor, and wherein the just-in-time compiler is further configured to modify the constant, using the instruction editor, at runtime.

10. The computer system of claim 7 , wherein the constant is an offset to a field in an object.

11. The computer system of claim 7 , wherein the plurality of optimized native code templates comprises different versions of templates for resolved classes and unresolved classes.

12. A system for implementing a just-in-time complier, comprising:

means for obtaining a plurality of high-level code templates in a high-level programming language,

wherein the high-level programming language is designed for compilation to an intermediate language capable of execution by a virtual machine, and

wherein each high-level code template selected from the plurality of high-level code templates represents an instruction in the intermediate language;

means for compiling the plurality of high-level code templates to native code to obtain a plurality of optimized native code templates,

wherein compiling the plurality of high-level code templates is performed, prior to runtime, using an optimizing static compiler designed for runtime use with the virtual machine;

means for marking a constant in an optimized native code template selected from the plurality of optimized native code templates with an annotation, wherein the annotation indicates that the constant requires modification by the just-in-time compiler at runtime; and

means for implementing the just-in-time compiler using the plurality of optimized native code templates, wherein the just-in-time compiler is configured to substitute a copy of an optimized native code template selected from the plurality of optimized native code templates when a corresponding instruction in the intermediate language is encountered at runtime.

13. The system of claim 12 , further comprising:

means for extending the optimizing static compiler to support a plurality of mapping instructions in the high-level programming language,

wherein the plurality of mapping instruction provides access to native registers and stack manipulation functions, and

wherein a high-level code template selected from the plurality of high-level code templates comprises a mapping instruction selected from the plurality of mapping instructions.

14. The system of claim 12 , wherein the annotation is associated with an instruction editor, and wherein the just-in-time compiler is further configured to modify the constant, using the instruction-editor, at runtime.

15. The system of claim 14 , further comprising:

means for encountering the annotation at runtime; and

means for executing the instruction editor based on encountering the annotation, wherein executing the instruction editor comprises modifying the constant based on a runtime context of the constant.

16. The system of claim 12 , wherein the constant is one selected from the group consisting of an offset to a field of an object, an index into a virtual method dispatch table, a literal constant, a reference to a runtime representations of a class, and a reference to a statically linked method.

17. The system of claim 12 , wherein the plurality of optimized native code templates comprises different versions of templates for resolved classes and unresolved classes.

Assignments (2)
MERGER AND CHANGE OF NAME Recorded Dec 16, 2015
From: ORACLE USA, INC.; SUN MICROSYSTEMS, INC.; ORACLE AMERICA, INC.
To: ORACLE AMERICA, INC.
Reel/Frame 037311/0206 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Oct 2, 2007
From: DAYNES, LAURENT; MATHISKE, BERND J.; WRIGHT, GREGORY M.; WOLCZKO, MARIO I.
To: SUN MICROSYSTEMS, INC.
Reel/Frame 019905/0966 →
Continuity (1)
Related Publication 20090089767A1 · Apr 2, 2009