Struct wasmtime_runtime::SharedMemory
source · pub struct SharedMemory(/* private fields */);
Expand description
For shared memory (and only for shared memory), this lock-version restricts
access when growing the memory or checking its size. This is to conform with
the thread proposal: “When IsSharedArrayBuffer(...)
is true, the return
value should be the result of an atomic read-modify-write of the new size to
the internal length
slot.”
Implementations§
sourcepub fn new(plan: MemoryPlan) -> Result<Self>
pub fn new(plan: MemoryPlan) -> Result<Self>
Construct a new SharedMemory
.
sourcepub fn wrap(
plan: &MemoryPlan,
memory: Box<dyn RuntimeLinearMemory>,
ty: Memory
) -> Result<Self>
pub fn wrap( plan: &MemoryPlan, memory: Box<dyn RuntimeLinearMemory>, ty: Memory ) -> Result<Self>
Wrap an existing Memory with the locking provided by a SharedMemory.
sourcepub fn ty(&self) -> Memory
pub fn ty(&self) -> Memory
Return the memory type for this SharedMemory
.
sourcepub fn vmmemory_ptr(&self) -> *const VMMemoryDefinition
pub fn vmmemory_ptr(&self) -> *const VMMemoryDefinition
Return a pointer to the shared memory’s VMMemoryDefinition.
sourcepub fn grow(
&self,
delta_pages: u64,
store: Option<&mut dyn Store>
) -> Result<Option<(usize, usize)>, Error>
pub fn grow( &self, delta_pages: u64, store: Option<&mut dyn Store> ) -> Result<Option<(usize, usize)>, Error>
Same as RuntimeLinearMemory::grow
, except with &self
.
sourcepub fn atomic_notify(&self, addr_index: u64, count: u32) -> Result<u32, Trap>
pub fn atomic_notify(&self, addr_index: u64, count: u32) -> Result<u32, Trap>
Implementation of memory.atomic.notify
for this shared memory.
sourcepub fn atomic_wait32(
&self,
addr_index: u64,
expected: u32,
timeout: Option<Instant>
) -> Result<WaitResult, Trap>
pub fn atomic_wait32( &self, addr_index: u64, expected: u32, timeout: Option<Instant> ) -> Result<WaitResult, Trap>
Implementation of memory.atomic.wait32
for this shared memory.
sourcepub fn atomic_wait64(
&self,
addr_index: u64,
expected: u64,
timeout: Option<Instant>
) -> Result<WaitResult, Trap>
pub fn atomic_wait64( &self, addr_index: u64, expected: u64, timeout: Option<Instant> ) -> Result<WaitResult, Trap>
Implementation of memory.atomic.wait64
for this shared memory.
Trait Implementations§
source§fn clone(&self) -> SharedMemory
fn clone(&self) -> SharedMemory
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreProxy all calls through the RwLock
.
source§fn maximum_byte_size(&self) -> Option<usize>
fn maximum_byte_size(&self) -> Option<usize>
None
if the memory is unbounded.source§fn grow(
&mut self,
delta_pages: u64,
store: Option<&mut dyn Store>
) -> Result<Option<(usize, usize)>, Error>
fn grow( &mut self, delta_pages: u64, store: Option<&mut dyn Store> ) -> Result<Option<(usize, usize)>, Error>
delta_pages
. Read moresource§fn grow_to(&mut self, size: usize) -> Result<()>
fn grow_to(&mut self, size: usize) -> Result<()>
source§fn vmmemory(&mut self) -> VMMemoryDefinition
fn vmmemory(&mut self) -> VMMemoryDefinition
VMMemoryDefinition
for exposing the memory to compiled wasm
code.source§fn needs_init(&self) -> bool
fn needs_init(&self) -> bool
MemoryImage
passed to
RuntimeMemoryCreator::new_memory()
.