Whole-program analysis is an essential technique that enables advanced compiler optimizations. An important example of such a method is points-to analysis used by ahead-of-time (AOT) compilers to discover program elements (classes, methods, fields) used on at least one program path. GraalVM Native Image uses a points-to analysis to optimize Java applications, which is a time-consuming step of the build. We explore how much the analysis time can be improved by replacing the points-to analysis with a rapid type analysis (RTA), which computes reachable elements faster by allowing more imprecision. We propose several extensions of previous approaches to RTA: making it parallel, incremental, and supporting heap snapshotting. We present an extensive experimental evaluation of the effects of using RTA instead of points-to analysis, in which RTA allowed us to reduce the analysis time for Spring Petclinic, a popular demo application of the Spring framework, by 64% and the overall build time by 35% at the cost of increasing the image size due to the imprecision by 15%.
翻译:全程序分析是实现高级编译器优化的一项关键技术。此类方法的一个重要示例是指针分析(points-to analysis),提前编译(AOT)编译器利用它来发现至少一条程序路径上使用的程序元素(类、方法、字段)。GraalVM Native Image 使用指针分析来优化 Java 应用程序,这是构建过程中一个耗时的步骤。我们探索了通过用快速类型分析(RTA)替代指针分析来改善分析时间的程度——RTA 通过允许更大的不精确性来更快地计算可达元素。我们提出了先前 RTA 方法的若干扩展:使其具备并行性、增量性以及支持堆快照。我们针对用 RTA 替代指针分析的效果进行了广泛的实验评估,其中 RTA 使我们能够将 Spring Petclinic(Spring 框架的一个流行演示应用)的分析时间减少 64%,整体构建时间减少 35%,但代价是由于不精确性导致镜像大小增加 15%。