Method, computer unit and program for converting a program
AssigneeInternational Business Machines Corporation
InventorTakeshi Ogasawara
Life of this patent
Estimating the term…
Abstract
Performs a code elimination by DCE (dead code elimination) more effectively in optimizing a program by compiling. In an example embodiment, a method invocation to be a processing target is determined based on a state of a use of an object reference in a method invocation in an execution program. The method invocation, which has been determined to be a processing target, is inline-expanded. The instance variable of an object in the inline-expanded method invocation is scalarized, and dead code elimination is performed for the execution program, to which an inline-expansion and a scalarization is performed.
Claims19
A method for converting a program which reads in a source code of an execution program written in an object-oriented programming language and converts it into a machine language code, characterized by comprising steps of:
- reading out an execution program to be processed from a memory and examining whether a use of an object reference during a method invocation is an argument in which an element of the object is not used for a particular method invocation in the execution program;
- eliminating a predetermined code in the particular method invocation with dead code elimination, if the particular method invocation does not globalize an object reference during the particular method invocation and if a use of each object reference during the particular method invocation is an argument in which an element of the object is not used, for a predetermined method invocation in said execution program;
- and
- storing an execution program, of which a code has been eliminated, into a memory.
A method for converting a program which reads in a source code of an execution program written in an object-oriented programming language and converts it into a machine language code, said method comprising:
- a first step of reading out an execution program to be processed from a memory and inline-expanding a predetermined method invocation in the execution program;
- a second step of scalarizing an instance variable of an object in said inline-expanded method invocation;
- a third step of executing dead code elimination for said execution program, which has been subject to the first and the second steps;
- and
- a fourth step of storing the execution program, which has been subject to dead code elimination, into a memory.
A computer which reads in a source code of an execution program written in an object-oriented programming language and converts it into a machine language code, characterized by comprising:
- a processing target extraction unit which determines a method invocation to be a processing target based on a state of a use of an object reference in the method invocation;
- an inline-expansion unit that inline-expands the method invocation, which has been determined as a processing target at said processing target extraction unit;
- a scalariation unit which scalarizes an instance variable of an object in said inline-expanded method invocation at said inline-expansion unit;
- and
- a dead code elimination unit that performs dead code elimination for an execution program, which has been subject to processes at said inline-expansion unit and said scalarization unit.
A computer comprising:
- a compiler that compiles a source code of a program, which is written in an object-oriented programming language, and converts it into a machine language code;
- and
- a program execution unit that executes the program, which has been converted into a machine language code,
- wherein said compiler comprises:
- a processing target extraction unit that makes the method invocation as a processing target if the method invocation does not globalize an object reference during the method invocation and if a use of each object reference during the method invocation is an argument, in which an element of the object is not used, for a predetermined method invocation in said program;
- an inline-expansion unit that inline-expands the method invocation, which has been determined as a processing target at said processing target extraction unit;
- a scalarization unit that scalarizes an instance variable of an object in said method invocation, which has been inline-expanded at said inline-expansion unit;
- and
- a dead code elimination unit that performs dead code elimination for an execution program, which has been subject to processes at said inline-expansion unit and said scalarization unit.
A program that controls a computer and converts a source code of an execution program written in an object-oriented programming language into a machine language code, characterized in that said program causes said computer
- to read out an execution program to be processed from a memory and to examine whether a use of an object reference during the method invocation is an argument in which an element of the object is not used, for a method invocation in the execution program;
- to eliminate a predetermined code in the method invocation with dead code elimination, if the method invocation does not globalize an object reference during the method invocation and if a use of each object reference during the method invocation is an argument in which an element of the object is not used, for a predetermined method invocation in the execution program;
- and
- to store an execution program, of which said code has been eliminated.
A program that controls a computer and converts a source code of an execution program written in an object-oriented programming language into a machine language code, characterized in that said program causes said computer to function as
- means for reading out an execution program to be processed from a memory and for determining a method invocation to be a processing target based on a state of a use of an object reference in the method invocation in the execution program;
- means for reading out said execution program to be processed from a memory and for inline-expanding said method invocation, which has been determined as a processing target;
- means for scalarizing an instance variable of an object in said inline-expanded method invocation;
- and
- means for performing dead code elimination for said execution program, which has been subject to said inline-expansion and to said scalarization.
A storage medium, on which a computer readably stores a program that controls the computer and converts a source code of an execution program written in an object-oriented programming language into a machine language code, characterized in that said program causes said computer
- to read out an execution program to be processed from a memory and to examine whether a use of an object reference during a method invocation is an argument in which an element of the object is not used, for the method invocation in the execution program;
- to eliminate a predetermined code in the method invocation with dead code elimination, if the method invocation does not globalize the object reference during the method invocation and if a use of each object reference during the method invocation is an argument in which an element of the object is not used, for a predetermined method invocation in said execution program;
- and
- to store an execution program, of which a code has been eliminated, into a memory.
A storage medium, on which a computer readably stores a program that controls the computer and converts a source code of an execution program written in an object-oriented programming language into a machine language code, characterized in that said program causes said computer to function as
- means for reading out an execution program to be processed from a memory and for determining the method invocation to be a processing target based on a state of a use of an object reference in the method invocation in the execution program;
- means for reading out said execution program to be processed from a memory and for inline-expanding said method invocation, which has been determined as a processing target;
- means for scalarizing an instance variable of an object in said inline-expanded method invocation;
- and
- means for executing dead code elimination for said execution program, which has been subject to said inline-expansion and to said scalarization.
An apparatus for converting a program which reads in a source code of an execution program written in an object-oriented programming language and converts it into a machine language code, comprising:
- means for reading out an execution program to be processed from a memory and examining whether a use of an object reference during a method invocation is an argument in which an element of the object is not used for a particular method invocation in the execution program;
- means for eliminating a predetermined code in the particular method invocation with dead code elimination, if the particular method invocation does not globalize an object reference during the particular method invocation and if a use of each object reference during the particular method invocation is an argument in which an element of the object is not used, for a predetermined method invocation in said execution program;
- and
- means for storing into a memory an execution program, of which a code has been eliminated by said means for eliminating.
Dependencies are inferred from the claim text.