Skip to main content

pack_rom_image

Function pack_rom_image 

Source
pub fn pack_rom_image(segments: &[DataSegment], last_wins: bool) -> Vec<u8> 
Expand description

Pack the #758 dense ROM init image: a [0, extent) blob with every active segment placed AT its linmem offset. last_wins = true applies them in declaration order (WASM instantiation semantics — later segments overwrite earlier on overlap); last_wins = false applies them in REVERSE order (first-wins — the synthetic miscompile the red-first gate toggles, phase 1’s resolve_owner pattern). The caller must have bound-checked image_extent against the linear-memory size (u32 + usize safe here only after that check).