IP Library › Granted Patent US 10,416,967
Granted Patent B2
US 10,416,967 · App. 15/783,095 · Granted Sep 17, 2019

Method of optimizing vargs in object-oriented programming languages

Inventor: Takeshi Ogasawara (Tokyo, JP)
Assignee: Internationa Business Machines Corporation
G06F8/315G06F8/4441
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 10,416,967
App. No.
15/783,095
Granted
Sep 17, 2019
Kind
B2
Abstract

A method, an apparatus, and a computer program product for optimizing variable size arguments in a programming language are provided. The method includes finding, in a target program, a call site having a variable-length argument. The method also includes generating a converted code for a callee of the call site, the generating including converting the variable-length argument to a plurality of arguments. The method further includes translating the call site to a call code for calling the converted code with the plurality of arguments instead of the variable-length argument.

Claims (59)

1. A computer-implemented method comprising:

finding, in a target program during execution, a call site having a variable-length argument,

generating, by a processor, a converted code for a callee of the call site, the generating including converting the variable-length argument to a plurality of arguments and unrolling a loop that includes an access to an element of the variable-length argument by using an index that is based on a loop induction variable, and

translating, by the processor, the call site to a call code for calling the converted code with the plurality of arguments instead of the variable-length argument.

2. The computer-implemented method of claim 1 , wherein the finding the call site finds the call site that is executed more frequently than a threshold amount.

3. The computer-implemented method of claim 1 , wherein the generating the converted code includes:

obtaining an array size of the variable-length argument, and

determining the number of arguments of the plurality of arguments based on the array size.

4. The computer-implemented method of claim 3 , wherein

the finding the call site finds a first call site for calling the callee and a second call site for calling the callee, the first call site and the second call site having the different array sizes of the variable-length argument,

the generating the converted code generates a first converted code for the callee having a first number of arguments and a second converted code for the callee having a second number of arguments, the first number of arguments is based on the array size of the variable-length argument of the first call site, the second number of arguments is based on the array size of the variable-length argument of the second call site, and

the translating the call site translates the first call site to a first call code for calling the first converted code with the first number of arguments and translates the second call site to a second call code for calling the second converted code with the second number of arguments.

5. The computer-implemented method of claim 3 , wherein

the finding the call site finds a first call site for calling the callee and a third call site for calling the callee, the first call site and the third call site having the different array sizes of the variable-length argument,

the generating the converted code generates a first converted code for the callee having a first number of arguments, the first number of arguments is based on the array size of the variable-length argument of the first call site, and

the translating the call site translates the first call site to a first call code for calling the first converted code with the first number of arguments, and maintains the third call site to call a non-converted code with the variable-length argument.

6. The computer-implemented method of claim 3 , wherein

the translating the call site translates the call site to the call code further for calling a non-converted code with the variable-length argument instead of calling the converted code in response to a runtime condition that the variable-length argument requires an array size larger than the size of the number of arguments of the plurality of arguments.

7. The computer-implemented method of claim 3 , wherein

the finding the call site finds a plurality of call sites for calling the callee,

the generating the converted code generates the converted code for the callee of the plurality of call sites, the generating including converting the variable-length argument to the plurality of argument having a fixed number of arguments, the fixed number is based on the maximum array size for the variable-length arguments of the plurality of call sites, and

the translating the call site translates each call sites of the plurality of call sites to the call code for calling the converted code.

8. The computer-implemented method of claim 1 , wherein each of the unrolled access utilize a constant index.

9. A computer program product including one or more computer readable storage mediums correctively storing program instructions that are executable by a processor or programmable circuitry to cause the processor or programmable circuitry to perform operations comprising:

finding, in a target program during execution, a call site having a variable-length argument,

generating, by a processor, a converted code for a callee of the call site, the generating including converting the variable-length argument to a plurality of arguments and unrolling a loop that includes an access to an element of the variable-length argument by using an index that is based on a loop induction variable, and

translating, by the processor, the call site to a call code for calling the converted code with the plurality of arguments instead of the variable-length argument.

10. The computer program product of claim 9 , wherein the finding the call site finds the call site that is executed more frequently than a threshold amount.

11. The computer program product of claim 9 , wherein the generating the converted code includes:

obtaining an array size of the variable-length argument, and

determining the number of arguments of the plurality of arguments based on the array size.

12. The computer program product of claim 11 , wherein

the finding the call site finds a first call site for calling the callee and a second call site for calling the callee, the first call site and the second call site having the different array sizes of the variable-length argument,

the generating the converted code generates a first converted code for the callee having a first number of arguments and a second converted code for the callee having a second number of arguments, the first number of arguments is based on the array size of the variable-length argument of the first call site, the second number of arguments is based on the array size of the variable-length argument of the second call site, and

the translating the call site translates the first call site to a first call code for calling the first converted code with the first number of arguments and translates the second call site to a second call code for calling the second converted code with the second number of arguments.

13. The computer program product of claim 11 , wherein

the finding the call site finds a first call site for calling the callee and a third call site for calling the callee, the first call site and the third call site having the different array sizes of the variable-length argument,

the generating the converted code generates a first converted code for the callee having a first number of arguments, the first number of arguments is based on the array size of the variable-length argument of the first call site, and

the translating the call site translates the first call site to a first call code for calling the first converted code with the first number of arguments, and maintains the third call site to call a non-converted code with the variable-length argument.

14. The computer program product of claim 9 , wherein each of the unrolled access utilize a constant index.

15. An apparatus comprising:

a processor or programmable circuitry, and

one or more computer readable mediums collectively including instructions that, when executed by the processor or the programmable circuitry, cause the processor or the programmable circuitry to:

find, in a target program during execution, a call site having a variable-length argument,

generate, by the processor, a converted code for a callee of the call site, the generating including converting the variable-length argument to a plurality of arguments and unrolling a loop that includes an access to an element of the variable-length argument by using an index that is based on a loop induction variable, and

translate, by the processor, the call site to a call code for calling the converted code with the plurality of arguments instead of the variable-length argument.

16. The apparatus of claim 15 , wherein the finding the call site finds the call site that is executed more frequently than a threshold amount.

17. The apparatus of claim 15 , wherein the generating the converted code includes:

obtaining an array size of the variable-length argument, and

determining the number of arguments of the plurality of arguments based on the array size.

18. The apparatus of claim 17 , wherein

the finding the call site finds a first call site for calling the callee and a second call site for calling the callee, the first call site and the second call site having the different array sizes of the variable-length argument,

the generating the converted code generates a first converted code for the callee having a first number of arguments and a second converted code for the callee having a second number of arguments, the first number of arguments is based on the array size of the variable-length argument of the first call site, the second number of arguments is based on the array size of the variable-length argument of the second call site, and

the translating the call site translates the first call site to a first call code for calling the first converted code with the first number of arguments and translates the second call site to a second call code for calling the second converted code with the second number of arguments.

19. The apparatus of claim 17 , wherein

the finding the call site finds a first call site for calling the callee and a third call site for calling the callee, the first call site and the third call site having the different array sizes of the variable-length argument,

the generating the converted code generates a first converted code for the callee having a first number of arguments, the first number of arguments is based on the array size of the variable-length argument of the first call site, and

the translating the call site translates the first call site to a first call code for calling the first converted code with the first number of arguments, and maintains the third call site to call a non-converted code with the variable-length argument.

20. The apparatus of claim 15 , wherein each of the unrolled access utilize a constant index.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Oct 13, 2017
From: OGASAWARA, TAKESHI
To: INTERNATIONAL BUSINESS MACHINES CORPORATION
Reel/Frame 043858/0175 →
Continuity (1)
Related Publication 20190114150A1 · Apr 18, 2019
Cited By (1)
US 12,505,056