silk.concurrency.execution_storage.
Storage for the private execution frames that the compiler makes.
When to use#
The compiler and the runtime use this module through its C exports. Application code does not call it.
Details#
Each ExecutionStorage state owns its limit, its accounting and its reservations. There is no
shared counter and no environment lookup. Allocation and release use the declared allocator of
the selected target.
Errors#
ExecutionStorage.make fails with OutOfMemoryError. ExecutionStorage.acquire returns
null when a frame does not fit in the limit or cannot be allocated.
Gotchas#
Raw frame access is unsafe. A frame is valid only until it is released or its state is destroyed.
One state needs exclusive use. Independent states can use a concurrent host allocator.
Import as ExecutionStorage with import silk.concurrency.execution_storage { ExecutionStorage }.
Public declarations: 1.
ExecutionStorage#
pub struct ExecutionStorageAn affine state that owns its private-frame reservations and capacity limit.
Implementation Drop for ExecutionStorage#
impl Drop for ExecutionStorageOperation drop#
fn drop(self: &mut ExecutionStorage) -> ()Implementation ExecutionStorage#
impl ExecutionStorageAssociated function make#
pub effect fn make(limit: usize) -> ExecutionStorage ! OutOfMemoryErrorCreates an independent state whose frame reservations can charge at most limit bytes.
Details#
Charges include each reservation header and alignment padding. The fixed state allocation is excluded. Refusal acquires no state and reports OutOfMemoryError.
Method used#
pub fn used(self: &ExecutionStorage) -> usizeReturns the bytes charged to this state's current frame reservations.
Method acquire#
pub unsafe fn acquire(self: &mut ExecutionStorage, size: usize, alignment: usize) -> ?*mut u8Acquires a fixed-address frame or returns null without retaining a partial reservation.
Gotchas#
The caller must initialize bytes before reading, obey the requested extent, and stop using the pointer before release or state destruction. A zero size or invalid alignment returns null.
Method release#
pub unsafe fn release(self: &mut ExecutionStorage, frame: ?*mut u8) -> ()Releases one frame acquired from this state and removes its charge.
Gotchas#
The caller must finish semantic cleanup and stop every access before releasing the frame.
Category: Concurrency.
Profiles: aarch64-apple-darwin, aarch64-unknown-linux-gnu, x86_64-unknown-linux-gnu, wasm32-unknown-unknown, wasm32-wasip1, wasm32-wasip2.