paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Flow-Analysis-Based Closure Optimization

基于流分析的闭包优化
PLDI 10(PLDI)2026匹配度 2/10 · 该论文属于高阶函数式语言的闭包转换与高阶流分析编译优化,虽涉及程序分析和抽象解释,但未涉及 LLM/Agentic 程序、静态分析在机器学习系统中的应用、浮点程序分析或贝叶斯程序分析,与当前研究画像的核心交叉方向基本无关。引用 0 inbox
John Reppy, Olin Shivers, Byron Zhong
crossref: 2026-09-10

AI 速览

一句话:提出基于高阶流分析的安全空间闭包转换器,优化变量元组共享与寄存器展开,提升 SML/NJ 生成代码性能。

高阶函数式语言中,一等函数值的表示依赖闭包转换;嵌套函数构造闭包时常需从外层闭包复制数据,而链接表示虽避免复制却导致变量访问慢和空间泄漏。Shao 和 Appel 的闭包转换器虽减少复制并保证安全空间,但基于弱的一阶分析。本文提出使用高阶流分析指导闭包表示决策的安全空间闭包转换器,并将分析信息用于改进堆分配变量元组的共享以及将变量展开到参数寄存器。作者在 Standard ML of New Jersey 中实现该转换器,实验表明其生成代码平均优于 Shao-Appel 转换器,部分基准获得显著性能提升。

问题
高阶函数式语言编译中,如何高效表示一等函数闭包,避免闭包构造时的数据复制,以及链接表示带来的变量访问慢和空间泄漏问题。
方法
提出基于高阶流分析的安全空间闭包转换器,利用流分析结果指导闭包表示决策,包括共享堆分配变量元组和将变量展开到参数寄存器。
评估
在 Standard ML of New Jersey 中实现该转换器,并与 Shao-Appel 转换器比较;结果显示平均生成更优代码,部分基准测试有显著性能提升。
原文摘要(Abstract)

One of the key implementation challenges for higher-order functional languages is managing the representation of first-class function values. The standard approach to this problem is closure conversion , which is a compiler transformation that introduces an explicit data structure to represent the environment of a function value. Constructing the closure for a nested function usually involves copying data from the enclosing function’s closure. To avoid this copying, one might use linked representations, but that choice makes variable access slow and can introduce space leaks. Shao and Appel developed an effective closure converter that reduces copying and is safe-for-space, but their converter is based on a weak, first-order analysis. In this paper, we present a new safe-for-space closure converter that uses a higher-order flow analysis to inform closure-representation decisions. We describe how this information can be used to improve two aspects of closure optimization: sharing heap-allocated tuples of variables and spreading variables into argument registers. We have implemented our converter in the Standard ML of New Jersey system and demonstrated that it produces better code on average than the Shao and Appel converter, with significant performance gains for some benchmarks.

链接与引用

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

BibTeX
@article{ReppySZ26,
  title = {Flow-Analysis-Based Closure Optimization},
  author = {John Reppy and Olin Shivers and Byron Zhong},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {10},
  number = {PLDI},
  year = {2026},
  doi = {10.1145/3808262}
}