#[repr(C)]pub struct VMExternRefActivationsTable { /* private fields */ }
Expand description
A table that over-approximizes the set of VMExternRef
s that any Wasm
activation on this thread is currently using.
Under the covers, this is a simple bump allocator that allows duplicate entries. Deduplication happens at GC time.
Implementations§
source§impl VMExternRefActivationsTable
impl VMExternRefActivationsTable
sourcepub fn bump_capacity_remaining(&self) -> usize
pub fn bump_capacity_remaining(&self) -> usize
Get the available capacity in the bump allocation chunk.
sourcepub fn try_insert(&mut self, externref: VMExternRef) -> Result<(), VMExternRef>
pub fn try_insert(&mut self, externref: VMExternRef) -> Result<(), VMExternRef>
Try and insert a VMExternRef
into this table.
This is a fast path that only succeeds when the bump chunk has the capacity for the requested insertion.
If the insertion fails, then the VMExternRef
is given back. Callers
may attempt a GC to free up space and try again, or may call
insert_slow_path
to infallibly insert the reference (potentially
allocating additional space in the table to hold it).
sourcepub unsafe fn insert_with_gc(
&mut self,
externref: VMExternRef,
module_info_lookup: &dyn ModuleInfoLookup
)
pub unsafe fn insert_with_gc(
&mut self,
externref: VMExternRef,
module_info_lookup: &dyn ModuleInfoLookup
)
Insert a reference into the table, falling back on a GC to clear up space if the table is already full.
Unsafety
The same as gc
.
sourcepub fn insert_without_gc(&mut self, externref: VMExternRef)
pub fn insert_without_gc(&mut self, externref: VMExternRef)
Insert a reference into the table, without ever performing GC.
sourcepub fn stack_canary(&self) -> Option<usize>
pub fn stack_canary(&self) -> Option<usize>
Fetches the current value of this table’s stack canary.
This should only be used in conjunction with setting the stack canary
below if the return value is None
typically. This is called from RAII
guards in wasmtime::func::invoke_wasm_and_catch_traps
.
For more information on canaries see the gc functions below.
sourcepub fn set_stack_canary(&mut self, canary: Option<usize>)
pub fn set_stack_canary(&mut self, canary: Option<usize>)
Sets the current value of the stack canary.
This is called from RAII guards in
wasmtime::func::invoke_wasm_and_catch_traps
. This is used to update
the stack canary to a concrete value and then reset it back to None
when wasm is finished.
For more information on canaries see the gc functions below.
sourcepub fn set_gc_okay(&mut self, okay: bool) -> bool
pub fn set_gc_okay(&mut self, okay: bool) -> bool
Set whether it is okay to GC or not right now.
This is provided as a helper for enabling various debug-only assertions
and checking places where the wasmtime-runtime
user expects there not
to be any GCs.