pub struct Image {
pub code: Vec<u8>,
pub packed_bitmask: Vec<u8>,
pub jump_table: Vec<u32>,
pub endpoints: BTreeMap<u8, EndpointDef>,
pub memory_mappings: Vec<MemoryMapping>,
pub gas_slots: Vec<SlotIdx>,
pub quota_slots: Vec<SlotIdx>,
pub pinned_slots: BTreeMap<SlotIdx, PinnedCap>,
pub initial_slots: BTreeMap<SlotIdx, InitialDataCap>,
pub yield_marker_slot: Option<SlotIdx>,
}Expand description
Image: the program spec (code, endpoints, memory layout, slot declarations, pinned ro caps).
pinned_slots and yield_marker_slot reference cnode slots; the
kernel installs declared pinned content into the Instance’s cnode
at set_image / host_derive_spawn time and treats them as
read-only thereafter.
Fields§
§code: Vec<u8>Bytecode bytes (validated at construction; see host_make_image).
packed_bitmask: Vec<u8>Packed bitmask, one bit per code byte, LSB-first.
packed_bitmask.len() == code.len().div_ceil(8). A 1 bit
marks the start of an instruction; a 0 bit marks a
continuation byte. Use javm_exec::unpack_bitmask to
recover the unpacked form at decode time.
jump_table: Vec<u32>Jump-table entries (PVM PCs into code). Indexed by
djump immediates.
endpoints: BTreeMap<u8, EndpointDef>Endpoints addressable by endpoint_idx (u8). Sparse — only
declared endpoints are present.
memory_mappings: Vec<MemoryMapping>Memory layout. Each entry maps a Cap::Data (resolved
through source) into the address space at `[start, start
- size)
. Permissions are derived from whether the target slot appears inpinned_slots` (RO) or not (RW).
gas_slots: Vec<SlotIdx>Cnode slots holding Cap::Instance[Gas{meter_id}]. Active
gas debit comes from the first slot’s meter; the rest are
fallback reserves (chain-spec policy).
quota_slots: Vec<SlotIdx>Cnode slots holding Cap::Instance[Quota{quota_id}].
Symmetric with gas_slots.
pinned_slots: BTreeMap<SlotIdx, PinnedCap>Pinned read-only caps (Cap::Data or Cap::Image) baked into the spec. The kernel rejects mutations to these slots.
initial_slots: BTreeMap<SlotIdx, InitialDataCap>Initial cnode state for non-pinned mutable slots. Only honored at standalone (root) Instance bootstrap — a parented Instance receives its cnode from the spawner.
yield_marker_slot: Option<SlotIdx>Slot holding Cap::Instance[YieldCatcher], if this Instance
catches yields. None = no catcher.
Implementations§
Trait Implementations§
Source§impl Decode for Image
impl Decode for Image
Source§fn is_ssz_fixed_len() -> bool
fn is_ssz_fixed_len() -> bool
true iff this type is fixed-length.Source§fn ssz_fixed_len() -> usize
fn ssz_fixed_len() -> usize
BYTES_PER_LENGTH_OFFSET.Source§fn from_ssz_bytes(bytes: &[u8]) -> Result<Self, DecodeError>
fn from_ssz_bytes(bytes: &[u8]) -> Result<Self, DecodeError>
bytes, rejecting trailing input.Source§impl Encode for Image
impl Encode for Image
Source§fn is_ssz_fixed_len() -> bool
fn is_ssz_fixed_len() -> bool
true iff this type is fixed-length (no variable-length fields).Source§fn ssz_fixed_len() -> usize
fn ssz_fixed_len() -> usize
BYTES_PER_LENGTH_OFFSET (i.e. the size of the offset slot).Source§fn ssz_bytes_len(&self) -> usize
fn ssz_bytes_len(&self) -> usize
self when serialized.Source§fn ssz_append(&self, buf: &mut Vec<u8>)
fn ssz_append(&self, buf: &mut Vec<u8>)
self to buf.Source§fn is_basic_type() -> bool
fn is_basic_type() -> bool
true for “basic” SSZ types (uintN, bool), which pack adjacent
elements into shared 32-byte chunks for merkleization. Composite
types (containers, lists, structs) return false (the default).Source§impl HashTreeRoot for Image
impl HashTreeRoot for Image
impl Eq for Image
impl StructuralPartialEq for Image
Auto Trait Implementations§
impl Freeze for Image
impl RefUnwindSafe for Image
impl Send for Image
impl Sync for Image
impl Unpin for Image
impl UnsafeUnpin for Image
impl UnwindSafe for Image
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.