Skip to main content

Crate ristretto_vm

Crate ristretto_vm 

Source
Expand description

§Ristretto VM

Code Coverage Benchmarks License Semantic Versioning

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.
ClassPath
Represents a class path.
Configuration
Configuration for the Ristretto Virtual Machine (VM).
ConfigurationBuilder
Builder for creating a Configuration with a fluent interface.
DefinedModule
Information about a defined module.
MainModule
Represents the main module specification (–module or -m).
ModuleExport
Represents an export directive (–add-exports).
ModuleOpens
Represents an opens directive (–add-opens).
ModulePatch
Represents a module patch (–patch-module).
ModuleRead
Represents a read edge between modules (–add-reads).
ModuleSystem
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§

AccessCheckResult
Result of an access check.
Error
Comprehensive error type for the Ristretto VM.
JavaError
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.
VerifyMode
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§

JavaObject
Trait for converting a Rust value to a Java object. Converts to objects of the primitive wrapper, classes, and strings.
RustValue
Trait for converting Rust values to Value.

Type Aliases§

IntrinsicMethod
Re-export the MethodRegistry for 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