一句话:将抽象解释器转化为编译器,把编译 pass 对应为函子域,并用 SSA 抽象域提升分析精度。
重写与静态分析通常被分开处理,但变换会改变程序内涵性质并影响分析精度,而高效变换也常依赖程序不变量。本文提出把抽象解释器变成编译器:在抽象域标准签名上构造自由代数,将函子域对应为编译 pass,并用前向模拟证明可靠性、用后向模拟刻画完备性。作者以非标准 SSA 签名的抽象域实现到 SSA 的翻译,并将其嵌入抽象解释器。在相近时间与内存复杂度下,基于 SSA 的非关系域比标准非关系域更精确;该域还能恢复分析低级机器码而非源代码时的精度损失,支持符号与语义方法相互精化的分析与编译 pass。
Rewriting and static analyses are mutually beneficial techniques: program transformations change the inten- sional aspects of the program, and can thus improve analysis precision, while some efficient transformations are enabled by specific knowledge of some program invariants. Despite the strong interaction between these techniques, they are usually considered distinct. In this paper, we demonstrate that we can turn abstract interpreters into compilers, using a simple free algebra over the standard signature of abstract domains. Functor domains correspond to compiler passes, for which soundness is translated to a proof of forward simulation, and completeness to backward simulation. We achieve translation to SSA using an abstract domain with a non-standard SSA signature. Incorporating such an SSA translation to an abstract interpreter improves its precision; in particular we show that an SSA-based non-relational domain is always more precise than a standard non-relational domain for similar time and memory complexity. Moreover, such a domain allows recovering from precision losses that occur when analyzing low-level machine code instead of source code. These results help implement analyses or compilation passes where symbolic and semantic methods simultaneously refine each other, and improves precision when compared to doing the passes in sequence. CCS Concepts: • Software and its engineering → Compilers ; Formal Software verification; • Theory of computation → Program analysis ; Program verification ; Abstraction ; Equational logic and rewriting.