Code stack management
AssigneeInternational Business Machines Corporation
InventorMichael K. Gschwind
Life of this patent
Estimating the term…
Abstract
Embodiments relate to code stack management. An aspect includes a processor configured to execute a software application. Another aspect includes a code stack memory area and a data stack memory area, the code stack memory area being separate from the data stack memory area. Another aspect includes maintaining a data stack in the data stack memory area, the data stack comprising a plurality of stack frames comprising one or more data variables corresponding to the execution of the software application. Another aspect includes maintaining a code stack in the code stack memory area, the code stack comprising a plurality of code stack entries comprising executable computer code corresponding to the execution of the software application.
Claims19
A computer program product for implementing code stack management, the computer program product comprising:
- a non-transitory tangible storage medium readable by a processing circuit and storing instructions for execution by the processing circuit for performing a method comprising:
- executing a software application by a processor of a computer;
- maintaining a data stack in a data stack memory area of a memory of the computer, the data stack comprising a plurality of stack frames comprising one or more data variables corresponding to the execution of the software application;
- maintaining a code stack in a code stack memory area of the memory of the computer, the code stack comprising a plurality of code stack entries comprising executable computer code corresponding to the execution of the software application, the code stack memory area being separate from the data stack memory area;
- entering a function of the software application;
- storing a current value of a code stack pointer (CSP) of the code stack in a memory location for the function on the data stack based on entering the function;
- allocating one or more entries on the code stack corresponding to a trampoline used in conjunction with a pointer to one or more nested functions of the function, wherein a most recently allocated code stack entry is referenced by the CSP;
- and
- before exiting the function, restoring the CSP by loading the stored CSP value from the memory location.
A computer-implemented method for code stack management, the method comprising:
- executing a software application by a processor of a computer;
- maintaining a data stack in a data stack memory area of a memory of the computer, the data stack comprising a plurality of stack frames comprising one or more data variables corresponding to the execution of the software application;
- maintaining a code stack in a code stack memory area in the memory of the computer, the code stack comprising a plurality of code stack entries comprising executable computer code corresponding to the execution of the software application, the code stack memory area being separate from the data stack memory area;
- storing a value of a code stack pointer (CSP) of the code stack as a code stack barrier (CSB) of a current function;
- allocating a new code stack entry for a trampoline used in conjunction with a pointer to a nested function;
- and
- setting the CSP of the code stack to reference the new code stack entry;
- and
- setting the CSP equal to the CSB to deallocate the new code stack entry from the code stack before exiting the current function.
A system, comprising:
- a processor in communication with one or more types of memory, the processor configured to:
- execute a software application by a processor of a computer;
- maintain a data stack in a data stack memory area of a memory of the computer, the data stack comprising a plurality of stack frames comprising one or more data variables corresponding to the execution of the software application;
- maintain a code stack in a code stack memory area of the memory of the computer, the code stack comprising a plurality of code stack entries comprising executable computer code corresponding to the execution of the software application, the code stack memory area being separate from the data stack memory area;
- store a value of a code stack pointer (CSP) of the code stack as a code stack barrier (CSB) of a current function;
- allocate a new code stack entry for a trampoline used in conjunction with a pointer to a nested function;
- and
- set the CSP of the code stack to reference the new code stack entry;
- and
- set the CSP equal to the CSB to deallocate the new code stack entry from the code stack before exiting the current function.
Dependencies are inferred from the claim text.