Object oriented apparatus and method for allocating array objects on an invocation stack
AssigneeInternational Business Machines Corporation
InventorWilliam Jon Schmidt
Life of this patent
Estimating the term…
Abstract
An object oriented mechanism and method allow allocating Java array objects of unknown size at compile time to a method's invocation stack if the array's size is less than a predetermined threshold value. If the array object could typically be allocated to the invocation stack if it were of a known size at compile time, run-time code is generated that examines the actual size of the array object at run-time and that allocates the array object to the invocation stack if the size is less than a predetermined threshold value. In this manner Java array objects that have an unknown size at compile time may still be allocated to an invocation stack at run-time if the size of the object is sufficiently small.
Claims21
An apparatus comprising:
- at least one processor;
- a memory coupled to the at least one processor;
- an object oriented program residing in the memory comprising at least one array object;
- and
- a run-time code generator that generates a plurality of instructions that are executed at run-time, wherein the plurality of instructions allocate an array object of unknown size at compile time in the object oriented program to an invocation stack frame if the size of the array object determined at run-time does not exceed a predetermined threshold value.
An apparatus comprising:
- at least one processor;
- a memory coupled to the at least one processor;
- an object oriented program residing in the memory comprising at least one array object of unknown size at compile time;
- an escape analysis mechanism that marks each instruction in the object oriented program that creates a new object as one of global escape, no escape, and arg escape;
- a run-time code generator that generates a plurality of instructions that are executed at run-time, wherein the plurality of instructions allocate an array object of unknown size at compile time in the object oriented program to an invocation stack frame for a method that contains an instruction that creates the array object if all of the following are true:
- (A) the instruction that allocates the array object is marked no escape;
- (B) the size of the array object determined at run-time does not exceed a predetermined threshold value;
- and
- (C) the method that contains the instruction cannot be called recursively in the object oriented program.
A method for allocating objects in an object oriented program to memory, the method comprising the steps of:
- generating a plurality of instructions, wherein the plurality of instructions allocate an array object of unknown size at compile time to an invocation stack frame if the size of the array object determined at run-time does not exceed a predetermined threshold value;
- and
- executing the plurality of instructions at run-time.
A method for allocating objects in an object oriented program to memory, the method comprising the steps of:
- marking each instruction in the object oriented program that creates a new object as one of global escape, no escape, and arg escape;
- and
- generating a plurality of instructions that are executed at run-time, wherein the plurality of instructions allocate an array object of unknown size at compile time in the object oriented program to an invocation stack frame for a method that contains an instruction that creates the array object if all of the following are true:
- (A) the instruction that allocates the array object is marked no escape;
- (B) the size of the array object determined at run-time does not exceed a predetermined threshold value;
- and
- (C) the method that contains the instruction cannot be called recursively in the object oriented program.
A program product comprising:
- a run-time code generator that generates a plurality of instructions that are executed at run-time, wherein the plurality of instructions allocate an array object of unknown size at compile time to an invocation stack frame if the size of the array object determined at run-time does not exceed a predetermined threshold value;
- and
- signal bearing media bearing the run-time code generator.
A program product comprising:
- (1) an object allocation optimizer comprising:
- an escape analysis mechanism that marks each instruction in an object oriented program that creates a new object as one of global escape, no escape, and arg escape;
- and
- a run-time code generator that generates a plurality of instructions that are executed at run-time, wherein the plurality of instructions allocate an array object of unknown size at compile time in the object oriented program to an invocation stack frame for a method that contains an instruction that creates the array object if all of the following are true:
- (A) the instruction that allocates the array object is marked no escape;
- (B) the size of the array object determined at run-time does not exceed a predetermined threshold value;
- and
- (C) the method that contains the instruction cannot be called recursively in the object oriented program;
- and
- (2) signal bearing media bearing the object allocation optimizer.
Dependencies are inferred from the claim text.