Expand description
PVM bytecode predecoding.
Cherry-picked from v2 javm/src/interpreter/mod.rs (the predecode
pass — basic-block / gas-block detection, per-block gas costs,
flattened DecodedInst array, pc_to_idx map). No cap awareness.
Entry point: predecode takes a PvmProgram and returns a
Predecoded bundle that the interpreter (and recompiler) execute
against. The expensive one-time work (gas-block computation,
per-instruction predecoding, target resolution) is done here so the
hot loop in interp is branch-light.
Structs§
- Decoded
Inst - Pre-decoded instruction for the fast interpreter / JIT path.
- Predecoded
- Bundle of predecoded state shared by interp / JIT.
Functions§
- compute_
basic_ block_ starts - compute_
basic_ block_ starts_ with_ skips - compute_
block_ gas_ costs - Compute gas cost per basic block using
GasSimulator. Indexed by PC; only basic-block-start entries are meaningful. - compute_
gas_ block_ starts - Compute gas block starts per the JAM spec:
{PC=0} ∪ {post-terminator PCs}. - predecode
- Predecode a program: compute block starts, gas costs, and flat
DecodedInstarray.