pub fn compute_body_hash(
arity: u16,
locals_count: u16,
code: &[Op],
record_shapes: &[Vec<u32>],
) -> BodyHashExpand description
Hash a function body so that two structurally-identical bodies — the
fn(x) -> x + 1 literal repeated at two source locations, two flow
trampolines built from the same shape, etc. — yield the same hash.
Inputs: the bytecode Op sequence, the arity, the locals count.
Capture types are intentionally not hashed: capture values already
participate in Value::Closure’s equality through the captures
field, so two closures with different capture values already compare
non-equal regardless of the hash. Capture types without values
don’t add equality information that captures don’t already provide
(a value of type Int and a value of type Str can’t both be 42).
Constants pool indices referenced from the body are not resolved
before hashing — within a single compile the pool is shared, so two
equivalent literals produce identical Op sequences. Cross-compile
canonicality is deliberately out of scope (#222).