IP Library › Granted Patent US 7,185,326
Granted Patent B2
US 7,185,326 · App. 10/632,189 · Granted Feb 27, 2007

Automatically reordering variables as a part of compiling and linking source code

Assignee: Hewlett-Packard Development Company, L.P.
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,185,326
App. No.
10/632,189
Granted
Feb 27, 2007
Kind
B2
Abstract

Methods and Systems for automatically reordering variables as a part of compiling and linking source code. In one embodiment, a compiler identifies a set of variables that are candidates for reordering. The candidate variables are associated with one or more source code files that are being compiled. The compiler collects data used for determining a potential layout of the candidate variables. The linker determines the potential layout based, at least in part, on the data and reorders the candidate variables based, at least in part, on the potential layout.

Claims (63)

1. A method for automatically reordering variables, the method comprising:

as a part of compilation,

identifying a set of variables that are candidates for reordering, wherein the candidate variables are associated with one or more source code files that are being compiled;

collecting data for determining a potential layout for the candidate variables;

as a part of linking,

determining the potential layout based, at least in part, on the data, wherein the data is used to partition the candidate variables into categories and enables reordering the candidate variables within their respective categories; and

reordering the variables based, at least in part, on the potential layout.

2. The method of claim 1 , wherein determining the potential layout further comprises:

selecting the next variable to associate with a virtual cache line based on more than one variable already associated with the virtual cache line; and

indicating that the selected variable is the next variable associated with the potential layout.

3. The method of claim 1 , wherein:

the method further comprises, partitioning the candidate variables into the categories, based at least in part on the data, wherein the categories include at least one of a small read-only category, a large read-only category, a small writeable category, a large initialized writeable category, and a large uninitialized writeable category; and

the step of determining further comprises, determining the potential layout, at least in part, based on the categories of the candidate variables.

4. The method of claim 1 , wherein the data includes at least one of variable access counts, variable affinities, variable alignment constraints, variable classifications, and the candidate variables.

5. The method of claim 4 , wherein the variable classifications includes at least one of variable size, initialization class, and storage class.

6. The method of claim 1 , wherein the data is stored in one or more object files associated with the one or more source code files, and wherein the method further comprises:

transmitting the data to a linker by transmitting the object files to the linker.

7. The method of claim 1 , wherein:

the method further comprises, summarizing, during linkage, the data associated with the one or more source code files; and

the step of determining further comprises, determining the potential layout, at least in part, based on the summarized data.

8. A computer system comprising:

a memory unit; and

a processor for executing:

a compiler that has a variable identifier configured for identifying variables that are candidates for reordering and a data collector configured for collecting data for determining a potential layout for the candidate variables;

a reordering categorized candidate variable linker that has a potential layout determiner and a reordering categorized candidate variable component, wherein said variable reordering component is configured to automatically reorder a set of candidate variables based, at least in part, on the data for determining a potential layout of the candidate variables, wherein the data is used to partition the candidate variables into categories and enables reordering the candidate variables within their respective categories.

9. The computer system of claim 8 , the computer system further comprising:

the processor coupled to the memory unit, the processor for executing a method for automatically reordering variables, the method comprising:

identifying, at the variable identifier, the set of candidate variables for reordering, wherein the candidate variables are associated with one or more source code files that are being compiled;

collecting, at the data collector, data for determining a potential layout for the candidate variables; and

determining, at the potential layout determiner, the potential layout based, at least in part, on the data.

10. The computer system of claim 9 , wherein determining the potential layout further comprises:

selecting the next variable to associate with a virtual cache line based on more than one variable already associated with the virtual cache line; and

indicating that the selected variable is the next variable associated with the potential layout.

11. The computer system of claim 9 , wherein:

the method further comprises, partitioning the candidate variables into the categories, based at least in part on the data, wherein the categories include at least one of a small read-only category, a large read-only category, a small writeable category, a large initialized writeable category, and a large uninitialized writeable category; and

the step of determining further comprises, determining the potential layout, at least in part, based on the categories of the candidate variables.

12. The computer system of claim 9 , wherein the data includes at least one of variable access counts, variable affinities, variable alignment constraints, variable classifications, and the candidate variables.

13. The computer system of claim 12 , wherein the variable classifications includes at least one of variable size, initialization class, and storage class.

14. The computer system of claim 9 , wherein the data is stored in one or more object files associated with the one or more source code files, and wherein the method further comprises:

transmitting the data to the linker by transmitting the object files to the linker.

15. The computer system of claim 9 , wherein:

the method further comprises, summarizing, during linkage, the data associated with the one or more source code files; and

the step of determining further comprises, determining the potential layout, at least in part, based on the summarized data.

16. A computer-usable medium having computer-readable program code embodied therein for causing a computer system to perform a method of automatically reordering variables, the method comprising:

as a part of compilation,

identifying a set of variables that are candidates for reordering, wherein the candidate variables are associated with one or more source code files that are being compiled;

collecting data for determining a potential layout for the candidate variables;

as a part of linking,

determining the potential layout based, at least in part, on the data, wherein the data is used to partition the candidate variables into categories and enables reordering the candidate variables within their respective categories; and

reordering the candidate variables based, at least in part, on the potential layout.

17. The computer-usable medium of claim 16 , wherein the computer-readable program code embodied therein causes a computer system to perform the method, and wherein determining the potential layout further comprises:

selecting the next variable to associate with a virtual cache line based on more than one variable already associated with the virtual cache line; and

indicating that the selected variable is the next variable associated with the potential layout.

18. The computer-usable medium of claim 16 , wherein:

the method further comprises, partitioning the candidate variables into the categories, based at least in part on the data, wherein the categories include at least one of a small read-only category, a large read-only category, a small writeable category, a large initialized writeable category, and a large uninitialized writeable category; and

the step of determining further comprises, determining the potential layout, at least in part, based on the categories of the candidate variables.

19. The computer-usable medium of claim 16 , wherein the data includes at least one of variable access counts, variable affinities, variable alignment constraints, variable classifications, and the candidate variables.

20. The computer-usable medium of claim 19 , wherein the variable classifications includes at least one of variable size, initialization class, and storage class.

21. The computer-usable medium of claim 16 , wherein the data is stored in one or more object files associated with the one or more source code files, wherein the computer-readable program code embodied therein causes a computer system to perform the method, and wherein the method further comprises:

transmitting the data to a linker by transmitting the object files to the linker.

22. The computer-usable medium of claim 16 , wherein the computer-readable program code embodied therein causes a computer system to perform the method, and wherein:

the method further comprises, summarizing, during linkage, the data associated with the one or more source code files; and

the step of determining further comprises, determining the potential layout, at least in part, based on the summarized data.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Sep 12, 2003
From: MCINTOSH, NATHANIEL; MIKULIM, DMITRY
To: HEWLETT-PACKARD DEVELOPMENT COMPANY, LP.
Reel/Frame 014483/0455 →
Continuity (1)
Related Publication 20050027953A1 · Feb 3, 2005