Joeq is a virtual machine and compiler infrastructure designed to facilitate research in virtual machine technologies such as Just-In-Time and Ahead-Of-Time compilation, advanced garbage collection techniques, distributed computation, sophisticated scheduling algorithms, and advanced run time techniques.
Joeq is entirely implemented in Java, leading to reliability, portability, maintainability, and efficiency. It is also language-independent, so code from any supported language can be seamlessly compiled, linked, and executed -- all dynamically.
Each component of the virtual machine is written to be independent with a general but well-defined interface, making it easy to experiment with new ideas.
Joeq is released as open source software, and is being used as a framework by researchers on five continents on topics ranging from automatic distributed virtual machines to whole-program pointer analysis.
Joeq is a virtual machine and compiler infrastructure designed to be a platform for research in compilation and virtual machine technologies. We had three main goals in designing the system. First and foremost, we wanted the system to be flexible. We are interested in a variety of compiler and virtual machine research topics, and we wanted a system that would not be specific to researching a particular area.
For example, we have interest in both static and dynamic compilation techniques, and in both type-safe and unsafe languages. We wanted a system that would be as open and general as possible, without sacrificing usability or performance.
Second, we wanted the system to be easy to experiment with. As its primary focus is research, it should be straightforward to prototype new ideas in the framework. With this in mind, we tried to make the system as modular as possible, so that each component is easily replaceable. Learning from our experience with Jalapeno, another virtual machine written in Java, we decided to implement the entire system in Java.
This makes it easy to quickly implement and prototype new ideas, and features like garbage collection and exception tracebacks ease debugging and improve productivity. Java, being a dynamic language, is also a good consumer for many of our dynamic compilation techniques; the fact that our dynamic compiler can compile the code of the virtual machine itself means that it can dynamically optimize the virtual machine code with respect to the application that is running on it. Java's object-oriented nature also facilitates modularity of the design and implementation.
Third, we wanted the system to be useful to a wide audience. The fact that the system is written in Java means that much of the system can be used on any platform that has an implementation of a Java virtual machine. The fact that Joeq supports popular input languages like Java, C, C++, Fortran, and even x86 binary code increases the scope of input programs. We released the system on the SourceForge web site as open source under the Library GNU Public License.
It has been picked up by researchers on five continents for various purposes, among them: automatic extraction of component interfaces, static whole-program pointer analysis, context-sensitive call graph construction, automatic distributed computation, versioned type systems for operating systems, sophisticated profiling of applications, advanced dynamic compilation techniques, system checkpointing, anomaly detection, secure execution platforms and autonomous systems. In addition, Joeq is now used as the basis of the Advanced Compilation Techniques class taught at Stanford University.
Joeq supports two modes of operation: native execution and hosted execution. In native execution, the Joeq code runs directly on the hardware. It uses its own run-time routines, thread package, garbage collector, etc. In hosted execution, the Joeq code runs on top of another virtual machine. Operations to access objects are translated into calls into the reflection library of the host virtual machine.
The user code that executes is identical, and only a small amount of functionality involving unsafe operations is not available when running in hosted execution mode. Hosted execution is useful for debugging purposes and when the underlying machine architecture is not yet directly supported by Joeq. We also use hosted execution mode to bootstrap the system and perform checkpointing, a technique for optimizing application startup times.
Joeq system consists of seven major parts:
· Front-end: Handles the loading and parsing of input files, such as Java class files, SUIF files, and binary object files.
· Compiler: A framework for performing analyses and optimizations on code. This includes the intermediate representation (IR) of our compiler.
· Back-end: Converts the compiler's intermediate representation into native, executable code. This code can be output to an object file or written into memory to be executed. In addition, it generates metadata about the generated code, such as garbage collection maps and exception handling information.
· Interpreter: Directly interprets the various forms of compiler intermediate representations.
· Memory Manager: Organizes and manages memory. Joeq supports both explicitly-managed and garbage-collected memory.
· Dynamic: Provides profile data to the code analysis and optimization component, makes compilation policy decisions, and drives the dynamic compiler.
· Run-time Support: Provides runtime support for introspection, thread scheduling, synchronization, exception handling, interfacing to external code, and language-specific features such as dynamic type checking.