Memory management for closures
Abstract
Methods, software media, compilers and programming techniques are described for creating copyable stack-based closures, such as a block, for languages which allocate automatic or local variables on a stack memory structure. In one exemplary method, a data structure of the block is first written to the stack memory structure, and this may be the automatic default operation, at run-time, for the block; then, a block copy instruction, added explicitly (in one embodiment) by a programmer during creation of the block, is executed to copy the block to a heap memory structure. The block includes a function pointer that references a function which uses data in the block.
Claims
exact text as granted — not AI-modifiedWhat is claimed is:
1 . A machine readable storage medium storing executable program instructions which when executed by a data processing system cause the data processing system to perform a method comprising:
retrieving first data indicating an association between a pointer to a function and a block layout description table; exposing data in the block in a debugging operation by using the block layout description table, wherein the block includes the pointer to the function which uses data in the block for computation by the function.
2 . The medium as in claim 1 , wherein a debugger performs the debugging operations and wherein a lookup function of the debugger finds the block layout description table in the block.
3 . The medium as in claim 2 , wherein the block is initially stored in a stack memory structure and is copied, by a block copy instruction explicitly added by a programmer, to a heap memory structure.
4 . The medium as in claim 3 , wherein the block includes data in the block's syntax and the function is configured to recognize and use data in the block.
5 . The medium as in claim 2 , wherein the block is initially stored in a stack memory and is copied to a heap memory structure.
6 . A data processing system, comprising:
a memory to store a block, the block comprising a block layout description table, a function pointer to reference a function, the function pointer including a pointer to the block layout description table; and a debugger coupled to the memory, to expose data in the block relevant to the function using the block layout description table.
7 . The data processing system of claim 6 , wherein a lookup function of the debugger finds the block layout description table in the block using the pointer.
8 . The data processing system of claim 6 , wherein the memory comprises:
a stack memory structure; and a heap memory structure, wherein the block is initially stored in the stack memory structure and is copied, by a block copy instruction explicitly added by a programmer, to the heap memory structure.
9 . The data processing system as in claim 8 , wherein the block includes data in the block's syntax and the function is configured to recognize and use data in the block.
10 . The data processing system as in claim 6 , wherein the block is initially stored in a stack memory and is copied to a heap memory structure.
11 . A computer-implemented method, comprising:
retrieving first data indicating an association between a pointer to a function and a block layout description table; exposing data in the block in a debugging operation by using the block layout description table, wherein the block includes the pointer to the function which uses data in the block for computation by the function.
12 . The method as in claim 11 , wherein a debugger performs the debugging operations and wherein a lookup function of the debugger finds the block layout description table in the block.
13 . The method as in claim 12 , wherein the block is initially stored in a stack memory structure and is copied, by a block copy instruction explicitly added by a programmer, to a heap memory structure.
14 . The method as in claim 13 , wherein the block includes data in the block's syntax and the function is configured to recognize and use data in the block.
15 . The method as in claim 11 , wherein the block is initially stored in a stack memory and is copied to a heap memory structure.Join the waitlist — get patent alerts
Track US2013111446A1 — get alerts on status changes and closely related new filings.
We store only your email — no account needed. See our privacy policy.