paperbot · PL 论文追踪

全部论文 待读 收藏

P2 The Simple Essence of Monomorphization

单态化的简单本质
OOPSLA 9(OOPSLA1)2025匹配度 3/10 · 论文属于类型系统与编译方向,涉及基于类型的流分析和形式化证明,与用户对静态分析/形式化的广泛兴趣有弱关联;但未涉及用户核心关注的LLM/Agentic程序、浮点程序分析或贝叶斯程序分析。引用 2 inbox
Matthew Lutze, Philipp Schuster, Jonathan Immanuel Brachthäuser
crossref: 2026-09-10

AI 速览

一句话:提出基于类型流分析的简单单态化技术,可处理高阶与存在类型,并证明其类型与语义保持。

单态化是参数多态的常见实现技术,可避免统一表示带来的运行时开销,但会造成代码重复;文献中缺乏通用形式化处理,且通常认为它与高阶多态不兼容。本文提出一种简单的单态化技术,核心是基于类型的流分析来追踪类型实例化在程序中的流动,并借鉴代数子类型思想。该方法可推广到高阶类型、存在类型及其任意组合;仅支持到多态递归,并将多态递归统一检测为循环流。作者还指出存在类型下一种新的多态递归形式,称为 polymorphic packing。元理论结果表明,翻译保持类型,并逐步保持语义。

问题
单态化是参数多态的重要实现技术,但缺乏通用形式化,且被认为无法支持高阶多态;本文要建立可推广的形式化单态化方法。
方法
基于类型驱动的流分析追踪类型实例化,借鉴代数子类型,统一处理全称与存在量化,并将多态递归检测为循环流。
评估
评估以元理论为主:证明翻译类型保持,并逐步保持操作语义。
原文摘要(Abstract)

Monomorphization is a common implementation technique for parametric type-polymorphism, which avoids the potential runtime overhead of uniform representations at the cost of code duplication. While important as a folklore implementation technique, there is a lack of general formal treatments in the published literature. Moreover, it is commonly believed to be incompatible with higher-rank polymorphism. In this paper, we formally present a simple monomorphization technique based on a type-based flow analysis that generalizes to programs with higher-rank types, existential types, and arbitrary combinations. Inspired by algebraic subtyping, we track the flow of type instantiations through the program. Our approach only supports monomorphization up to polymorphic recursion, which we uniformly detect as cyclic flow. Treating universal and existential quantification uniformly, we identify a novel form of polymorphic recursion in the presence of existential types, which we coin polymorphic packing. We study the meta-theory of our approach, showing that our translation is type-preserving and preserves semantics step-wise.

链接与引用

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

BibTeX
@article{paperbot3171,
  title = {The Simple Essence of Monomorphization},
  author = {Matthew Lutze and Philipp Schuster and Jonathan Immanuel Brachthäuser},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {9},
  number = {OOPSLA1},
  year = {2025},
  doi = {10.1145/3720472}
}