Module core

Source
Expand description

§VM Executor Core

Provides the main executor interface that combines all VM components into a single, easy-to-use execution engine. This is the primary entry point for executing bytecode in the JetCrab VM.

§Overview

The Executor struct integrates:

  • Stack management for value operations
  • Heap management for object allocation
  • Variable management for local/global variables
  • Instruction execution engine

§Architecture

The executor uses concrete implementations of the execution traits, providing a complete VM runtime that can execute JavaScript-like bytecode with proper memory management and error handling.

§Usage

use jetcrab::vm::executor::Executor;
use jetcrab::vm::bytecode::Bytecode;
use jetcrab::vm::value::Value;

let mut executor = Executor::new();
let bytecode = Bytecode::new();
let constants = vec![Value::Number(42.0)];

match executor.execute(&bytecode, &constants) {
    Ok(()) => println!("Execution successful"),
    Err(e) => eprintln!("Execution failed: {:?}", e),
}

Structs§

Executor
Main VM executor that combines all execution components