Extending Rotor with Structural Reflection to support Dynamic Languages

Since the research done by Chambers and Ungar in customized dynamic compilation applied to the Self programming language, virtual machine implementations have become faster by optimizing the binary code generated at runtime. Nowadays, dynamic adaptive HotSpot optimizer compilers combine fast compilation and runtime optimization of those parts of the code that are executed a higher number of times. These techniques have made Java and .Net virtual machines a real alternative to develop many types of software products.

Most works that use virtual machine JIT compilers to improve runtime performance of dynamic languages are restricted to compilers that generate Java or .Net bytecodes. Taking Python as an example, there exist different implementations for the Microsoft .Net platform (Python for .Net from the Zope Community, IronPython from Microsoft, and the Python for .Net research project from ActiveState) that simulate Python features. The implementations that have used the JVM (Jython, formerly called JPython) have followed the same approach. Microsoft and Sun platforms were created to support static languages that do not offer structurally reflective features such as adding fields and methods at runtime. As these virtual machines do not support those primitives, additional code must be generated to support these features, leading to a poor runtime performance.

Our work uses a virtual machine with JIT compilation to directly support structural reflection in a language-neutral way. Opposite to the existing implementations, our approach is based on extending the static computational model of an efficient virtual machine, adding the reflective services of dynamic languages. This new computational model is then dynamically translated into the native code of a specific platform using the JIT compiler. Instead of generating extra code to simulate the computational model of dynamic languages, the virtual machine will support these services directly. As a result, a significant performance improvement is achieved. The selected virtual machine is the Microsoft Shared Source CLI implementation, called SSCLI or Rotor, which shares a large amount of code with the commercial CLR virtual machine, but allows complete access to its source.