Front Page

The Liberty Research Group

LIL: An Architecture-Neutral Language for Virtual-Machine Stubs [abstract]
Neal Glew, Spyridon Triantafyllis, Michal Cierniak, Marsha Eng, Brian Lewis, and James Stichnoth
Proceedings of the 3rd Virtual Machine Research and Technology Symposium , May 2004.

High-performance managed runtime environments (MREs) that run either Java or Common Language Infrastructure applications require machine code sequences, called stubs, to implement such runtime support operations as object allocation, synchronization, and native method invocation. For example, native methods are often implemented using a different calling convention and interface than the managed code produced by the just-in-time compiler (JIT). Stubs are required to convert between the different conventions. These stubs are low-level and require knowledge of low-level details like the calling conventions, thread-local storage access, and details of stack walking. They are often generated at runtime in order to specialize them for particular methods or classes.

Writing these stubs is tedious and error-prone. For an MRE designed to run on multiple architectures, the problems are multiplied by the number of architectures. To address these problems, we designed and implemented a language called LIL for writing stubs. LIL is an architecture-neutral, low-level language that includes support for constructs that are required for stubs. This support includes, for example, specification of calling convention and a construct to access thread-local storage.

Our experience with LIL has been positive. LIL stubs are easier to write and maintain than stubs written in assembly. They are portable, and run without change on each platform our VM supports. LIL's validity checker helps us find some errors early. We are currently experimenting with using LIL to inline performance critical operations into JIT-generated code. Using this approach, operations like object allocation that are specific to the garbage collector implementation can be inlined without the JIT itself needing to understand their implementation, thus improving VM modularity.