Conditional stack frame allocation
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
exact text as granted — not AI-modifiedWhat is claimed is:
1 . A computer-implemented method for allocating memory, comprising:
determining that 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; determining, in response to determining that the prototype of the callee function is within the scope of the caller, that the function call includes one or more parameters that cannot be passed in registers; and inserting instructions in the caller to allocate a register save area in a memory for the one or more parameters that cannot be passed in registers.
2 . The method of claim 1 , wherein the method further comprises inserting instructions in the caller to allocate a parameter overflow area in the memory.
3 . The method of claim 2 , wherein the inserting instructions is performed in response to determining the function call includes the one or more parameters that cannot be passed in registers.
4 . The method of claim 1 , wherein the memory is a stack frame of the caller.
5 . The method of claim 1 , wherein the one or more parameters that cannot be passed in registers are unnamed parameters.
6 . The method of claim 5 , wherein determining that the function call includes one or more parameters that cannot be passed in registers includes determining that the function call includes the unnamed parameters.
7 . The method of claim 1 , wherein the method is performed by a compiler.
8 . 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 a method comprising: determining that a prototype of a callee function is within a scope of a caller, the caller containing a function call to the callee function; determining, in response to determining that the prototype of the callee function is within the scope of the caller, that the function call includes one or more parameters that cannot be passed in registers; and inserting instructions in the caller to allocate a register save area in the memory for the one or more parameters that cannot be passed in registers.
9 . The system of claim 8 , wherein the method further comprises inserting instructions in the caller to allocate a parameter overflow area in the memory.
10 . The system of claim 9 , wherein the inserting instructions is performed in response to determining the function call includes the one or more parameters that cannot be passed in registers.
11 . The system of claim 8 , wherein the memory is a stack frame of the caller.
12 . The system of claim 8 , wherein the one or more parameters that cannot be passed in registers are unnamed parameters.
13 . The system of claim 12 , wherein determining that the function call includes one or more parameters that cannot be passed in registers includes determining that the function call includes the unnamed parameters.
14 . 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 to cause the processor to:
determining that a prototype of a callee function is within a scope of a caller, the caller containing a function call to the callee function; determining, in response to determining that the prototype of the callee function is within the scope of the caller, that the function call includes one or more parameters that cannot be passed in registers; and inserting instructions in the caller to allocate a register save area in the memory for the one or more parameters that cannot be passed in registers.
15 . The computer program product of claim 14 , wherein the method further comprises inserting instructions in the caller to allocate a parameter overflow area in the memory.
16 . The computer program product of claim 15 , wherein the inserting instructions is performed in response to determining the function call includes the one or more parameters that cannot be passed in registers.
17 . The computer program product of claim 14 , wherein the memory is a stack frame of the caller.
18 . The computer program product of claim 14 , wherein the one or more parameters that cannot be passed in registers are unnamed parameters.
19 . The computer program product of claim 18 , wherein determining that the function call includes one or more parameters that cannot be passed in registers includes determining that the function call includes the unnamed parameters.Join the waitlist — get patent alerts
Track US2019138438A1 — get alerts on status changes and closely related new filings.
We store only your email — no account needed. See our privacy policy.