Skip to main content

Module replay

Module replay 

Source
Expand description

Dual-engine replay: run a Program through the interpreter and the x86 recompiler and compare. Gated to linux/x86_64 (the recompiler needs the Hyperlight host stack, so the whole javm-bench crate is gated to it).

Both engines are driven through the same javm-bench BuiltCapsinvoke_cached path, so they receive byte-identical caps/initial-state — any divergence is a real engine disagreement, never a setup skew.

Structs§

Diff
Both engines’ outcomes for one program.

Functions§

diff
Run prog through both engines (sharing one BuiltCaps) and compare.
diff_batch
Run a batch through diff, returning (index, Diff) for each diverging program. One long-lived sandbox handles the whole batch — no rebuilds (those were the source of host-heap corruption; a single sandbox runs thousands of distinct programs cleanly).
diff_image
Run a pre-built Image through both engines and compare.
image_for
Build the Image for a program: its code (body + signature epilogue) plus the appended ecalli 0 terminator, entered at pc 0 with the program’s initial register seed.
image_with_ro
Build an Image from raw instruction words (+ ecalli 0 terminator) with a pinned read-only data cap of ro_bytes mapped at ro_start — for category-#3 read-only-cluster differential tests. Both engines materialize it PinnedCapRo (interp perm-RO, recompiler MatRange) and charge it per 2 MiB cluster.
image_with_ro_caps
Build an Image from raw words with several pinned read-only data caps, each (start, bytes) — for multi-cap read-only-cluster differential tests (e.g. two distinct caps sharing one 2 MiB cluster). Each cap takes its own cnode slot, so the recompiler resolves each as a separate PinnedCapRo MatRange with its own source PA, exactly as production does.
replay_interp
Interpreter outcome for prog.
replay_recomp
Recompiler outcome for prog.
seed_reg
Convenience: seed register xreg (by x-number) to val in a slot-keyed init map. Mirrors the generator’s seeding; handy for hand-built programs.