paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Multiple Resumptions and Local Mutable State, Directly

直接实现多次恢复与局部可变状态
ICFP 9(ICFP)2025匹配度 2/10 · 该论文研究函数式语言中效应处理器的编译策略与运行时,重点是多次恢复与栈分配可变状态,虽提及概率编程作为用例,但与用户关注的静态分析、LLM/Agent、浮点程序分析、贝叶斯程序分析及其交叉方向均无直接关联,仅广义上属于程序设计语言领域。引用 2 inbox
Serkan Muhcu, Philipp Schuster, Michel Steuwer, Jonathan Immanuel Brachthäuser
crossref: 2026-09-10

AI 速览

一句话:为词法效应处理器提出编译策略与运行时,支持多次恢复与栈分配可变状态,同时保持常数时间捕获/恢复与竞争力性能。

多次恢复(multiple resumptions)对回溯搜索与概率编程等用例至关重要,但被认为无法与栈切换等高效实现兼容。本文提出面向词法效应处理器的编译策略与运行时系统,同时支持多次恢复与栈分配可变状态。其核心是采用无垃圾引用计数,并将栈与稳定 prompt 关联,从而在恰好恢复一次时实现常数时间的续延捕获与恢复,以及常数时间的可变状态访问;需要多次恢复时则复制栈。作者在 Effekt 语言上实现 LLVM 后端,并与动态及词法效应处理器等先进系统进行性能对比。结果表明,该方法性能有竞争力,表达力提升仅带来有限开销。

问题
多次恢复虽支持回溯搜索和概率编程,但被认为与栈切换等高效实现技术不兼容,需在表达力与性能之间取得平衡。
方法
为词法效应处理器设计编译策略与运行时:以无垃圾引用计数和稳定 prompt 关联栈,实现常数时间续延捕获/恢复与状态访问,必要时复制栈以支持多次恢复;在 Effekt 上实现 LLVM 后端。
评估
在 Effekt 的 LLVM 后端上实现,并与最先进的动态及词法效应处理器系统进行性能对比,显示竞争力且额外开销有限。
原文摘要(Abstract)

While enabling use cases such as backtracking search and probabilistic programming, multiple resumptions have the reputation of being incompatible with efficient implementation techniques, such as stack switching. This paper sets out to resolve this conflict and thus bridge the gap between expressiveness and performance. To this end, we present a compilation strategy and runtime system for lexical effect handlers with support for multiple resumptions and stack-allocated mutable state. By building on garbage-free reference counting and associating stacks with stable prompts, our approach enables constant-time continuation capture and resumption when resumed exactly once, as well as constant-time state access. Nevertheless, we also support multiple resumptions by copying stacks when necessary. We practically evaluate our approach by implementing an LLVM backend for the Effekt language. A performance comparison with state-of-the-art systems, including dynamic and lexical effect handler implementations, suggests that our approach achieves competitive performance and the increased expressiveness only comes with limited overhead.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@article{paperbot3057,
  title = {Multiple Resumptions and Local Mutable State, Directly},
  author = {Serkan Muhcu and Philipp Schuster and Michel Steuwer and Jonathan Immanuel Brachthäuser},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {9},
  number = {ICFP},
  year = {2025},
  doi = {10.1145/3747529}
}