Our objective is to formally verify the correctness of the hundreds of expression optimization rules used within the GraalVM compiler. When defining the semantics of a programming language, expressions naturally form abstract syntax trees, or, terms. However, in order to facilitate sharing of common subexpressions, modern compilers represent expressions as term graphs. Defining the semantics of term graphs is more complicated than defining the semantics of their equivalent term representations. More significantly, defining optimizations directly on term graphs and proving semantics preservation is considerably more complicated than on the equivalent term representations. On terms, optimizations can be expressed as conditional term rewriting rules, and proofs that the rewrites are semantics preserving are relatively straightforward. In this paper, we explore an approach to using term rewrites to verify term graph transformations of optimizations within the GraalVM compiler. This approach significantly reduces the overall verification effort and allows for simpler encoding of optimization rules.
翻译:我们的目标是正式验证GraalVM 编译器中使用的数百条表达优化规则的正确性。 当定义一个编程语言的语义时, 表达方式自然地形成抽象的语法树或术语。 但是, 为了方便共享共同的子表达式, 现代编译器将表达方式作为术语图。 定义术语图的语义比定义其同等术语表达式的语义要复杂得多。 更重要的是, 直接定义术语图上的优化和证明语义保护比同等术语表达式要复杂得多。 在术语上, 优化可以表述为有条件的术语重写规则, 证明重写者是语义保护者的证据相对直截了当。 在本文中, 我们探索了一种用术语重写器来验证GraalVM 编译器内优化的语义变形的方法。 这种方法大大降低了总体核查努力, 并使得优化规则的更简单化。