Struct wasmtime_runtime::SharedMemory
source · pub struct SharedMemory(_);
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_mut(&mut self) -> *mut VMMemoryDefinition
pub fn vmmemory_ptr_mut(&mut self) -> *mut VMMemoryDefinition
Return a mutable pointer to the shared memory’s VMMemoryDefinition.
sourcepub fn vmmemory_ptr(&self) -> *const VMMemoryDefinition
pub fn vmmemory_ptr(&self) -> *const VMMemoryDefinition
Return a pointer to the shared memory’s VMMemoryDefinition.
Trait Implementations§
source§fn clone(&self) -> SharedMemory
fn clone(&self) -> SharedMemory
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreProxy all calls through the RwLock
.
source§fn maximum_byte_size(&self) -> Option<usize>
fn maximum_byte_size(&self) -> Option<usize>
Returns the maximum number of bytes the memory can grow to.
Returns
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>
Grows a memory by
delta_pages
. Read moresource§fn grow_to(&mut self, size: usize) -> Result<()>
fn grow_to(&mut self, size: usize) -> Result<()>
Grow memory to the specified amount of bytes. Read more
source§fn vmmemory(&mut self) -> VMMemoryDefinition
fn vmmemory(&mut self) -> VMMemoryDefinition
Return a
VMMemoryDefinition
for exposing the memory to compiled wasm
code.source§fn needs_init(&self) -> bool
fn needs_init(&self) -> bool
Does this memory need initialization? It may not if it already
has initial contents courtesy of the
MemoryImage
passed to
RuntimeMemoryCreator::new_memory()
.source§fn as_any_mut(&mut self) -> &mut dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
For the pooling allocator, we must be able to downcast this trait to its
underlying structure.