Substrate VM
Substrate VM is a lightweight runtime system developed by Oracle Labs for the GraalVM ecosystem. It serves as the execution substrate for Native Image — the ahead-of-time compilation technology that produces standalone native executables from JVM bytecode. Substrate VM replaces the full HotSpot JVM with a minimal runtime that provides only the services essential for executing precompiled native code.
Key components of Substrate VM include:
- Garbage collection: Several GC implementations optimized for low footprint, including a simple serial collector and the low-latency Shenandoah GC adapted for native images.
- Thread management: Lightweight threading support without the full complexity of the JVM's thread model.
- Exception handling: Stack unwinding and exception dispatch compatible with Java semantics.
- Dynamic linking: Support for loading shared libraries and invoking native code through JNI and the Panama foreign function API.
Substrate VM does not include a bytecode interpreter or JIT compiler — all code is compiled ahead of time by the Graal compiler. It also operates under a closed-world assumption: all classes and methods that will ever be used must be known at image build time.
Substrate VM is the JVM stripped to its essence: memory management, thread scheduling, and exception handling. Everything else — interpretation, JIT compilation, dynamic class loading — is sacrificed for startup speed and memory efficiency.