Expand description
JVMRS - JVM implementation in Rust
JVMRS is a high-performance Java Virtual Machine written in Rust, featuring JIT compilation, inline caching, thread-local allocation, and comprehensive polyglot capabilities.
§Performance Features
- Inline Caching: 3-5x faster virtual method dispatch
- Thread-Local Allocation (TLAB): 2-3x faster object allocation
- Tiered JIT Compilation: Adaptive compilation strategy
- Generational GC: Parallel sweep with reduced pause times
§Unique Capabilities
- Rust-Based: Memory safety by construction
- Polyglot: Direct Java/Rust interop without JNI overhead
- WebAssembly: Native WASM support for browser/edge deployment
- Embedded: no_std support for resource-constrained environments
- Interactive REPL: Full-featured REPL for JVM exploration
§Getting Started
§Quick Start
use jvmrs::Interpreter;
// Create interpreter
// Run a Java class§Interactive REPL
cargo run -- --repl§Performance Optimization
use jvmrs::jit::TieredCompilationConfig;
§Module Organization
§Core / Runtime
class_file- Class file parsingclass_loader- Class loading from classpathclass_cache- Fast binary cache (.jvmc)memory- Heap, stack frames, valuesallocator- Arena-based allocationgc- Garbage collectioninline_cache- Inline caching for method invocationtlab- Thread-local allocation bufferscompressed_oops- 16-bit compressed references for memory-constrained environments
§Execution
interpreter- Bytecode execution enginenative- Native method dispatchreflection- Runtime introspectionrepl- Interactive REPL for JVM exploration
§Compilation
jit- JIT manager, tiered compilationcranelift_jit- Cranelift bytecode-to-nativeaot_compiler- AOT to object fileswasm_backend- WebAssembly emission (feature: wasm)
§Developer Tools
debug- Logging, trace configprofiler- Flame graphs, hotspotstrace- Time-travel debuggingdeterministic- Reproducible execution
§Optional Features
ffi- C API (feature: ffi)interop- Java/Rust interop (feature: interop)async_io- Async class loading (feature: async)simd- Vectorized arrays (feature: simd)truffle- GraalVM-style language API (feature: truffle)security,aop,cloud,hot_reload- Additional capabilities
§Documentation
- Quick Start Guide - Get started in minutes
- Architecture Documentation - Design and components
- API Reference - Complete API reference
- Performance Tuning Guide - Optimize performance
- Polyglot Programming Guide - Java/Rust interop
- Competitive Differentiation - vs HotSpot/GraalVM
- Implementation Summary - Features and enhancements
- Developer Experience - Tools and workflows
§Examples
§Basic Usage
use jvmrs::{Interpreter, Value};
// Call a static method§Polyglot Programming
use jvmrs::{Interpreter, Value};
// Register Rust function
// Call from Java§Performance Monitoring
use jvmrs::{Interpreter, Profiler};
// Monitor inline cache
// Monitor TLAB
// Profile performance
// ... run workload ...§Benchmarks
Run the comprehensive benchmark suite:
cargo bench§Testing
cargo test # Unit tests
cargo test --test property_tests # Property-based tests§License
Licensed under either of MIT or Apache-2.0 at your option.
Re-exports§
pub use error::JvmError;pub use memory::Memory;pub use memory::Value;pub use memory::StackFrame;pub use error::MemoryError;pub use compressed_oops::CompressedOops;pub use compressed_oops::OopMode;pub use interpreter::Interpreter;pub use jit::JitManager;pub use jit::TieredCompilationConfig;pub use jit::CompilationLevel;pub use profiler::Profiler;
Modules§
- allocator
- Arena-based allocators for better cache locality and reduced fragmentation.
- annotations
- Annotation parsing from class file attributes.
- aop
- Proxy-based AOP (Aspect-Oriented Programming) support at runtime.
- aot_
compiler - AOT Compiler - Ahead-of-time compilation to native object files.
- class_
cache - Fast class loading with validated binary cache format (.jvmc).
- class_
file - class_
loader - Class loading implementation for JVMRS
- cloud
- Cloud and distributed computing extensions.
- compressed_
oops - Compressed ordinary object pointers (oops) for memory-constrained environments.
- cranelift_
jit - Cranelift-based JIT: bytecode-to-native code generation.
- debug
- deterministic
- Deterministic execution mode for real-time, safety-critical, and blockchain systems.
- error
- Custom error types for JVMRS
- escape_
analysis - Escape analysis for stack allocation optimization.
- extensions
- Rust crate integration - plugin system for Java extensions.
- gc
- Garbage collection: generational GC with parallel collection and ownership-based root tracking for low-pause behavior.
- hot_
reload - Hot code reloading - replace methods at runtime without restart.
- inline_
cache - Inline caching for optimized method invocation
- interpreter
- JVM bytecode interpreter.
- jit
- JIT Compilation Module for jvmrs
- jni
- Java Native Interface (JNI) implementation.
- memory
- JVM memory management: heap, stack frames, and values
- native
- osr
- On-Stack Replacement (OSR) for long-running loops.
- pgo
- Profile-Guided Optimization (PGO) support.
- profiler
- Integrated profiler with flame graph export and hotspot detection.
- reflection
- Reflection API for runtime introspection
- repl
- Interactive REPL for JVM exploration
- security
- Security instrumentation - runtime vulnerability detection.
- serialization
- Serialization/deserialization support (java.io.Serializable).
- tlab
- Thread-Local Allocation Buffers (TLAB) for fast object allocation
- trace
- Execution trace recorder - foundation for time-travel debugging.
- visualization
- Visualization tools for JVM internals.
Macros§
- convert_
result - Convenience macro for converting results with JvmError