IP Library Granted Patent US 7,181,732
Granted Patent B2
US 7,181,732 · App. 10/121,899 · Granted Feb 20, 2007

Method and apparatus for facilitating lazy type tagging for compiled activations

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 7,181,732
App. No.
10/121,899
Granted
Feb 20, 2007
Kind
B2
Abstract

One embodiment of the present invention provides a system for type tagging values in a compiled activation frame in a lazy manner to facilitate garbage collection. This system operates in a mixed-mode environment that supports both interpretation of byte codes and execution of compiled native code. Upon receiving an invocation of a method, the system creates an activation frame for the method on the execution stack. If the method is executing in interpreted mode, the interpreter maintains a tag for each value in the activation frame during execution. The tag indicates whether the value is a reference type or a primitive type. However, if the method is executing in compiled mode, the system allocates space for tags for each value in the activation frame, but does not fill in the tags during execution. This allows the tags to be filled in at a future time when needed.

Claims (52)

1. A method for type tagging values in a compiled activation frame to facilitate garbage collection, wherein the method operates in a mixed-mode system that supports both interpretation of byte codes and execution of compiled native code, the method comprising:

receiving an invocation of a method;

creating an activation frame for the method on the execution stack;

interpreting byte code methods;

wherein if the method is executing in interpreted mode, the interpretation involves maintaining a tag for each value in the activation frame during execution, wherein a given tag indicates whether a given value is a reference type or a primitive type; and

wherein if the method is executing in compiled mode,

prior to receiving the invocation for the method, the method further comprises:

compiling byte codes of the method into native code; wherein the compilation process involves gathering type information for each value in the activation frame of the method and embedding the type information into the native code associated with the method, and

creating the activation frame involves allocating space for tags for each value in the activation frame, wherein a given tag indicates whether a given value is a reference type or a primitive type;

wherein operations to store type information into the tags in the activation frame are deferred until a subsequent garbage collection operation takes place.

2. The method of claim 1 , wherein embedding the type information into the native code involves storing the type information as bit vectors, wherein each bit specifies whether a corresponding value in the activation frame is a primitive type or a reference type.

3. The method of claim 2 , wherein the bit vectors are embedded in operands of dummy instructions in the native code.

4. The method of claim 2 , wherein the bit vectors are embedded at locations following instructions in the native code that invoke other methods or the runtime system.

5. The method of claim 1 , further comprising performing a garbage collection operation, wherein the garbage collection operation involves:

retrieving type information from the native code; and

storing the type information in the tags in the activation frame of the method.

6. The method of claim 1 , wherein the activation frame for the method created while executing in compiled mode and the activation frame for the method created while executing in interpreted mode are identical in structure.

7. A computer-readable storage medium storing instructions that when executed by a computer cause the computer to perform a method for type tagging values in a compiled activation frame to facilitate garbage collection, wherein the method operates in a mixed-mode system that supports both interpretation of byte codes and execution of compiled native code, the method comprising:

receiving an invocation of a method;

creating an activation frame for the method on the execution stack;

interpreting byte code methods;

wherein if the method is executing in interpreted mode, the interpretation involves maintaining a tag for each value in the activation frame during execution, wherein a given tag indicates whether a given value is a reference type or a primitive type; and

wherein if the method is executing in compiled mode,

prior to receiving the invocation for the method, the method further comprises:

compiling byte codes of the method into native code; wherein the compilation process involves gathering type information for each value in the activation frame of the method and embedding the type information into the native code associated with the method, and

creating the activation frame involves allocating space for tags for each value in the activation frame, wherein a given tag indicates whether a given value is a reference type or a primitive type;

wherein operations to store type information into the tags in the activation frame are deferred until a subsequent garbage collection operation takes place.

8. The computer-readable storage medium of claim 7 , wherein embedding the type information into the native code involves storing the type information as bit vectors, wherein each bit specifies whether a corresponding value in the activation frame is a primitive type or a reference type.

9. The computer-readable storage medium of claim 8 , wherein the bit vectors are embedded in operands of dummy instructions in the native code.

10. The computer-readable storage medium of claim 8 , wherein the bit vectors are embedded at locations following instructions in the native code that invoke other methods or the runtime system.

11. The computer-readable storage medium of claim 7 , wherein the method further comprises performing a garbage collection operation, wherein the garbage collection operation involves:

retrieving type information from the native code; and

storing the type information in the tags in the activation frame of the method.

12. The computer-readable storage medium of claim 7 , wherein the activation frame for the method created while executing in compiled mode and the activation frame for the method created while executing in interpreted mode are identical in structure.

13. An apparatus for type tagging values in a compiled activation frame to facilitate garbage collection, wherein the apparatus is configured to operate in a mixed-mode system that supports both interpretation of byte codes and execution of compiled native code, comprising:

a receiving mechanism configured to receive an invocation of a method;

a creation mechanism configured to create an activation frame for the method on the execution stack;

an interpretation mechanism configured to interpret byte code methods;

wherein if the method is executing in interpreted mode, the interpretation mechanism is configured to maintain a tag for each value in the activation frame during execution, wherein a given tag indicates whether a given value is a reference type or a primitive type; and

wherein if the method is executing in compiled mode, the compilation mechanism is configured to compile byte codes of the method into native code;

wherein the compilation mechanism includes,

a collection mechanism configured to gather type information for each value in the activation frame of the method; and

an embedding mechanism configured to embed the type information into the native code associated with the method, and

the creation mechanism is configured to allocate space for tags for each value in the activation frame, wherein a given tag indicates whether a given value is a reference type or a primitive type;

wherein operations to store type information into the tags in the activation frame are deferred until a subsequent garbage collection operation takes place.

14. The apparatus of claim 13 , wherein the embedding mechanism is configured to store the type information as bit vectors, wherein each bit specifies whether a corresponding value in the activation frame is a primitive type or a reference type.

15. The apparatus of claim 14 , wherein the bit vectors are embedded in operands of dummy instructions in the native code.

16. The apparatus of claim 14 , wherein the bit vectors are embedded at locations following instructions in the native code that invoke other methods or the runtime system.

17. The apparatus of claim 13 , further comprising a garbage collection mechanism, wherein the garbage collection mechanism includes:

a retrieval mechanism configured to retrieve type information from the native code; and

a storage mechanism configured to store the type information in the tags in the activation frame of the method.

18. The apparatus of claim 13 , wherein the activation frame for the method created while executing in compiled mode and the activation frame for the method created while executing in interpreted mode are identical in structure.

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 037302/0719 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Apr 12, 2002
From: BAK, LARS; LUND, KASPER V.
To: SUN MICROSYSTEMS, INC.
Reel/Frame 012804/0615 →