Skip to main content

verify

Function verify 

Source
pub fn verify(chunk: &Chunk) -> Result<(), VerifyError>
Expand description

Verify structural invariants of chunk. See VerifyError for what is checked. This does not perform full dataflow/register-liveness verification (unlike, say, the JVM verifier) — v0 trades that off against implementation complexity, and instead the VM bounds-checks register indices at runtime (cheap: it’s an array index against a fixed small register file, not worth statically proving away yet).

Opcode::CallNative targets are deliberately not range-checked here: native functions live in a byteflow_vm::NativeTable supplied by the embedder at Vm construction time, entirely outside this crate’s (and this Chunk’s) knowledge. An out-of-range CallNative is instead caught at runtime as Fault::BadNative.