摘要
Effect handlers and multishot continuations are powerful abstractions for managing control flow; together, they offer concise and modular ways to express and handle nondeterminism, randomness, and more. However, implementing multishot continuations in the presence of stack-allocated lexical resources-lexical effect handlers in particular-is challenging, since stack copying invalidates references to these resources.
We present a novel implementation strategy for lexical effect handlers that fully supports multishot continuations. The key idea is to virtualize the stack space used by continuations. Each stack-allocated handler instance is assigned a virtual address, and all effect invocations through these virtual addresses are mediated by an address translation mechanism. A software-based memory management unit in the runtime system performs these translations efficiently, exploiting the lexical scoping discipline of effect handlers.
We capture the essence of our approach via a new operational semantics for lexical effect handlers and prove it correct with respect to the standard semantics. We also implement it in a compiler and runtime system. Compared to prior languages with lexical effect handlers, our implementation increases expressivity by fully supporting multishot continuations-and, as a happy consequence, unlocks significant performance gains by enabling parallel execution of multishot continuations.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
脉络
- Retrofitting effect handlers onto OCaml 引用了 From folklore to fact: comparing implementations of stacks and continuations
- Retrofitting effect handlers onto OCaml 引用了 Binders by day, labels by night: effect instances via lexically scoped handlers
- Effects, capabilities, and boxes: from scope-based reasoning to type-based reasoning and back 引用了 Handling bidirectional control flow
- Effects, capabilities, and boxes: from scope-based reasoning to type-based reasoning and back 引用了 Binders by day, labels by night: effect instances via lexically scoped handlers
- Handling bidirectional control flow 引用了 Binders by day, labels by night: effect instances via lexically scoped handlers
它引用的 Paper10
- Retrofitting effect handlers onto OCamlK. C. Sivaramakrishnan, Stephen Dolan, Leo White, Tom Kelly 等PLDI 2021 · 56 次引用
- Binders by day, labels by night: effect instances via lexically scoped handlersDariusz Biernacki, Maciej Piróg, Piotr Polesiuk, Filip SieczkowskiPOPL 2020 · 46 次引用
- Effects, capabilities, and boxes: from scope-based reasoning to type-based reasoning and backJonathan Immanuel Brachthäuser, Philipp Schuster, Edward Lee, Aleksander Boruch-GruszeckiOOPSLA 2022 · 24 次引用
- From folklore to fact: comparing implementations of stacks and continuationsKavon Farvardin, John H. ReppyPLDI 2020 · 17 次引用
- Handling bidirectional control flowYizhou Zhang, Guido Salvaneschi, Andrew C. MyersOOPSLA 2020 · 12 次引用
相关 Paper
- A typed continuation-passing translation for lexical effect handlersPhilipp Schuster, Jonathan Immanuel Brachthäuser, Marius Müller, Klaus OstermannPLDI 2022 · 10 次引用
- Zero-Overhead Lexical Effect HandlersCong Ma, Zhaoyi Ge, Max Jung, Yizhou ZhangOOPSLA 2025 · 2 次引用
- Dynamic Wind for Effect HandlersDavid Voigt, Philipp Schuster, Jonathan Immanuel BrachthäuserOOPSLA 2025
- Lexical Effect Handlers, DirectlyCong Ma, Zhaoyi Ge, Edward Lee, Yizhou ZhangOOPSLA 2024 · 7 次引用
- Affect: An Affine Type and Effect SystemOrpheas van Rooij, Robbert KrebbersPOPL 2025 · 7 次引用
