IP Library Granted Patent US 9,213,531
Granted Patent B2
US 9,213,531 · App. 14/267,705 · Granted Dec 15, 2015

Methods to eliminate extra memory loads while accessing global variables in position independent code

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,213,531
App. No.
14/267,705
Granted
Dec 15, 2015
Kind
B2
Abstract

Methods for reducing memory loads for accessing global variables (globals) when creating executables for position independent (PI) code are disclosed. A first method includes compiling PI code, identifying globals, and determining whether globals are defined in the executable. If a global is not defined in the executable, a definition is created in the executable. A second method includes receiving a list of defined globals from instrumented PI code binary and comparing the list with globals in the PI code. Memory loads are created for globals that are unlisted. A third method includes compiling PI code with special relocations for globals and determining whether globals are defined in the executable. If the global is defined in the executable, the special relocation is replaced with a direct load of the global. If not, the special relocation is replaced with a two-instruction sequence that loads the global's address and then the global's value.

Claims (19)

1. A computer-implemented method for reducing the number of memory loads required to access global variables when creating an executable binary for position independent code, the method comprising:

compiling the position independent code to create an executable binary without creating memory load instructions for obtaining global variable addresses;

identifying a global variable within the position independent code;

determining whether the global variable is defined in the executable binary; and

responsive to determining that the global variable is not defined in the executable binary:

creating a definition for the global variable in the executable binary reducing the need to load the global variable's address from memory; and

providing the created definition for the global variable to a shared object or library.

2. A computer-implemented method for reducing the number of memory loads required to access global variables when creating an executable binary for position independent code, the method comprising:

receiving a list of defined global variables from an instrumented binary of the position independent code, the list of defined global variables containing global variables that are defined in the instrumented binary; and

compiling the position independent code to create an executable binary by:

comparing the list of defined global variables with global variables in the position independent code, and

creating a memory load to load addresses of global variables from the global offset table for only the global variables that are not in the list of defined global variables.

3. A computer-implemented method for reducing the number of memory loads required to access global variable values when creating an executable binary for position independent code, the method comprising:

compiling the position independent code, which includes a static relocation as a memory instruction placeholder for a global variable, to create an executable binary;

determining whether the global variable is defined in the executable binary; and

responsive to determining that the global variable is defined in the executable binary, replacing the static relocation with a load instruction to directly load the global variable from the address of the global variable.

4. The computer-implemented method of claim 3 , wherein the load instruction is a JUMP instruction to jump to the memory load instruction that will load the global variable's content.

5. The computer-implemented method of claim 3 , further comprising:

responsive to determining that the global variable is not defined in the executable binary, replacing the static relocation with a two-instruction sequence that loads the address of the global variable from the global offset table and then accesses the global variable's value by loading from the global variable's address.

Assignments (2)
CHANGE OF NAME Recorded Oct 2, 2017
From: GOOGLE INC.
To: GOOGLE LLC
Reel/Frame 044566/0657 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jun 17, 2014
From: TALLAM, SRIRAMAN; LI, XINLIANG DAVID
To: GOOGLE INC.
Reel/Frame 033119/0394 →