Expand description
§VM Executor Module
This module provides the execution engine for the JetCrab virtual machine. It handles instruction execution, control flow, and memory management through a modular architecture of specialized handlers.
§Architecture
The executor is built around several key components:
- Instruction Handlers: Specialized modules for different types of operations
- Instruction Dispatcher: Routes instructions to appropriate handlers
- Traits: Define interfaces for stack, heap, and variable operations
- Error Handling: Comprehensive error handling and recovery
§Usage
use jetcrab::vm::executor::{InstructionExecutor, InstructionExecutorImpl};
use jetcrab::vm::bytecode::Bytecode;
use jetcrab::vm::value::Value;
let mut executor = InstructionExecutorImpl::new();
let bytecode = Bytecode::new();
let constants = vec![Value::Number(42.0)];
match executor.execute(&bytecode, &constants) {
Ok(()) => println!("Execution completed successfully"),
Err(e) => eprintln!("Execution failed: {:?}", e),
}Re-exports§
pub use error_handler::ExecutionError;pub use instruction_dispatcher::InstructionDispatcher;pub use instruction_executor::InstructionExecutorImpl;pub use traits::HeapOperations;pub use traits::InstructionExecutor;pub use traits::StackOperations;pub use traits::VariableManager;pub use core::Executor;
Modules§
- core
- VM Executor Core
- error_
handler - Execution Error Handler
- heap_
manager - Heap Manager
- instruction_
dispatcher - Instruction Dispatcher
- instruction_
executor - Instruction Executor Implementation
- instruction_
handlers - Instruction Handlers Module
- stack_
manager - Stack Manager
- traits
- VM Execution Traits
- variable_
manager - Variable Manager