一句话:提出路径表达式精化算法,保证不降低静态分析精度,并显著提升循环断言证明能力。
代数程序分析通常先构造合法的路径表达式,再在语义代数中解释以得到分析结果。合法路径表达式有无穷多个,选择会显著影响精度;且按语言包含关系排除路径未必提升精度,甚至可能更差。本文提出路径表达式精化算法:输入合法路径表达式 E,输出合法 E′,保证分析结果不劣于 E。算法对叶子循环给出基础情形的不退化证明,并在非叶子循环处将体内各循环视为不可分原子后应用叶子循环算法。实验表明该技术使 Compositional Recurrence Analysis 在难循环微基准上多证明超过 25% 的断言。
Algebraic program analyses compute information about a program’s behavior by first (a) computing a valid path expression —i.e., a regular expression that recognizes all feasible execution paths (and usually more)—and then (b) interpreting the path expression in a semantic algebra that defines the analysis. There are an infinite number of different regular expressions that qualify as valid path expressions, which raises the question “ Which one should we choose? ” While any choice yields a sound result, for many analyses the choice can have a drastic effect on the precision of the results obtained. This paper investigates the following two questions: (1) What does it mean for one valid path expression to be “better” than another ? (2) Can we compute a valid path expression that is “better,” and if so, how ? We show that it is not satisfactory to compare two path expressions E 1 and E 2 solely by means of the languages that they generate . Counter to one’s intuition, it is possible for L ( E 2 ) ⊊ L ( E 1 ), yet for E 2 to produce a less-precise analysis result than E 1 —and thus we would not want to perform the transformation E 1 → E 2 . However, the exclusion of paths so as to analyze a smaller language of paths is exactly the refinement criterion used by some prior methods. In this paper, we develop an algorithm that takes as input a valid path expression E , and returns a valid path expression E ′ that is guaranteed to yield analysis results that are at least as good as those obtained using E . While the algorithm sometimes returns E itself, it typically does not: (i) we prove a no-degradation result for the algorithm’s base case—for transforming a leaf loop (i.e., a most-deeply-nested loop); (ii) at a non-leaf loop L , the algorithm treats each loop L ′ in the body of L as an indivisible atom, and applies the leaf-loop algorithm to L ; the no-degradation result carries over to (ii), as well. Our experiments show that the technique has a substantial impact: the loop-refinement algorithm allows the implementation of Compositional Recurrence Analysis to prove over 25% more assertions for a collection of challenging loop micro-benchmarks.
@article{paperbot649,
title = {Refinement of path expressions for static analysis},
author = {John Cyphert and Jason Breck and Zachary Kincaid and Thomas Reps},
journal = {Proceedings of the ACM on Programming Languages},
volume = {3},
number = {POPL},
year = {2019},
doi = {10.1145/3290358}
}