paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Better Defunctionalization through Lambda Set Specialization

通过 Lambda 集特化实现更好的去函数化
PLDI 7(PLDI)2023匹配度 2/10 · 论文属于纯 PL/类型系统/去函数化与编译优化方向,虽含静态分析和机器化证明,但不涉及用户画像核心的 LLM/Agent、浮点程序分析或贝叶斯程序分析交叉。与“PL→AI”或“AI→PL”均无直接关联,仅在广义程序分析与形式化方法上有较弱共鸣。引用 7 inbox
William Brandon, Benjamin Driscoll, Frank Dai, Wilson Berkow, Mae Milano
crossref: 2026-09-10

AI 速览

一句话:提出 Lambda Set Specialization,首个不受限特化去函数化技术,并用类型系统与机器化证明支撑。

高阶函数给静态分析与优化编译带来困难,去函数化可将程序转换为语义等价的一阶表示。已有特化去函数化技术会限制函数值的使用方式,迫使实现回退到高开销的动态方案。本文提出 Lambda Set Specialization(LSS),首个不限制函数值使用方式的特化去函数化技术。作者用多态类型系统追踪函数值在程序中的流动,将高阶函数相对于其参数的特化重新表述为类型单态化,并给出简单可处理的类型推断算法;在 Isabelle/HOL 中完成机器化证明,证明推断算法相对类型系统的可靠性与完备性。评估在 MLton/Standard ML、OCaml 与 Morphic 上,LSS 预处理带来最高 6.85x、3.45x 和 78.93x 的运行加速。

问题
高阶函数的分析与编译困难;已有特化去函数化技术限制函数值使用,迫使编译器回退到高开销的动态方案。
方法
提出基于多态类型系统的 LSS,追踪函数值流并作为类型单态化实现特化,包含可处理类型推断及 Isabelle/HOL 机器化证明。
评估
在 MLton、OCaml 和 Morphic 上以 LSS 预处理并测量运行时性能,最高分别获得 6.85x、3.45x 和 78.93x 加速。
原文摘要(Abstract)

Higher-order functions pose a challenge for both static program analyses and optimizing compilers. To simplify the analysis and compilation of languages with higher-order functions, a rich body of prior work has proposed a variety of defunctionalization techniques, which can eliminate higher-order functions from a program by transforming the program to a semantically-equivalent first-order representation. Several modern languages take this a step further, specializing higher-order functions with respect to the functions on which they operate, and in turn allowing compilers to generate more efficient code. However, existing specializing defunctionalization techniques restrict how function values may be used, forcing implementations to fall back on costly dynamic alternatives. We propose lambda set specialization (LSS), the first specializing defunctionalization technique which imposes no restrictions on how function values may be used. We formulate LSS in terms of a polymorphic type system which tracks the flow of function values through the program, and use this type system to recast specialization of higher-order functions with respect to their arguments as a form of type monomorphization. We show that our type system admits a simple and tractable type inference algorithm, and give a formalization and fully-mechanized proof in the Isabelle/HOL proof assistant showing soundness and completeness of the type inference algorithm with respect to the type system. To show the benefits of LSS, we evaluate its impact on the run time performance of code generated by the MLton compiler for Standard ML, the OCaml compiler, and the new Morphic functional programming language. We find that pre-processing with LSS achieves run time speedups of up to 6.85x under MLton, 3.45x for OCaml, and 78.93x for Morphic.

链接与引用

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

BibTeX
@article{paperbot1947,
  title = {Better Defunctionalization through Lambda Set Specialization},
  author = {William Brandon and Benjamin Driscoll and Frank Dai and Wilson Berkow and Mae Milano},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {7},
  number = {PLDI},
  year = {2023},
  doi = {10.1145/3591260}
}