A well-established approach to reasoning about loops during program analysis is to capture the effect of a loop by extracting recurrences from the loop; these express relationships between the values of variables, or program properties such as cost, on successive loop iterations. Recurrence solvers are capable of computing closed forms for some recurrences, thus deriving precise relationships capturing the complete loop execution. However, many recurrences extracted from loops cannot be solved, due to their having multiple recursive cases or multiple arguments. In the literature, several techniques for approximating the solution of unsolvable recurrences have been proposed. The approach presented in this paper is to define transformations based on regular path expressions and loop counters that (i) transform multi-path loops to single-path loops, giving rise to recurrences with a single recursive case, and (ii) transform multi-argument recurrences to single-argument recurrences, thus enabling the use of recurrence solvers on the transformed recurrences. Using this approach, precise solutions can sometimes be obtained that are not obtained by approximation methods.
翻译:程序分析中循环推理的既定方法是通过从循环中提取重现来捕捉循环效应;变量或程序属性(如成本等)的值之间的这些明确关系在连续循环迭代中出现。 重复求解器能够计算某些重现的封闭形式, 从而得出精确的循环执行关系。 然而, 从循环中提取的许多重现无法解决, 因为它们有多个循环案例或多个参数。 在文献中, 提出了几种接近无法解析的重现解决办法的技术。 本文介绍的方法是定义基于常规路径表达式和循环反作用器的转换( i) 将多路环转换为单路环, 从而产生单一循环复现案例的复现, 以及 (ii) 将多弧复现转换为单弧复发, 从而使得复发者在变现复发中能够使用复现解器。 使用这种方法, 有时可以取得精确的解决方案, 而这种解决办法不是通过近法获得的。