一句话:提出定制化控制流分析 BCFA,为每个 CFG 选择最优遍历策略,加速大规模静态分析 1%-28%。
大规模代码分析(如发现编程模式、挖掘 API 规约)需在上百万个控制流图(CFG)上做分析,性能受 CFG 遍历策略影响很大。现有分析框架采用固定遍历策略,但单一策略无法适应所有分析和 CFG。为此,论文提出定制化控制流分析(BCFA):给定一个 CFA 和大量 CFG,BCFA 通过分析 CFA 代码提取其属性,再结合 CFG 的分支因子、循环性等属性,为每个 CFG 选择最高效的遍历策略。作者在 Boa 中实现 BCFA,用若干代表性静态分析和两个大规模数据集(28.7 万与 1.62 亿个 CFG)评估。结果表明 BCFA 可将大规模分析加速 1%-28%,额外开销低于 0.2%,策略误预测率低于 0.01%。
Many data-driven software engineering tasks such as discovering programming patterns, mining API specifications, etc., perform source code analysis over control flow graphs (CFGs) at scale. Analyzing millions of CFGs can be expensive and performance of the analysis heavily depends on the underlying CFG traversal strategy. State-of-the-art analysis frameworks use a fixed traversal strategy. We argue that a single traversal strategy does not fit all kinds of analyses and CFGs and propose bespoke control flow analysis (BCFA). Given a control flow analysis (CFA) and a large number of CFGs, BCFA selects the most efficient traversal strategy for each CFG. BCFA extracts a set of properties of the CFA by analyzing the code of the CFA and combines it with properties of the CFG, such as branching factor and cyclicity, for selecting the optimal traversal strategy. We have implemented BCFA in Boa, and evaluated BCFA using a set of representative static analyses that mainly involve traversing CFGs and two large datasets containing 287 thousand and 162 million CFGs. Our results show that BCFA can speedup the large scale analyses by 1%-28%. Further, BCFA has low overheads; less than 0.2%, and low misprediction rate; less than 0.01%.