xqvm-0.2.1 has been yanked.
X-Quadratic Virtual Machine — bytecode types and interpreter.
This crate contains two layers:
- Bytecode (
xqvm::bytecode) — opcode table, instruction codec, [InstructionBuilder], and [Program].no_std + alloc-compatible. - Interpreter — [
Vm], [Error], [RegVal], and supporting types. Theno_stdcore is always compiled;std-only additions (tracers, [RuntimeDiagnostic], [Disassembly]) are gated on thestdfeature.
| Item | Description |
|---|---|
[opcodes!] |
X-macro — the single source of truth for the opcode table |
[Opcode] |
#[repr(u8)] enum |
[Instruction] |
Fully decoded instruction with operands |
[Register] |
8-bit register slot operand |
[Program] |
Complete program: raw instruction bytes + jump table |
[InstructionBuilder] |
Fluent bytecode assembler |
[InstructionStream] |
Incremental seekable reader |
[bytecode::codec] |
[bytecode::codec::encode] / decode — wire format |
[bytecode::error] |
Bytecode-layer error types |
[Vm] |
The interpreter — stack, registers, loop stack |
[Error] |
Runtime fault variants |
[XqmxModel] |
QUBO/Ising/discrete optimization model |
[RegVal] |
Register value type |
Quick start
use ;
let mut b = new;
b.emit_push.emit_push.emit_add.emit_halt;
let program = b.build.unwrap;
let mut vm = new;
vm.run.unwrap;
assert_eq!;