Expand description
§Instruction Handlers Module
This module contains specialized handlers for different types of VM instructions. Each handler is responsible for executing a specific category of operations.
§Handlers
- ArithmeticHandler: Mathematical operations (add, subtract, multiply, etc.)
- ComparisonHandler: Comparison and logical operations
- ControlFlowHandler: Control flow operations (jumps, calls, returns)
- StackOpsHandler: Stack manipulation operations
- HeapOpsHandler: Memory allocation and management
- BuiltinCallsHandler: Built-in function calls
§Design Principles
Each handler follows these principles:
- Single Responsibility: Each handler handles one category of operations
- Generic Implementation: Uses trait bounds for flexibility
- Error Handling: Comprehensive error handling with
ExecutionError - Performance: Optimized for common operations
§Usage Example
use jetcrab::vm::executor::instruction_handlers::ArithmeticHandler;
use jetcrab::vm::executor::traits::StackOperations;
let mut stack = MyStack::new();
ArithmeticHandler::add(&mut stack)?;Re-exports§
pub use arithmetic::ArithmeticHandler;pub use builtin_calls::BuiltinCallsHandler;pub use comparison::ComparisonHandler;pub use control_flow::ControlFlowHandler;pub use heap_ops::HeapOpsHandler;pub use stack_ops::StackOpsHandler;
Modules§
- arithmetic
- Arithmetic Handler
- builtin_
calls - Builtin Calls Handler
- comparison
- Comparison Handler
- control_
flow - Control Flow Handler
- heap_
ops - Heap Operations Handler
- stack_
ops - Stack Operations Handler
Structs§
- Instruction
Handlers - Unified instruction handler that provides access to all instruction handlers