diff --git a/Cargo.lock b/Cargo.lock index 32c3f8c6ffff..e7f6dd5fc44c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3736,6 +3736,12 @@ dependencies = [ "memchr", ] +[[package]] +name = "nonmax" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "610a5acd306ec67f907abe5567859a3c693fb9886eb1f012ab8f2a47bef3db51" + [[package]] name = "normalize-line-endings" version = "0.3.0" @@ -3842,6 +3848,16 @@ dependencies = [ "ruzstd 0.9.0", ] +[[package]] +name = "offset-allocator" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e234d535da3521eb95106f40f0b73483d80bfb3aacf27c40d7e2b72f1a3e00a2" +dependencies = [ + "log", + "nonmax", +] + [[package]] name = "once_cell" version = "1.21.4" @@ -7787,6 +7803,7 @@ dependencies = [ "anyhow", "cc", "enum-iterator", + "offset-allocator", "serde", "serde_json", "tar", diff --git a/lib/api/src/entities/memory/shared.rs b/lib/api/src/entities/memory/shared.rs index e577bf20451f..d7d19de63e2e 100644 --- a/lib/api/src/entities/memory/shared.rs +++ b/lib/api/src/entities/memory/shared.rs @@ -75,6 +75,17 @@ impl SharedMemory { } } + /// The backing VM shared-memory handle. + /// + /// Clones of the handle share the same underlying allocation, so an + /// embedder can keep a clone and operate on the memory (e.g. grow it via + /// [`LinearMemory::grow`]) from any thread without holding a store. + /// + /// [`LinearMemory::grow`]: wasmer_vm::LinearMemory::grow + pub fn vm_shared_memory(&self) -> &VMSharedMemory { + &self.memory + } + #[inline] fn shared_ops(&self) -> Result<&(dyn SharedMemoryOps + Send + Sync), AtomicsError> { self.ops diff --git a/lib/napi b/lib/napi index ed95533594ae..4db81bebba1c 160000 --- a/lib/napi +++ b/lib/napi @@ -1 +1 @@ -Subproject commit ed95533594ae334916d27740d57c984725862554 +Subproject commit 4db81bebba1c77a780cff59842d7eac8b99c5f72