IP Library › Granted Patent US 9,471,340
Granted Patent B2
US 9,471,340 · App. 14/483,538 · Granted Oct 18, 2016

Global entry point and local entry point for callee function

Inventors: Michael K. Gschwind (Chappaqua, NY); Ulrich Weigand (Holzgerlingen, DE)
Assignee: INTERNATIONAL BUSINESS MACHINES CORPORATION
G06F9/44521G06F8/41G06F9/4426
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,471,340
App. No.
14/483,538
Granted
Oct 18, 2016
Kind
B2
Abstract

Embodiments relate to a global entry point and a local entry point for a callee function. An aspect includes executing, by a processor, a function call from a calling function to the callee function. Another aspect includes, based on the function call being a direct and external function call, entering the callee function at the global entry point and executing prologue code in the callee function that calculates and stores a table of contents (TOC) value for the callee function in a TOC register. Another aspect includes, based on the function call being a direct and local function call, entering the callee function at the local entry point, wherein entering the callee function at the local entry point skips the prologue code. Another aspect includes, based on the function call being an indirect function call, entering the callee function at the global entry point and executing the prologue code.

Claims (22)

1. A computer implemented method for a global entry point and a local entry point for a callee function, the method comprising:

executing, by a processor, a function call from a calling function to the callee function, the executing comprising:

based on the function call being a direct and external function call, entering the callee function at the global entry point of the callee function and executing prologue code in the callee function that calculates and stores a table of contents (TOC) value for the callee function in a TOC register, wherein the TOC value for the callee function is calculated by the prologue code based on a function address register and an offset;

based on the function call being a direct and local function call, entering the callee function at the local entry point of the callee function, wherein entering the callee function at the local entry point skips the prologue code; and

based on the function call being an indirect function call, entering the callee function at the global entry point and executing the prologue code;

wherein the global entry point, prologue code, and local entry point are inserted into the callee function by a compiler, such that the compiler inserts the global entry point at the beginning of the calling function, inserts the prologue code directly after the global entry point, and inserts the local entry point directly after the prologue code and before body of the callee function.

2. The method of claim 1 , wherein whether the function call is a local function call is resolved by a compiler or a linker, and wherein, based on the function call being the direct and local function call, a direct branch to the local entry point in the callee function is inserted into the calling function by the compiler or the linker.

3. The method of claim 1 , wherein whether the function call is a local function call is resolved by a loader, and wherein, based on the function call being the direct and local function call, a branch to a procedure linkage table (PLT) stub is inserted into the calling function by the linker, and the PLT stub branches to the local entry point in the callee function.

4. The method of claim 1 , wherein whether the function call is an external function call is resolved by a loader, and wherein, based on the function call being the direct and external function call, a branch to a procedure linkage table (PLT) stub is inserted into the calling function by the linker, and the PLT stub branches to the global entry point in the callee function.

5. The method of claim 1 , wherein the calling function loads a function pointer address that points to the global entry point in the callee function based on the function call being the indirect function call.

6. The method of claim 1 , further comprising, based on the callee function comprising a function that does not use a TOC, entering the callee function at the local entry point.

7. A computer program product for implementing a global entry point and a local entry point for a callee function, the computer program product comprising:

a computer readable storage medium having program instructions embodied therewith, the program instructions readable by a processing circuit to cause the processing circuit to perform a method comprising:

executing, by a processor, a function call from a calling function to the callee function, the executing comprising:

based on the function call being a direct and external function call, entering the callee function at the global entry point of the callee function and executing prologue code in the callee function that calculates and stores a table of contents (TOC) value for the callee function in a TOC register, wherein the TOC value for the callee function is calculated by the prologue code based on a function address register and an offset;

based on the function call being a direct and local function call, entering the callee function at the local entry point of the callee function, wherein entering the callee function at the local entry point skips the prologue code; and

based on the function call being an indirect function call, entering the callee function at the global entry point and executing the prologue code;

wherein the global entry point, prologue code, and local entry point are inserted into the callee function by a compiler, such that the compiler inserts the global entry point at the beginning of the calling function, inserts the prologue code directly after the global entry point, and inserts the local entry point directly after the prologue code and before body of the callee function.

8. The computer program product of claim 7 , wherein whether the function call is a local function call is resolved by a compiler or a linker, and wherein, based on the function call being the direct and local function call, a direct branch to the local entry point in the callee function is inserted into the calling function by the compiler or the linker.

9. The computer program product of claim 7 , wherein whether the function call is a local function call is resolved by a loader, and wherein, based on the function call being the direct and local function call, a branch to a procedure linkage table (PLT) stub is inserted into the calling function by the linker, and the PLT stub branches to the local entry point in the callee function.

10. The computer program product of claim 7 , wherein whether the function call is an external function call is resolved by a loader, and wherein, based on the function call being the direct and external function call, a branch to a procedure linkage table (PLT) stub is inserted into the calling function by the linker, and the PLT stub branches to the global entry point in the callee function.

11. The computer program product of claim 7 , wherein the calling function loads a function pointer address that points to the global entry point in the callee function based on the function call being the indirect function call.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Sep 11, 2014
From: GSCHWIND, MICHAEL K.; WEIGAND, ULRICH
To: INTERNATIONAL BUSINESS MACHINES CORPORATION
Reel/Frame 033721/0754 →
Continuity (2)
Continuation 14263135 · Apr 28, 2014
Related Publication 20150309812A1 · Oct 29, 2015