Skip to main content

Module decode

Module decode 

Source
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§

DecodedInst
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 DecodedInst array.