Skip to main content

image_from_blob

Function image_from_blob 

Source
pub fn image_from_blob(program: &ProgramBlob) -> Image
Expand description

Wrap a personality-free [ProgramBlob] in the JAVM cap shape.

Each data region becomes one Cap::Data at its conventional cnode slot — pinned_data for the read-only region, initial_data for the rest — plus a declarative MemoryMapping pointing at that slot. Endpoints are re-keyed by [Key], and the bare-Frame yield-receiver slot is set.

This is a pure shape transform: page splitting, all-zero-page elision and content-dedup into the shared arena happen inside [ImageBuilder::build].

Ordering is load-bearing. ImageBuilder packs the arena in insertion order, so regions must be added in [nub_program::Regions::iter] order (stack, ro, rw, heap) and the code last, or the emitted bytes shift.