Expand description
§Ristretto VM
Ristretto VM is a Java Virtual Machine implementation written in pure Rust. It executes Java bytecode by interpreting class files loaded through the Ristretto classloader.
§Features
- Bytecode interpretation with no dependencies on existing JVM implementations
- Pure Rust implementation for memory safety and performance
- Support for Java class loading and execution
- Configurable VM parameters
- Basic JIT compilation capabilities
- Type safe concurrent, mark-sweep garbage collector
§Examples
use ristretto_vm::{VM, Configuration, ConfigurationBuilder};
use ristretto_classloader::ClassPath;
// Create a VM configuration
let configuration = ConfigurationBuilder::new()
.class_path(ClassPath::from(&["/path/to/classes"]))
.build()?;
// Create the VM instance
let mut vm = VM::new(configuration).await?;
// Execute main method of a class
let _ = vm.invoke_main(&[] as &[&str]).await?;Modules§
- monitor
- Monitor implementation for synchronized blocks.
- startup_
trace
Macros§
- startup_
trace - Log a startup phase message and the time elapsed since the last
startup_trace!()call.
Structs§
- Class
- A representation of a Java class.
- Class
Path - Represents a class path.
- Configuration
- Configuration for the Ristretto Virtual Machine (VM).
- Configuration
Builder - Builder for creating a
Configurationwith a fluent interface. - Defined
Module - Information about a defined module.
- Main
Module - Represents the main module specification (–module or -m).
- Module
Export - Represents an export directive (–add-exports).
- Module
Opens - Represents an opens directive (–add-opens).
- Module
Patch - Represents a module patch (–patch-module).
- Module
Read - Represents a read edge between modules (–add-reads).
- Module
System - Complete module system combining static configuration and dynamic runtime state.
- Object
- Represents an object in the Ristretto VM.
- Parameters
- Parameters for Ristretto VM methods
- Thread
- A thread is a single sequential flow of control within a program. It has its own call stack and program counter.
- VM
- Java Virtual Machine
Enums§
- Access
Check Result - Result of an access check.
- Error
- Comprehensive error type for the Ristretto VM.
- Java
Error - Errors that can occur when loading classes
- Reference
- Represents a reference to an object in the Ristretto VM.
- Value
- Represents a value in the Ristretto VM.
- Verify
Mode - Verification mode controlling which classes are verified.
Constants§
- ALL_
UNNAMED - Special constant for “all unnamed modules” target.
- DEFAULT_
JAVA_ VERSION - The default Java version used by the class loader. This is the version that will be used if no version is specified when creating a class loader.
Traits§
- Java
Object - Trait for converting a Rust value to a Java object. Converts to objects of the primitive wrapper, classes, and strings.
- Rust
Value - Trait for converting Rust values to
Value.
Type Aliases§
- Intrinsic
Method - Re-export the
MethodRegistryfor use by other modules in the VM An intrinsic method represents a native Java method required by the Java Virtual Machine (JVM) that is implemented in Rust. - Result
- Ristretto VM result type