IP Library › Granted Patent US 9,058,192
Granted Patent B2
US 9,058,192 · App. 13/632,902 · Granted Jun 16, 2015

Handling pointers in program code in a system that supports multiple address spaces

Inventor: Benedict R. Gaster (Santa Cruz, CA)
Assignee: ADVANCED MICRO DEVICES, INC.
G06F8/45G06F11/3636G06F8/24
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 9,058,192
App. No.
13/632,902
Granted
Jun 16, 2015
Kind
B2
Abstract

Some embodiments include a processing subsystem that compiles program code to generate compiled program code. In these embodiments, while compiling the program code, the processing subsystem first identifies a pointer in the program code that points to an unspecified address space. The processing subsystem then analyzes at least a portion of the program code to determine one or more address spaces to which the pointer may point. Next, the processor updates metadata for the pointer to indicate the one or more address spaces to which the pointer may point, the metadata enabling a determination of an address space to which the pointer points during subsequent execution of the compiled program code.

Claims (49)

1. A method for compiling program code, comprising:

in a processing subsystem, performing operations for compiling the program code to generate compiled program code, the operations comprising:

identifying a pointer in the program code that points to an unspecified address space;

analyzing at least a portion of the program code to determine one or more address spaces to which the pointer may point; and

updating metadata for the pointer to indicate the one or more address spaces to which the pointer may point, the metadata enabling a determination of an address space to which the pointer points during subsequent execution of the compiled program code.

2. The method of claim 1 , wherein the operations further comprise:

adding one or more first instructions to the compiled program code, the first instructions for determining an address space to which the pointer points during subsequent execution of the compiled program code based on the metadata and one or more runtime conditions.

3. The method of claim 2 , wherein the operations further comprise:

adding one or more second instructions to the compiled program code, the second instructions using the pointer to access the determined address space to which the pointer points.

4. The method of claim 3 , wherein the one or more second instructions comprise:

a memory access instruction configured to access each address space to which the pointer may point; and

one or more conditional instructions that control which of the memory access instructions is used to access the determined address space using the pointer.

5. The method of claim 1 , wherein identifying the pointer in the program code that points to the unspecified address space comprises:

finding the pointer in the program code;

attempting to resolve an address space to which the pointer points using information in the pointer; and

when an address space cannot be resolved for the pointer, identifying the pointer as a pointer that points to the unspecified address space.

6. The method of claim 1 , wherein identifying the pointer in the program code that points to the unspecified address space comprises at least one of:

identifying the pointer as pointing to a generic address space; or

identifying different instances of the pointer in the program code as pointing to two or more different address spaces.

7. The method of claim 1 , wherein analyzing at least the portion of the program code to determine one or more address spaces to which the pointer may point comprises at least one of:

analyzing the program code to determine one or more operations in which the pointer is used that indicate an address space to which the pointer may point; or

analyzing operations related to the operations in which the pointer is used that indicate an address space to which the pointer may point, the related operations not directly using the pointer.

8. The method of claim 1 , wherein updating metadata for the pointer to indicate the one or more address spaces to which the pointer may point comprises at least one of:

updating one or more values in the pointer to indicate the one or more address spaces; or

updating metadata associated with the pointer, but separate from the pointer, to indicate the one or more address spaces.

9. A non-transitory computer-readable storage medium containing instructions that, when executed by an electronic device with computing capabilities, cause the electronic device to perform a method for compiling program code to generate compiled program code, the method comprising:

identifying a pointer in the program code that points to an unspecified address space;

analyzing at least a portion of the program code to determine one or more address spaces to which the pointer may point; and

updating metadata for the pointer to indicate the one or more address spaces to which the pointer may point, the metadata enabling a determination of an address space to which the pointer points during subsequent execution of the compiled program code.

10. The computer-readable storage medium of claim 9 , wherein the method further comprises:

adding one or more first instructions to the compiled program code, the first instructions for determining an address space to which the pointer points during subsequent execution of the compiled program code based on the metadata and one or more runtime conditions.

11. The computer-readable storage medium of claim 10 , wherein the method further comprises:

adding one or more second instructions to the compiled program code, the second instructions using the pointer to access the determined address space to which the pointer points.

12. The computer-readable storage medium of claim 11 , wherein the one or more second instructions comprise:

a memory access instruction configured to access each address space to which the pointer may point; and

one or more conditional instructions that control which of the memory access instructions is used to access the determined address space using the pointer.

13. The computer-readable storage medium of claim 9 , wherein identifying the pointer in the program code that points to the unspecified address space comprises:

finding the pointer in the program code;

attempting to resolve an address space to which the pointer points using information in the pointer; and

when an address space cannot be resolved for the pointer, identifying the pointer as a pointer that points to the unspecified address space.

14. The computer-readable storage medium of claim 9 , wherein identifying the pointer in the program code that points to the unspecified address space comprises at least one of:

identifying the pointer as pointing to a generic address space; or

identifying different instances of the pointer in the program code as pointing to two or more different address spaces.

15. The computer-readable storage medium of claim 9 , wherein analyzing at least the portion of the program code to determine one or more address spaces to which the pointer may point comprises at least one of:

analyzing the program code to determine one or more operations in which the pointer is used that indicate an address space to which the pointer may point; or

analyzing operations related to the operations in which the pointer is used that indicate an address space to which the pointer may point, the related operations not directly using the pointer.

16. The computer-readable storage medium of claim 9 , wherein updating metadata for the pointer to indicate the one or more address spaces to which the pointer may point comprises at least one of:

updating one or more values in the pointer to indicate the one or more address spaces; or

updating metadata associated with the pointer, but separate from the pointer, to indicate the one or more address spaces.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Oct 24, 2012
From: GASTER, BENEDICT R.
To: ADVANCED MICRO DEVICES, INC.
Reel/Frame 029181/0944 →
Continuity (2)
Provisional Application 61681245 · Aug 9, 2012
Related Publication 20140047419A1 · Feb 13, 2014