IP Library Granted Patent US 7,458,071
Granted Patent B2
US 7,458,071 · App. 11/016,934 · Granted Nov 25, 2008

Compilation method, compiler apparatus and compiler

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,458,071
App. No.
11/016,934
Granted
Nov 25, 2008
Kind
B2
Abstract

The compilation method, which allows a programmer to perform programming without minding about pass-by-reference, and offers efficiency in generating codes even in the case of using “pass by value”, includes the following: generating intermediate codes from a source program; optimizing the intermediate codes by converting a procedure that calls a procedure with pass-by-value argument into a procedure that calls a procedure with pass-by-reference argument, in the case where there is no procedure that may indirectly call the procedure with pass-by-value argument, and the pass-by-value is not updated within the definition according to the procedure with pass-by-value argument; and converting the optimized intermediate codes into object codes.

Claims (60)

1. A compilation method for converting a source program written in a high-level language into object codes, comprising:

generating intermediate codes from the source program;

optimizing the intermediate codes by converting a pass-by-value argument into a pass-by-reference argument, in the case where both of the following conditions are satisfied: there is no procedure that may indirectly call a procedure with pass-by-value argument; and the pass-by-value argument is not updated within a definition according to the procedure with pass-by-value argument; and

converting the optimized intermediate codes into object codes,

wherein the optimizing further includes:

extracting pass-by-value argument update information based on the intermediate codes, the information including at least the following: a procedure with pass-by-value argument; a procedure that directly calls the procedure with pass-by-value argument; a procedure that may indirectly call the procedure with pass-by-value argument; a pass-by-value argument of the procedure with pass-by-value argument; and update judgment information indicating whether or not the pass-by-value argument is updated within the definition according to the procedure with pass-by-value argument; and

converting the procedure that calls a procedure with pass-by-value argument into the procedure that calls a procedure with pass-by-reference, in the case where the pass-by-value argument update information indicates that there is no procedure that may indirectly call a procedure with pass-by-value argument, and the pass-by-value argument is not updated within the definition according to the procedure with pass-by-value argument.

2. The compilation method according to claim 1 ,

wherein in the optimizing, in the case where both of the following conditions are satisfied: there is no procedure that may indirectly call a procedure with pass-by-value argument; and the pass-by-value argument is not updated within the definition according to the procedure with pass-by-value argument, the intermediate codes are optimized by converting the procedure that calls a procedure with pass-by-value argument into a procedure that calls a procedure with pass-by-reference argument.

3. The compilation method according to claim 2 , further comprising

optimizing the intermediate codes by converting, for the procedure with pass-by-value argument, an argument passing with the use of pass-by-value into an argument passing with the use of pass-by-reference.

4. The compilation method according to claim 1 ,

wherein in the converting, when it is not specified to forcedly convert the procedure that directly calls a procedure with pass-by-value argument into the procedure that directly calls a procedure with pass-by-reference argument, a procedure with pass-by-value argument is converted into a procedure with pass-by-reference argument, in the case where the pass-by-value argument update information indicates that neither there is a procedure that may indirectly call a procedure with pass-by-value argument nor the pass-by-value argument is updated within the definition according to the procedure with pass-by-value argument.

5. The compilation method according to claim 1 ,

wherein in the converting, when it is specified to forcedly convert a procedure that directly calls a procedure with pass-by-value argument into a procedure that directly calls a procedure with pass-by-reference argument, the following conversions are performed as specified for the procedure that directly calls a procedure with pass-by-value argument, based on the pass-by-value argument update information: the procedure that directly calls a procedure with pass-by-value argument is converted into the procedure that directly calls a procedure with pass-by-reference argument; and the procedure that may indirectly call a procedure with pass-by-value argument is converted into the procedure that may indirectly call a procedure with pass-by-reference argument.

6. The compilation method according to claim 1 ,

wherein in the optimizing, in the case where both of the following conditions are satisfied: there is no procedure that may indirectly call a procedure with pass-by-value argument; and the pass-by-value argument is not updated within the definition according to the procedure with pass-by-value argument, the intermediate codes are optimized by converting an argument passing with the use of pass-by-value into an argument passing with the use of pass-by-reference.

7. The compilation method according to claim 6 ,

wherein the optimizing further includes:

extracting pass-by-value argument update information based on the intermediate codes, the information at least including: a procedure with pass-by-value argument; a procedure that directly calls the procedure with pass-by-value argument; a pass-by-value argument of the procedure with pass-by-value argument; and update judgment information indicating whether or not the pass-by-value argument is updated within the definition according to the procedure with pass-by-value argument; and

converting the procedure that calls a procedure with pass-by-value argument into the procedure that calls a procedure with pass-by-reference, in the case where the pass-by-value argument update information indicates that there is no procedure that may indirectly call a procedure with pass-by-value argument, and the pass-by-value argument is not updated within the definition according to the procedure with pass-by-value argument.

8. The compilation method according to claim 7 ,

wherein in the converting, when it is not specified to forcedly convert, for the procedure with pass-by-value argument, an argument passing with the use of pass-by-value into an argument passing with the use of pass-by-reference, an argument passing with the use of pass-by-value is converted into an argument passing with the use of pass-by-reference, in the case where the pass-by-value argument update information indicates that there is no procedure that may indirectly call a procedure with pass-by-value argument, and the pass-by-value argument is not updated within the definition according to the procedure with pass-by-value argument.

9. The compilation method according to claim 7 ,

wherein in the converting, when it is specified to forcedly convert, for the procedure with pass-by-value argument, an argument passing with the use of pass-by-value into an argument passing with the use of pass-by-reference argument, an argument passing with the use of pass-by-value is converted into an argument passing with the use of pass-by-reference, as specified for the procedure with pass-by-value argument, and in the case where the pass-by-value argument is updated within the procedure definition, an argument value is referred to from the converted pass-by-reference argument so as to generate a copy of the argument value, in the intermediate codes, at a location before a part where a value is actually updated, and the location where the copy is generated is set as a reference.

10. A computer compiler for compiling, the computer compiler having instructions stored on a computer storage medium for causing a computer to execute a method comprising:

generating intermediate codes from a source program written in a high-level language;

optimizing the intermediate codes by converting a pass-by-value argument into a pass-by-reference argument, in the case where both of the following conditions are satisfied: there is no procedure that may indirectly call a procedure with pass-by-value argument, and the pass-by-value argument is not updated within a definition according to the procedure with pass-by-value argument; and

converting the optimized intermediate codes into object codes,

wherein the optimizing further includes:

extracting pass-by-value argument update information based on the intermediate codes, the information including at least the following: a procedure with pass-by-value argument; a procedure that directly calls the procedure with pass-by-value argument; a procedure that may indirectly call the procedure with pass-by-value argument; a pass-by-value argument of the procedure with pass-by-value argument; and update judgment information indicating whether or not the pass-by-value argument is updated within the definition according to the procedure with pass-by-value argument; and

converting the procedure that calls a procedure with pass-by-value argument into the procedure that calls a procedure with pass-by-reference, in the case where the pass-by-value argument update information indicates that there is no procedure that may indirectly call a procedure with pass-by-value argument, and the pass-by-value argument is not updated within the definition according to the procedure with pass-by-value argument.

11. A computer-readable storage medium in which a compiler is stored for causing a computer to execute a method comprising:

generating intermediate codes from a source program written in a high-level language;

optimizing the intermediate codes by converting a pass-by-value argument into a pass-by-reference argument, in the case where both of the following conditions are satisfied: there is no procedure that may indirectly call a procedure with pass-by-value argument, and the pass-by-value argument is not updated within a definition according to the procedure with pass-by-value argument; and

converting the optimized intermediate codes into object codes,

wherein the optimizing further includes:

extracting pass-by-value argument update information based on the intermediate codes, the information including at least the following: a procedure with pass-by-value argument; a procedure that directly calls the procedure with pass-by-value argument; a procedure that may indirectly call the procedure with pass-by-value argument; a pass-by-value argument of the procedure with pass-by-value argument; and update judgment information indicating whether or not the pass-by-value argument is updated within the definition according to the procedure with pass-by-value argument; and

converting the procedure that calls a procedure with pass-by-value argument into the procedure that calls a procedure with pass-by-reference, in the case where the pass-by-value argument update information indicates that there is no procedure that may indirectly call a procedure with pass-by-value argument, and the pass-by-value argument is not undated within the definition according to the procedure with pass-by-value argument.

12. A compiler apparatus for compiling, the compiler apparatus having instructions stored on a storage medium for causing the compiler apparatus to convert a source program written in a high-level language into object codes, the compiler apparatus comprising:

an intermediate code generation unit operable to generate intermediate codes from the source program;

an optimization unit operable to optimize the intermediate codes by converting a pass-by-value argument into a pass-by-reference argument, in the case where both of the following conditions are satisfied: there is no procedure that may indirectly call a procedure with pass-by-value argument, and the pass-by-value argument is not updated within a definition according to the procedure with pass-by-value argument; and

an object code conversion unit operable to convert the optimized intermediate codes into object codes,

wherein the optimization unit includes:

a pass-by-value argument update information extraction unit operable to extract pass-by-value argument update information based on the intermediate codes, the information at least including a procedure with pass-by-value argument; a procedure that directly calls the procedure with pass-by-value argument; a pass-by-value argument of the procedure with pass-by-value argument; and update judgment information indicating whether or not the pass-by-value argument is updated within the definition according to the procedure with pass-by-value argument; and

a conversion unit operable to convert a procedure that calls a procedure with pass-by-value argument into a procedure that calls a procedure with pass-by-reference, in the case where the pass-by-value argument update information indicates that there is no procedure that may indirectly call a procedure with pass-by-value argument, and the pass-by-value argument is not updated within the definition according to the procedure with pass-by-value argument.

13. The compiler apparatus according to claim 12 ,

wherein the optimization unit optimizes the intermediate codes by converting an argument passing with the use of pass-by-value argument into an argument passing with the use of pass-by-reference argument, in the case where both of the following conditions are satisfied: there is no procedure that may indirectly call a procedure with pass-by-value argument, and the pass-by-value argument is not updated within the definition according to the procedure with pass-by-value argument.

14. The compiler apparatus according to claim 13 , further comprising:

an optimization unit operable to optimize the intermediate codes by converting, for the procedure with pass-by-value argument, an argument passing with the use of pass-by-value into an argument passing with the use of pass-by-reference argument.

15. The compiler apparatus according to claim 12 ,

wherein when it is not specified to forcedly convert a procedure that directly calls a procedure with pass-by-value argument into a procedure that directly calls a procedure with pass-by-reference argument, the conversion unit converts, the procedure that directly calls a procedure with pass-by-value into a procedure that directly calls a procedure with pass-by-reference argument, in the case where the pass-by-value argument update information indicates that there is no procedure that may indirectly call a procedure with pass-by-value argument, and the pass-by-value argument is not updated within the definition according to the procedure with pass-by-value argument.

16. The compiler apparatus according to claim 12 ,

wherein in the case where it is specified to forcedly convert a procedure that calls a procedure with pass-by-value into a procedure that calls a procedure with pass-by-reference argument, the conversion unit performs, based on the pass-by-value argument update information, the following conversions as specified for the procedure with pass-by-value: the procedure that directly calls a procedure with pass-by-value argument is converted into the procedure that directly calls a procedure with pass-by-reference argument; and the procedure that may indirectly call a procedure with pass-by-value argument is converted into the procedure that may indirectly call a procedure with pass-by-value reference.

17. The compiler apparatus according to claim 12 ,

wherein the optimization unit optimizes the intermediate codes by converting an argument passing with the use of pass-by-value argument into an argument passing with the use of pass-by-reference argument, in the case where both of the following conditions are satisfied: the procedure that may indirectly call a procedure with pass-by-value argument, and the pass-by-value argument is not updated within the definition according to the procedure with pass-by-value argument.

18. The compiler apparatus according to claim 17 ,

wherein when it is not specified to forcedly convert an argument passing with the use of pass-by-value into an argument passing that uses pass-by-reference, for the procedure with pass-by-value argument, the conversion unit converts an argument passing with the use of pass-by-value into an argument passing with the use of pass-by-reference, in the case where the pass-by-value argument update information indicates that there is no procedure tat may indirectly call a procedure with pass-by-value argument, and the pass-by-value argument is not updated within the definition according to the procedure with pass-by-value argument.

19. The compiler apparatus according to claim 17 ,

wherein when it is specified to forcedly convert, for the procedure with pass-by-value argument, an argument passing with the use of pass-by-value into an argument passing with the use of pass-by-reference, the conversion unit converts as specified for the procedure with pass-by-value, an argument passing with the use of pass-by-value into an argument passing with the use of pass-by-reference, based on the pass-by-value argument update information, and in the case where the pass-by-value argument is updated within the definition according to the procedure wit pass-by-value argument, an argument value is referred to from the converted pass-by-reference argument so as to generate a copy of the argument value, in the intermediate codes, at a location before a part where a value is actually updated, and the location where the copy is generated is set as a reference.

Assignments (3)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Mar 25, 2015
From: PANASONIC CORPORATION
To: SOCIONEXT INC.
Reel/Frame 035294/0942 →
CHANGE OF NAME Recorded Nov 24, 2008
From: MATSUSHITA ELECTRIC INDUSTRIAL CO., LTD.
To: PANASONIC CORPORATION
Reel/Frame 021897/0653 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Dec 21, 2004
From: ASAO, SHINOBU
To: MATSUSHITA ELECTRIC INDUSTRIAL CO., LTD.
Reel/Frame 016114/0985 →