论文标题

使用内部构建系统构建混合增量编译器,用于跨模块可扩展性

Constructing Hybrid Incremental Compilers for Cross-Module Extensibility with an Internal Build System

论文作者

Smits, Jeff, Konat, Gabriël D. P., Visser, Eelco

论文摘要

上下文:编译时间是软件项目适应性的重要因素。快速重新补偿可以通过对项目的更改进行廉价实验,因为可以快速测试这些更改。很长一段时间以来,单独的增量汇编一直是一个令人感兴趣的话题,可以促进快速补偿。 查询:尽管有增量编译器的好处,但此类编译器通常不是默认编译器。这是因为增量需要进行交叉切割,复杂和容易出错的技术,例如依赖关系跟踪,缓存,缓存无效和更改检测。特别是在具有跨模块定义和集成的语言的编译器中,正确有效地实施增量编译器可能是一个挑战。将增量改造为编译器甚至更难。我们通过开发一种编译器设计方法来解决此问题,该方法可以重用现有的非附加编译器的一部分,以降低构建增量编译器的成本。它还可以通过舞台来编译难以汇总语言功能的直觉。 方法:我们使用本文介绍的编译器设计方法来开发用于Stratego术语培训语言的增量编译器。该语言具有一组功能,乍一看看起来与增量汇编不相容。因此,我们将Stratego视为证明方法的关键案例。我们展示了这种方法如何分解原始编译器,并具有逐步编译策略的解决方案。我们构建增量编译器的关键思想是在内部使用增量构建系统将我们从原始编译器提取的组件连接在一起。 知识:由此产生的编译器已经用作原始全程编译器的替代。我们发现编译器内部的增量构建系统是我们方法的关键组成部分。这使编译器作者可以在多个编译中思考,并几乎毫不费力地将其结合到增量编译器中。通常,外部构建系统促进了单独的汇编àlac,程序员负责管理文件之间的依赖关系。我们重复使用现有的声音和最佳的增量构建系统,并将其依赖性跟踪集成到编译器中。 接地:Stratego的增量编译器与本文一起作为人工制作。我们在一个大型Stratego项目中对其进行评估以测试其性能。基准测试从版本控制中重新编辑了Stratego项目。这些基准是人工制品的一部分,被包装为虚拟机映像,以便于可重复性。 重要性:尽管我们展示了有关Stratego编程语言的设计方法,但我们在本文中也一般都将其描述。许多当前使用的编程语言的编译器比必要的速度要慢得多。我们的设计通过重复现有的编译器并在合理的时间内将其逐渐增加,提供了一种改变此事的方法。

Context: Compilation time is an important factor in the adaptability of a software project. Fast recompilation enables cheap experimentation with changes to a project, as those changes can be tested quickly. Separate and incremental compilation has been a topic of interest for a long time to facilitate fast recompilation. Inquiry: Despite the benefits of an incremental compiler, such compilers are usually not the default. This is because incrementalization requires cross-cutting, complicated, and error-prone techniques such as dependency tracking, caching, cache invalidation, and change detection. Especially in compilers for languages with cross-module definitions and integration, correctly and efficiently implementing an incremental compiler can be a challenge. Retrofitting incrementality into a compiler is even harder. We address this problem by developing a compiler design approach that reuses parts of an existing non-incremental compiler to lower the cost of building an incremental compiler. It also gives an intuition into compiling difficult-to-incrementalize language features through staging. Approach: We use the compiler design approach presented in this paper to develop an incremental compiler for the Stratego term-rewriting language. This language has a set of features that at first glance look incompatible with incremental compilation. Therefore, we treat Stratego as our critical case to demonstrate the approach on. We show how this approach decomposes the original compiler and has a solution to compile Stratego incrementally. The key idea on which we build our incremental compiler is to internally use an incremental build system to wire together the components we extract from the original compiler. Knowledge: The resulting compiler is already in use as a replacement of the original whole-program compiler. We find that the incremental build system inside the compiler is a crucial component of our approach. This allows a compiler writer to think in multiple steps of compilation, and combine that into a incremental compiler almost effortlessly. Normally, separate compilation à la C is facilitated by an external build system, where the programmer is responsible for managing dependencies between files. We reuse an existing sound and optimal incremental build system, and integrate its dependency tracking into the compiler. Grounding: The incremental compiler for Stratego is available as an artefact along with this article. We evaluate it on a large Stratego project to test its performance. The benchmark replays edits to the Stratego project from version control. These benchmarks are part of the artefact, packaged as a virtual machine image for easy reproducibility. Importance: Although we demonstrate our design approach on the Stratego programming language, we also describe it generally throughout this paper. Many currently used programming languages have a compiler that is much slower than necessary. Our design provides an approach to change this, by reusing an existing compiler and making it incremental within a reasonable amount of time.

扫码加入交流群

加入微信交流群

微信交流群二维码

扫码加入学术交流群,获取更多资源