paperbot · PL 论文追踪

全部论文 待读 收藏

P2 MEA2: A Lightweight Field-Sensitive Escape Analysis with Points-to Calculation for Golang

MEA2:一种面向 Go 的轻量级字段敏感逃逸分析及其指向集计算
OOPSLA 8(OOPSLA2)2024匹配度 3/10 · 论文是 Go 语言的字段敏感逃逸分析,属于传统程序分析与编译器优化,不涉及 LLM/Agent,也不涉及浮点程序分析或贝叶斯程序分析,与用户核心的 PL×AI 交叉方向不匹配。仅在“静态分析技术”这一宽泛层面有少量参考价值。引用 1 inbox
Boyao Ding, Qingwei Li, Yu Zhang, Fugen Tang, Jinbao Chen
dblp: 2026-09-10crossref: 2026-09-10

AI 速览

一句话:为 Go 提出字段敏感并结合指向分析的逃逸分析框架 MEA2,显著减少堆分配且编译开销低于 1%。

逃逸分析通过识别对象与指针的动态生命周期,使非逃逸变量可分配在栈上,从而减少堆分配、缓解 GC 压力。Go 作为垃圾回收语言,其编译器采用快速但保守的逃逸分析:字段不敏感,且省略指向集(points-to set)计算,导致更多变量被分配到堆上。实证统计表明,字段访问与间接内存访问在真实 Go 程序中普遍存在,为逃逸分析提升性能提供了空间。本文提出 MEA2,一个构建在基于 LLVM 的 Go 编译器 GoLLVM 之上的逃逸分析框架,将字段敏感性与指向分析相结合,并设计了一种新颖的泛型函数摘要表示,以支持快速的跨过程分析。作者在 12 个广泛使用的开源项目中用 MEA2 执行栈分配进行评测。结果显示,与 Go 的逃逸分析相比,MEA2 平均减少 7.9% 的堆分配点(最高 25.7%),平均减少 11.6% 的动态内存分配量(最高 35.5%),同时逃逸分析的时间开销保持在编译过程的 1% 以内。

问题
Go 编译器的逃逸分析字段不敏感且不做指向集计算,过于保守,导致大量本可栈分配的变量被分配到堆上,增加堆分配与 GC 压力。
方法
在基于 LLVM 的 Go 编译器 GoLLVM 上实现 MEA2 框架,将字段敏感分析与指向分析结合,并设计泛型函数摘要表示以加速跨过程分析。
评估
在 12 个广泛使用的开源 Go 项目上执行栈分配评测,对比 Go 原生逃逸分析,统计堆分配点、动态内存分配量以及逃逸分析的编译时间开销。
原文摘要(Abstract)

Escape analysis plays a crucial role in garbage-collected languages as it enables the allocation of non-escaping variables on the stack by identifying the dynamic lifetimes of objects and pointers. This helps in reducing heap allocations and alleviating garbage collection pressure. However, Go, as a garbage-collected language, employs a fast yet conservative escape analysis, which is field-insensitive and omits point-to-set calculation to expedite compilation. This results in more variables being allocated on the heap. Empirical statistics reveal that field access and indirect memory access are prevalent in real-world Go programs, suggesting potential opportunities for escape analysis to enhance program performance. In this paper, we propose MEA 2 , an escape analysis framework atop GoLLVM (an LLVM-based Go compiler), which combines field sensitivity and points-to analysis. Moreover, a novel generic function summary representation is designed to facilitate fast inter-procedural analysis. We evaluated it by using MEA 2 to perform stack allocation in 12 wildly-use open-source projects. The results show that, compared to Go’s escape analysis, MEA 2 can reduce heap allocation sites by 7.9 % on average (up to 25.7 % ) while reducing the dynamic memory allocation size by 11.6 % on average (up to 35.5 % ). All this is achieved while keeping the time overhead of escape analysis within 1 % of the compilation process.

链接与引用

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

BibTeX
@article{DingL0TC24,
  title = {MEA2: A Lightweight Field-Sensitive Escape Analysis with Points-to Calculation for Golang},
  author = {Boyao Ding and Qingwei Li and Yu Zhang and Fugen Tang and Jinbao Chen},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {8},
  number = {OOPSLA2},
  year = {2024},
  doi = {10.1145/3689759}
}