Expand description
fusevm — Language-agnostic bytecode VM with fused superinstructions.
Any language frontend can compile to fusevm opcodes and get:
- Fused superinstructions for hot loops (
AccumSumLoop, etc.) - Extension opcode dispatch for language-specific ops
- Stack-based execution with slot-indexed fast paths
- Three-tier Cranelift JIT:
- Linear (straight-line, compile on first call)
- Block (whole-chunk CFG, threshold 10)
- Tracing (hot loop body, threshold 50, full side-exit machinery)
§Tracing JIT capability matrix
| Capability | Status |
|---|---|
| Loop bodies, int slots, no calls | Phase 1 |
| Cross-call inlining (branchless callees) | Phase 2 |
Caller-frame if/else with side-exits | Phase 3 |
| Callee-frame branches, frame materialization on deopt | Phase 4 |
| Value-stack reconstruction on deopt (Int + Float) | Phase 5 + 5b |
| Side-exit deopt counter + auto-blacklist | Phase 6 |
Persistent metadata export/import (TraceMetadata) | Phase 7 |
| Bounded recursion inlining (depth ≤ 4) | Phase 8 |
| Side-trace stitching from hot deopt sites | Phase 9 |
§Architecture
stryke source ──→ stryke compiler ──┐
awkrs source ──→ awkrs compiler ├──→ fusevm::Op ──→ VM::run()
zshrs source ──→ shell compiler ──┘ ↳ optional tracing JIT§Usage
use fusevm::{Op, ChunkBuilder, VM, VMResult, Value};
let mut b = ChunkBuilder::new();
b.emit(Op::LoadInt(40), 1);
b.emit(Op::LoadInt(2), 1);
b.emit(Op::Add, 1);
let mut vm = VM::new(b.build());
match vm.run() {
VMResult::Ok(val) => println!("result: {}", val.to_str()),
VMResult::Error(e) => eprintln!("error: {}", e),
VMResult::Halted => {}
}Re-exports§
pub use chunk::Chunk;pub use chunk::ChunkBuilder;pub use host::DefaultHost;pub use host::ShellHost;pub use jit::DeoptFrame;pub use jit::DeoptInfo;pub use jit::JitCompiler;pub use jit::JitExtension;pub use jit::NativeCode;pub use jit::SlotKind;pub use jit::TraceJitConfig;pub use jit::TraceLookup;pub use jit::TraceMetadata;pub use op::Op;pub use value::Value;pub use vm::Frame;pub use vm::VMPool;pub use vm::VMResult;pub use vm::VM;
Modules§
- chunk
- Bytecode container — a compiled unit of execution.
- host
- Shell host callback interface.
- jit
- fusevm JIT — Cranelift codegen for universal bytecodes.
- op
- Bytecode instruction set for fusevm.
- shell_
builtins - Shell builtin IDs for
CallBuiltin(id, argc)dispatch. - value
- Language-agnostic value system for fusevm.
- vm
- The fusevm execution engine — stack-based bytecode dispatch loop.