An optimistic implementation of the stack-heap

A stack-heap has been shown to be an efficient storage management scheme for programs containing both recursive and retentive control structures. The stack-heap uses a compile-time marking algorithm that determines those program modules that may need retention at run-time. Thus, instances of marked modules are allocated space in the heap during execution. All others are stored in a stack. In this paper, we present an optimistic implementation of the stack-heap in which each module instance is kept in the stack until it suspends. Upon suspension, the instance is copied into the heap where it remains for the lifetime of the instance. Some of the restrictions imposed on the programming language by the original stack-heap scheme are eliminated under this optimistic implementation. It is shown that when the original stack-heap cannot be used and both recursive and coroutine programs are likely, the optimistic implementation of the stack-heap is more efficient on the average than the heap.