MEA2: A Lightweight Field-Sensitive Escape Analysis with Points-to Calculation for Golang
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 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" display="inline" overflow="scroll"> <mml:mn>7.9</mml:mn> <mml:mo>%</mml:mo> </mml:math> on average (up to <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" display="inline" overflow="scroll"> <mml:mn>25.7</mml:mn> <mml:mo>%</mml:mo> </mml:math> ) while reducing the dynamic memory allocation size by <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" display="inline" overflow="scroll"> <mml:mn>11.6</mml:mn> <mml:mo>%</mml:mo> </mml:math> on average (up to <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" display="inline" overflow="scroll"> <mml:mn>35.5</mml:mn> <mml:mo>%</mml:mo> </mml:math> ). All this is achieved while keeping the time overhead of escape analysis within <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" display="inline" overflow="scroll"> <mml:mn>1</mml:mn> <mml:mo>%</mml:mo> </mml:math> of the compilation process.
Authors
- Qingwei Li (ORCID: https://orcid.org/0009-0002-3888-2435)
- Yu Zhang (ORCID: https://orcid.org/0000-0001-6638-6442)
- Fugen Tang
- Boyao Ding
- Jing Chen
Institutions
- University of Science and Technology of China (CN)
- National Science Centre (PL)
Publication Details
- Journal
- Proceedings of the ACM on Programming Languages
- Published
- 2024-10-08
- DOI
- https://doi.org/10.1145/3689759
- Primary Topic
- Algorithms and Data Compression
- Type
- article
- Field-Weighted Citation Impact
- 0.00