Program optimizing apparatus, program optimizing method, and program optimizing article of manufacture
First Claim
1. A program optimizing apparatus including a non-transitory transactional memory enabling exclusive control to execute a transaction, comprising:
- a first code generating unit configured to interpret a program, and to generate a first code in which a begin instruction to begin the transaction and an end instruction to commit the transaction are inserted before and after an instruction sequence including a plurality of instructions to execute a designated processing in the program;
a second code generating unit configured to generate a second code at a predetermined timing by using the plurality of instructions according to the designated processing; and
a code write unit configured to overwrite the instruction sequence of the first code with the second code or to write the second code to a part of the first code in the transaction,wherein the designated processing is a function call processing, and the plurality of instructions include a set instruction to set an argument, a call instruction to call a function, and a return instruction to read a return value,wherein the predetermined timing is a timing of an interpretation of a called function during execution of the program,wherein in response to the interpretation of the called function, the second code generating unit generates the second code by replacing the call instruction in the instruction sequence with an instruction to read a value in the called function, by changing a parameter in the instruction to read the value, which is placed by the replacement, and then by deleting an unnecessary instruction group including the set instruction and the return instruction in the instruction sequence.
1 Assignment
0 Petitions
Accused Products
Abstract
An apparatus having a transactional memory enabling exclusive control to execute a transaction. The apparatus includes: a first code generating unit configured to interpret a program, and generate first code in which a begin instruction to begin a transaction and an end instruction to commit the transaction are inserted before and after an instruction sequence including multiple instructions to execute designated processing in the program; a second code generating unit configured to generate second code at a predetermined timing by using the multiple instructions according to the designated processing; and a code write unit configured to overwrite the instruction sequence of the first code with the second code or to write the second code to a part of the first code in the transaction.
-
Citations
12 Claims
-
1. A program optimizing apparatus including a non-transitory transactional memory enabling exclusive control to execute a transaction, comprising:
-
a first code generating unit configured to interpret a program, and to generate a first code in which a begin instruction to begin the transaction and an end instruction to commit the transaction are inserted before and after an instruction sequence including a plurality of instructions to execute a designated processing in the program; a second code generating unit configured to generate a second code at a predetermined timing by using the plurality of instructions according to the designated processing; and a code write unit configured to overwrite the instruction sequence of the first code with the second code or to write the second code to a part of the first code in the transaction, wherein the designated processing is a function call processing, and the plurality of instructions include a set instruction to set an argument, a call instruction to call a function, and a return instruction to read a return value, wherein the predetermined timing is a timing of an interpretation of a called function during execution of the program, wherein in response to the interpretation of the called function, the second code generating unit generates the second code by replacing the call instruction in the instruction sequence with an instruction to read a value in the called function, by changing a parameter in the instruction to read the value, which is placed by the replacement, and then by deleting an unnecessary instruction group including the set instruction and the return instruction in the instruction sequence. - View Dependent Claims (2)
-
-
3. A program optimization method executed by a program optimizing apparatus including a non-transitory transactional memory enabling exclusive control to execute a transaction, the method comprising the steps of:
-
interpreting a program and generating first code in which a begin instruction to begin the transaction and an end instruction to commit the transaction are inserted before and after an instruction sequence including a plurality of instructions to execute designated processing in the program; generating second code at a predetermined timing by using the plurality of instructions according to the designated processing; and overwriting the instruction sequence of the first code with the second code or writing the second code to a part of the first code in the transaction, wherein the designated processing is function call processing, and the plurality of instructions include a set instruction to set an argument, a call instruction to call a function, and a return instruction to read a return value, wherein the predetermined timing is a timing of interpreting a function called during execution of the program, wherein in the step of generating the second code, the second code is generated in response to interpreting the function called, the second code being optimized by replacing the call instruction in the instruction sequence with an instruction to read a value in the called function, by changing a parameter in the instruction to read the value, which is placed by the replacement, and then by deleting an unnecessary instruction group including the set instruction and the return instruction in the instruction sequence. - View Dependent Claims (4, 5, 6)
-
-
7. A program optimizing apparatus including a non-transitory transactional memory enabling exclusive control to execute a transaction, comprising:
-
a first code generating unit configured to interpret a program, and to generate a first code in which a begin instruction to begin the transaction and an end instruction to commit the transaction are inserted before and after an instruction sequence including a plurality of instructions to execute a designated processing in the program; a second code generating unit configured to generate a second code at a predetermined timing by using the plurality of instructions according to the designated processing; and a code write unit configured to overwrite the instruction sequence of the first code with the second code or to write the second code to a part of the first code in the transaction, wherein the designated processing is processing involving a branch, and the plurality of instructions include at least one branch instruction and a branch destination instruction to be executed at a branch destination, a frequency judgment unit configured to judge, when the program is interpreted, whether an execution frequency of the branch destination is lower than a threshold, by using execution frequencies obtained from a counted number of positive results and a counted number of negative results of the branch instruction, responding to, as the predetermined timing, a judgment made by the judgment unit that the execution frequency of the branch destination is lower than the threshold, wherein responding includes the second code generating unit generating a trace for forming the second code wherein the trace is a sequence of a control flow up to the branch instruction immediately before the branch destination where the execution frequency is judged to be lower than the threshold. - View Dependent Claims (8)
-
-
9. A program optimization method executed by a program optimizing apparatus including a non-transitory memory enabling exclusive control to execute a transaction, the method comprising the steps of:
-
interpreting a program and generating first code in which a begin instruction to begin the transaction and an end instruction to commit the transaction are inserted before and after an instruction sequence including a plurality of instructions to execute designated processing in the program; generating second code at a predetermined timing by using the plurality of instructions according to the designated processing, wherein the designated processing is processing involving a branch, and the plurality of instructions include at least one branch instruction and a branch destination instruction to be executed at a branch destination; overwriting the instruction sequence of the first code with the second code or writing the second code to a part of the first code in the transaction; judging, when the program is interpreted, whether an execution frequency of the branch destination is lower than a threshold, by using execution frequencies obtained from a counted number of positive results and a counted number of negative results of the branch instruction; and responding to a judgment made by the judgment unit that the execution frequency of the branch destination is lower than the threshold, by generating a trace for forming the second code wherein the trace is a sequence of a control flow up to the branch instruction immediately before the branch destination where the execution frequency is judged to be lower than the threshold. - View Dependent Claims (10, 11, 12)
-
Specification