Ordering Optimisations in Meta-Compilation of Primitive MethodsDownload PDF

12 Oct 2022 (modified: 05 May 2023)FAST Smalltalk 2022Readers: Everyone
Keywords: compiler optimisations, virtual machine, interpreter, jit compiler
TL;DR: We present the compiler phase-ordering problem for out optimising meta-compiler. We compare some approaches to solve this problem for the compilation of Smalltalk primitives.
Abstract: Meta-compilation schemes help to automatically build Just-in-Time (JIT) compilers from interpreters by performing a meta-interpretation of the VM interpreter. Generated JIT compilers face the well-known problem of phase ordering: selecting a good optimisation sequence to apply to the compiled programs. Manual optimisation lists are hard to maintain and are *one-size-fits-all* solutions that assume that a single sequence is equally effective in all possible programs. Generating such a list automatically is still challenging nowadays. In this paper, we explore the phase-ordering problem in the case of the meta-compilation of Pharo VM interpreter primitives. We present three automatic strategies to find good-enough optimisation sequences: a search-based approach, a predictive approach based on code shape, and an automatically-found fixed list approach. We compare them by measuring the relative compiled code size and their rate of convergence. We evaluate this work over 17 of Pharo's language interpreter primitives. On average, the Predictive strategy arrives at its optimal result before the rest with 21% fewer optimisations, the search strategy finds better results in complex cases. The automatic approaches seem promising for primitive meta-interpretation.
2 Replies

Loading