#[repr(C)]pub struct Slot {
pub start: *mut c_void,
pub heap: *mut c_void,
pub stack: *mut c_void,
pub globals: *mut c_void,
pub sigstack: *mut c_void,
pub limits: Limits,
pub region: Weak<dyn RegionInternal>,
}Expand description
A set of pointers into virtual memory that can be allocated into an Alloc.
The 'r lifetime parameter represents the lifetime of the region that backs this virtual
address space.
The memory layout in a Slot is meant to be reused in order to reduce overhead on region
implementations. To back the layout with real memory, use Region::allocate_runtime.
To ensure a Slot can only be backed by one allocation at a time, it contains a mutex, but
otherwise can be freely copied.
Fields§
§start: *mut c_voidThe beginning of the contiguous virtual memory chunk managed by this Alloc.
The first part of this memory, pointed to by start, is always backed by real memory, and
is used to store the lucet_instance structure.
heap: *mut c_voidThe next part of memory contains the heap and its guard pages.
The heap is backed by real memory according to the HeapSpec. Guard pages trigger a sigsegv
when accessed.
stack: *mut c_voidThe stack comes after the heap.
Because the stack grows downwards, we get the added safety of ensuring that stack overflows
go into the guard pages, if the Limits specify guard pages. The stack is always the size
given by Limits.stack_pages.
globals: *mut c_voidThe WebAssembly Globals follow the stack and a single guard page.
sigstack: *mut c_voidThe signal handler stack follows the globals.
Having a separate signal handler stack allows the signal handler to run in situations where the normal stack has grown into the guard page.
limits: LimitsLimits of the memory.
Should not change through the lifetime of the Alloc.
region: Weak<dyn RegionInternal>