IP Library › Granted Patent US 9,557,917
Granted Patent B2
US 9,557,917 · App. 14/536,921 · Granted Jan 31, 2017

Conditional stack frame allocation

Inventors: Michael Karl Gschwind (Chappaqua, NY); Ronald I. McIntosh (Toronto, CA); Ulrich Weigand (Holzgerlingen, DE)
Assignee: International Business Machines Corporation
G06F3/0604G06F3/0631G06F3/0673G06F8/41G06F8/4434G06F9/5016
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,557,917
App. No.
14/536,921
Granted
Jan 31, 2017
Kind
B2
Abstract

A method for allocating memory includes an operation that determines whether a prototype of a callee function is within a scope of a caller. The caller is a module containing a function call to the callee function. In addition, the method includes determining whether the function call includes one or more unnamed parameters when a prototype of the callee function is within the scope of the caller. Further, the method may include inserting instructions in the caller to allocate a register save area in a memory when it is determined that the function call includes one or more unnamed parameters.

Claims (35)

1. A system for allocating memory, comprising:

a processor; and

a memory to store a compiler and one or more modules, the compiler being comprised of instructions that when executed by the processor, cause the processor to perform the following operations:

determining whether a prototype of a callee function is within a scope of a caller, the caller being a module containing a function call to the callee function;

when the prototype of the callee function is not within the scope of the module, inserting instructions in the caller to allocate a register save area in a memory;

when the prototype of the callee function is within the scope of the caller, determining whether the function call includes one or more unnamed parameters;

inserting instructions in the caller to allocate a register save area in a memory when it is determined that the function call includes one or more unnamed parameters;

determining whether all parameters of the function can be passed in registers; and

inserting instructions in the caller to allocate a parameter overflow area in the memory when all parameters of the function call cannot be passed in registers.

2. The system of claim 1 , wherein the inserting of instructions in the caller to allocate a register save area in a memory when it is determined that the function call includes one or more unnamed parameters further comprises:

determining whether all parameters of the function can be passed in registers; and

inserting instructions in the caller to allocate a parameter overflow area in the memory when all parameters of the function call cannot be passed in registers.

3. The system of claim 1 , further comprising:

determining whether all parameters of the function can be passed in registers when it is determined that the function call only includes named parameters; and

omitting instructions in the caller to allocate a register save area in a memory when all parameters of the function call can be passed in registers.

4. The system of claim 1 , further comprising:

determining whether all parameters of the function can be passed in registers when it is determined that the function call only includes named parameters; and

inserting instructions in the caller to allocate a register save area and a parameter overflow area in a memory when all parameters of the function call cannot be passed in registers.

5. The system of claim 2 , wherein the memory is a stack frame of the caller.

6. A computer program product for allocating memory, comprising a computer readable storage medium having program instructions embodied therewith, the program instructions readable by a processor circuit to cause the processor to:

determine whether a prototype of a callee function is within a scope of a caller, the caller being a module containing a function call to the callee function;

when the prototype of the callee function is not within the scope of the module, insert instructions in the caller to allocate a register save area in a memory;

when the prototype of the callee function is within the scope of the caller, determine whether the function call includes one or more unnamed parameters; and

in response to determining that the function call includes one or more unnamed parameters, insert instructions in the caller to allocate a register save area in a memory;

determine whether all parameters of the function can be passed in registers; and

insert instructions in the caller to allocate a parameter overflow area in the memory when all parameters of the function call cannot be passed in registers.

7. The computer program product of claim 6 , wherein the inserting of instructions in the caller to allocate a register save area in a memory when it is determined that the function call includes one or more unnamed parameters further comprises:

determining whether all parameters of the function can be passed in registers; and

inserting instructions in the caller to allocate a parameter overflow area in the memory when all parameters of the function call cannot be passed in registers.

8. The computer program product of claim 6 , further comprising:

determining whether all parameters of the function can be passed in registers when it is determined that the function call only includes named parameters; and

omitting instructions in the caller to allocate a register save area in a memory when all parameters of the function call can be passed in registers.

9. The computer program product of claim 6 , further comprising:

determining whether all parameters of the function can be passed in registers when it is determined that the function call only includes named parameters; and

inserting instructions in the caller to allocate a register save area and a parameter overflow area in a memory when all parameters of the function call cannot be passed in registers.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Nov 10, 2014
From: GSCHWIND, MICHAEL KARL; MCINTOSH, RONALD I.; WEIGAND, ULRICH
To: INTERNATIONAL BUSINESS MACHINES CORPORATION
Reel/Frame 034134/0610 →
Continuity (1)
Related Publication 20160132246A1 · May 12, 2016