尚未生成 AI 速览(可能缺少 API key 或等待下次运行补跑)。
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.
@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}
}