IP Library › Granted Patent US 6,934,940
Granted Patent B2
US 6,934,940 · App. 10/060,178 · Granted Aug 23, 2005

Source code transformation-temporary object reduction

Assignee: International Business Machines Corporation
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 6,934,940
App. No.
10/060,178
Granted
Aug 23, 2005
Kind
B2
Abstract

Embodiments of the invention generally provide a method, article of manufacture, and apparatus for code transformation. In one embodiment, the invention provides a method of transforming source code. The method determines if a source code statement includes a first operation that receives input from a result of a second operation, where the second operation acts on a plurality of arguments. If the source code includes the first operation, then the method transforms the source code into a plurality of statements that include the first operation acting on one of the arguments.

Claims (28)

1. A method of transforming source code, comprising:

determining if a source code statement includes a first operation, comprising a method call, that receives input from a result of a second operation wherein the second operation arts on a plurality of arguments, and wherein the second operation includes at least one concatenation operator;

if the source code statement includes the first operation, then transforming the source code statement into a plurality of source code statements, wherein the transforming comprises:

generating an expression tree representing the second operation acting on the plurality of arguments: and

transforming the first operation and arguments of the second operation into the plurality of source code statements, wherein each of the plurality of source code statements contains the first operation acting on a different one of the plurality of arguments.

2. The method of claim 1 , further comprising, generating, for a concatenation operation, at least one new method call using an object and a method of the new method call.

3. The method of claim 1 , further comprising, generating at least one new method call using the concatenation operator as the argument.

4. The method of claim 2 , wherein the new method call includes an append method.

5. The method of claim 2 , wherein the new method call includes an object of type string.

6. A method of transforming source code, comprising:

parsing a source code statement, wherein the source code statement comprises a method call;

determining if the source code statement includes a first operation that receives as input a result of a second operation, wherein the second operation acts on a plurality of arguments and includes at least one concatenation operator;

and if so, determining an order of the arguments;

generating an expression tree based on the order, that represents the second operation acting on the plurality of arguments; and

transforming the source code statements into a plurality of source code statements, wherein each of the plurality of source code statements contains the first operation acting on one of the plurality of arguments.

7. The method of claim 6 , further comprising compiling the plurality of statements.

8. The method of claim 6 , further comprising, generating at least one new method call using at least one object and the method call of the source code statement.

9. The method of claim 8 , wherein, if the source code statement includes the method call then generating at least one source code statement, included in the plurality of source code statements, that passes one concatenation operator into the argument of the method call.

10. A computer readable medium storing software program that, when executed by a processor of a computer, causes the computer to perform an operation comprising;

determining if a source code statement includes a first operation comprising a method call, that receives as input a result of a second operation wherein the second operation acts on a plurality of arguments, and wherein the second operation includes at least one concatenation operator; and

if the source code statement includes the first operation, then transforming the source code statement into a plurality of source code statements, wherein the transforming comprises:

generating an expression tree representing the second operation acting on the plurality of arguments; and

transforming the first operation and arguments of the second operation into the plurality of source code statements, wherein each source code statement contains the first operation acting on one of the arguments.

11. The computer readable medium of claim 10 , further comprising, generating at least one new method call using an object and the method of the first method call.

12. The computer readable medium of claim 10 , further comprising, generating at least one new method call using the concatenation operator as the argument.

13. The method of claim 1 , wherein transforming the first operation and arguments of the second operation into the plurality of source code statements comprises, traversing the expression tree, and for each node of the expression tree that stores at least one of the plurality of arguments, generating a source code statement that includes the method call of the first operation, wherein each argument associated with the node is passed to the method call.

14. The method of claim 6 , wherein transforming the source code statements into a plurality of source code statements comprises, traversing the expression tree, and for each node of the expression tree that stores at least one of the plurality of arguments, generating a source code statement that includes the method call of the first operation, wherein each argument associated with the node is passed to the method call.

15. The computer-readable medium of claim 10 , wherein transforming the first operation and arguments of the second operation into the plurality of source code statements comprises, traversing the expression tree, and for each node of the expression tree that stores at least one of the plurality of arguments, generating a source code statement that includes the method call of the first operation, wherein each argument associated with the node is passed to the method call.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jan 30, 2002
From: BATES, CARY LEE; SANTOSUOSSO, JOHN MATTHEW
To: INTERNATIONAL BUSINESS MACHINES CORPORATION
Reel/Frame 012567/0974 →
Continuity (1)
Related Publication 20030145312A1 · Jul 31, 2003