ELF-based code storage support for the Eclipse OMR Ahead-of-Time compiler: a WebAssembly use case
University of New Brunswick
Over the years, Ahead-of-Time (AOT) compilation has drawn significant attention in the research community due to its ability to accelerate the startup of a runtime system. AOT compilation involves compiling, persisting and re-using existing compiled code in later runs, thereby avoiding costly re-compilation. Typically, a program is compiled and translated into machine language or native code, which persists in a binary container format. At present, the most commonly used code container options are either cache-based or object-based. Eclipse OMR is a collection of components, which are used to build robust language runtimes. The WebAssembly AOT compiler (wabtaot) is constructed using the Eclipse OMR JitBuilder library. Currently, the wabtaot compiled code is stored in a prototype of the Eclipse OMR shared cache. The goal of this research is to find a better lightweight AOT code storage option for resource-constrained systems. To achieve this goal, the Eclipse OMR ELF generation module is enhanced by implementing an ELF shared object generator that can store AOT data and use it as part of the Eclipse OMR AOT component. The design and implementation of the ELF shared object for Eclipse OMR is discussed and demonstrated using wabtaot. Evaluation is carried out by comparing the ELF shared-object approach with the existing shared cache in the wabtaot environment on metrics like execution speed, memory footprint, file size and sharing. By doing so, the execution time trade-offs, lower memory consumption and compact-size ELF objects are witnessed, thereby indicating a possibility of using the lightweight ELF shared objects in resource-constrained systems.