Enhancing Program Analysis with Deterministic Distinguishable Calling Context
Calling context is vital in numerous use cases (clients) such as profiling, testing, debugging, and optimization. The majority of calling-context encoding work focuses on how to scale to larger codebases or to minimize memory and time overhead. The last step of applying these techniques to clients and their impact on the clients’ performance is often left open. We have observed, to achieve efficiency and explainability which are equally important in program analysis, several clients demand not only a deterministic encoded value for the same context in different runs but also such values be globally distinguishable. Unfortunately, almost all current encoding algorithms fail to provide both. As a result, existing clients need to develop auxiliary helpers to meet their needs, which incurs considerable overhead.
In this paper, we propose Deterministic Distinguishable Calling Context Encoding (DCCE) that can enable both properties of calling context encoding natively. The key idea of DCCE is leveraging the static call graph and encoding each calling context as the running call path count. Thereby, a mapping is established statically and can be readily used by the clients. Our experiments with two client tools show that DCCE has a comparable overhead compared to two state-of-the-art encoding schemes, PCCE and PCC, and further avoids the expensive overheads of collision detection, up to 2.1Ă— and 50%, for Splash-3 and SPEC CPU 2017, respectively.