MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / set_store

Method set_store

crates/wasmtime/src/runtime/vm/instance.rs:557–576  ·  view source on GitHub ↗
(mut self: Pin<&mut Self>, store: &StoreOpaque)

Source from the content-addressed store, hash-verified

555 }
556
557 pub(crate) unsafe fn set_store(mut self: Pin<&mut Self>, store: &StoreOpaque) {
558 // FIXME: should be more targeted ideally with the `unsafe` than just
559 // throwing this entire function in a large `unsafe` block.
560 unsafe {
561 *self.as_mut().store_mut() = Some(VMStoreRawPtr(store.traitobj()));
562 self.vm_store_context()
563 .write(Some(store.vm_store_context_ptr().into()));
564 #[cfg(target_has_atomic = "64")]
565 {
566 *self.as_mut().epoch_ptr() =
567 Some(NonNull::from(store.engine().epoch_counter()).into());
568 }
569
570 if self.env_module().needs_gc_heap {
571 self.as_mut().set_gc_heap(Some(store.unwrap_gc_store()));
572 } else {
573 self.as_mut().set_gc_heap(None);
574 }
575 }
576 }
577
578 unsafe fn set_gc_heap(self: Pin<&mut Self>, gc_store: Option<&GcStore>) {
579 if let Some(gc_store) = gc_store {

Callers 1

initialize_vmctxMethod · 0.80

Calls 14

VMStoreRawPtrClass · 0.85
fromFunction · 0.85
store_mutMethod · 0.80
traitobjMethod · 0.80
vm_store_context_ptrMethod · 0.80
epoch_counterMethod · 0.80
set_gc_heapMethod · 0.80
unwrap_gc_storeMethod · 0.80
as_mutMethod · 0.45
writeMethod · 0.45
vm_store_contextMethod · 0.45
epoch_ptrMethod · 0.45

Tested by

no test coverage detected