paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Compiling effect handlers in capability-passing style

以能力传递风格编译效应处理器
ICFP 4(ICFP)2020匹配度 1/10 · 该论文属于编程语言与编译器领域,研究效应处理器的能力传递风格编译与精化类型系统,与用户关注的 PL 与 AI/LLM/Agent 交叉、静态分析、浮点程序分析或贝叶斯程序分析均无直接关联。引用 29 inbox
Philipp Schuster, Jonathan Immanuel Brachthäuser, Klaus Ostermann
dblp: 2026-09-10crossref: 2026-09-10

AI 速览

一句话:提出能力传递风格与迭代 CPS 编译效应处理器,并用精化类型系统完全消除其抽象开销。

效应处理器能让程序员抽象重复的复杂控制流,但目前性能代价显著。本文提出能力传递风格(capability-passing style)的效应处理器语言 λCap,并将其编译为迭代 CPS(iterated continuation-passing style)的简单类型 lambda 演算;该技术通用,可生成到任何支持一等函数的语言。为完全消除效应处理器抽象,作者将 λCap 精化为类型系统更受限的 λλCap,给出类型指导翻译以插入 staging 注解,并证明翻译后程序不含效应处理器相关抽象与应用。基准测试显示,相比现有效应处理器或控制操作符语言有显著加速,部分基准在第二翻译下进一步加速。

问题
效应处理器虽能抽象复杂控制流,但现有实现带来显著性能开销,如何在保持抽象的同时消除开销?
方法
提出 λCap 与迭代 CPS 编译,并精化为 λλCap,通过类型指导翻译与 staging 注解保证完全消除效应处理器抽象。
评估
在基准测试套件上对比现有效应处理器/控制操作符语言,观察到显著加速,且子集程序有额外加速。
原文摘要(Abstract)

Effect handlers encourage programmers to abstract over repeated patterns of complex control flow. As of today, this abstraction comes at a significant price in performance. In this paper, we aim to achieve abstraction without regret for effect handlers. We present a language for effect handlers in _capability-passing style_ (λ Cap ) and an implementation of this language as a translation to simply-typed lambda calculus in _iterated continuation-passing style_. A suite of benchmarks indicates that the novel combination of capability-passing style and iterated CPS enables significant speedups over existing languages with effect handlers or control operators. Our implementation technique is general and allows us to generate code in any language that supports first-class functions. We then identify a subset of programs for which we can further improve the performance and guarantee full elimination of the effect handler abstraction. To formally capture this subset, we refine λ Cap to λ λ Cap with a more restrictive type system. We present a type-directed translation for λ λ Cap that inserts staging annotations and prove that no abstractions or applications related to effect handlers occur in the translated program. Using this second translation we observe additional speedups in some of the benchmarks.

链接与引用

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

BibTeX
@article{SchusterBO20,
  title = {Compiling effect handlers in capability-passing style},
  author = {Philipp Schuster and Jonathan Immanuel Brachthäuser and Klaus Ostermann},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {4},
  number = {ICFP},
  year = {2020},
  doi = {10.1145/3408975}
}