Representing Control in the Presence of One-Shot Continuations

Carl Bruggeman, Oscar Waddell, and R. Kent Dybvig

Indiana University, Computer Science Department

Abstract

Existing continuation mechanisms, such as call/cc, allow a captured continuation to be invoked multiple times. Some copying is necessary to enable a continuation to be invoked more than once. We note, however, that the vast majority of continuations are, in fact, invoked only once, and we introduce a new mechanism, one-shot continuations that eliminates all continuation-related overhead due to copying. We also explain how one-shot continuations interact with traditional multi-shot continuations and stack overflow. In addition, we present benchmark results comparing the performance of one-shot, multi-shot, and heap-based continuations for applications that range from continuation intensive programs to programs that have no explicit continuation operations.