arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2305.05949cs.SE
收藏

面向 Python 的可扩展且精确的以应用为中心的调用图构建

Scalable and Precise Application-Centered Call Graph Construction for Python

Kaifeng Huang, Yixuan Yan, Bihuan Chen, Zixin Tao, Xin Peng

AI总结:

针对 PYCG 在全程序分析中难扩展、流不敏感且 Python 特性支持不足的问题,提出以应用为中心、基于类型图和交替过程内/过程间分析的 JARVIS,显著提升调用图构建的速度、精确率与召回率。

摘要:

调用图构建是过程间静态分析的基础。PYCG 是为 Python 程序构建调用图的最先进方法。遗憾的是,当 PYCG 被适配到同时分析应用程序和依赖库的全程序分析时,它无法扩展到大型程序。此外,PYCG 是流不敏感的,并且不能完全支持 Python 的特性,这妨碍了其准确性。为克服这些缺陷,我们提出了一种为 Python 程序构建以应用为中心的调用图的可扩展且精确的方法,并将其实现为原型工具 JARVIS。JARVIS 为程序中的每个函数维护一个类型图(即程序标识符的类型关系),以支持类型推断。以一个函数作为输入,JARVIS 即时生成调用图,其中流敏感的过程内分析和过程间分析交替进行,并执行强更新。我们在包含 135 个小型 Python 程序的微基准测试和包含 6 个真实 Python 应用程序的宏基准测试上的评估表明,JARVIS 能够显著改进 PYCG:时间至少快 67%,精确率高 84%,召回率至少高 20%。

英文摘要:

Call graph construction is the foundation of inter-procedural static analysis. PYCG is the state-of-the-art approach for constructing call graphs for Python programs. Unfortunately, PyCG does not scale to large programs when adapted to whole-program analysis where application and dependent libraries are both analyzed. Moreover, PyCG is flow-insensitive and does not fully support Python's features, hindering its accuracy. To overcome these drawbacks, we propose a scalable and precise approach for constructing application-centered call graphs for Python programs, and implement it as a prototype tool JARVIS. JARVIS maintains a type graph (i.e., type relations of program identifiers) for each function in a program to allow type inference. Taking one function as an input, JARVIS generates the call graph on-the-fly, where flow-sensitive intra-procedural analysis and inter-procedural analysis are conducted in turn and strong updates are conducted. Our evaluation on a micro-benchmark of 135 small Python programs and a macro-benchmark of 6 real-world Python applications has demonstrated that JARVIS can significantly improve PYCG by at least 67% faster in time, 84% higher in precision, and at least 20% higher in recall.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑