- AOT Java2C Compiler: An ahead-of-time compiler written in Ruby and Java. This compiler takes in Java byte code and produces machine independent C. The Java component performs the code generation whilst the Ruby component acts as a harness for the Java component — providing configuration, marshalling input files, directing output to the appropriate location and finally invoking the C compiler on the generated code.
- Fiji Runtime: A Java run-time written in C and Java. The runtime includes a real-time garbage collector as described in Section 2.5.2. The C code is invoked by the Java code by calling methods marked with Java’s native keyword.
- FijiCore lib: A Java class library called FijiCore written in C and Java. Similarly to the run-time, C and Java code is bridged by the native keyword.
- Real-time Garbage Collector - a set of GC algorithms offering both performance and real-time guarantees.
- SCJ and RTSJ libraries (RTSJ is supported only partially) - SCJ and RTSJ libraries are distributed with FijiVM to offer alternatives to regular Java and Java+RTGC.
The key part of the FijiVM is a set of garbage collector algorithms that offer various performance characteristics and real-time guarantees. You can find more information about FijiVM's GC in Schism: Fragmentation-Tolerant Real-Time Garbage Collection. PLDI'10.
FijiVM Compilation Process
Since the FijiVM is based on an AOT compiler that translates the application from its Java byte-code to native C code, the compilation process is different from what we are used to in regular Java VMs. It is best illustrated on the following picture:
AOT Java2C Compiler
The Java2C compiler not only translates byte-code to C code but it performs number of tasks. There is several level of transformation, each introducing various code optimization techniques known from standard compilers. The byte-code is translated into Fiji's specific intermediate representation (IR) where the code is optimized further again. Until the final transformation generating the C-code, several phases of transformation+optimization is performed, each closer to the final product which is the generated C code. Again, illustrated on the following picture:
FijiCore contains a subset of the standard Java class library, including generic collections and events from java.util, I/O and character set support from java.nio and java.io, arbitrary-sized arithmetic from java.math and all of java.lang, including annotations and reflections.
Instead of FijiCore, developers may also elect to use GNU Classpath (an open source implementation of the standard Java library). A second Fiji-specific class library called HardRTJ is currently in development. HardRTJ is intended to provide a library option with a smaller memory footprint than FijiCore, and a yet smaller feature set (note that to use any alternate library the library must be supported on the target platform).
SCJ and RTSJ support
Apart from the FijiVM libraries that replace a standard Java library known from a regular JavaVM distributions, FijiVM offers a support for extending libraries focused on real-time and safety-critical systems. The FijiVM comes with a distribution of oSCJ - an open-source Safety-critical Java implementation based on the JSR-302. Further, FijiVM offers a basic RTSJ (the JSR-1 implementation) support.
- See my previous post : Is Java ready for Real-time?
- James Hatherly's thesis: Native real-time Java on seL4
- FijiVM research publications:
- Schism: Fragmentation-Tolerant Real-Time Garbage Collection. PLDI'10.
- High-level Programming of Embedded Hard Real-Time Devices. EuroSys'10
- Real Time Java on resource-constrained platforms with Fiji VM. JTRES'09
- oSCJ Project:
In the next post, I plan to show you how to use FijiVM to compile basic Java programs and how to use the VM in practice.