Merge branch 'wasix-core-changes' into wasix

This commit is contained in:
Christoph Herzog
2022-12-22 11:17:38 +01:00
14 changed files with 157 additions and 126 deletions

View File

@@ -54,7 +54,7 @@ impl VMMemory {
}
/// Copies this memory to a new memory
pub fn fork(&self) -> Result<VMMemory, wasmer_types::MemoryError> {
pub fn duplicate(&self) -> Result<VMMemory, wasmer_types::MemoryError> {
let new_memory = crate::Memory::new_internal(self.ty.clone())?;
#[cfg(feature = "tracing")]

View File

@@ -265,9 +265,9 @@ impl Memory {
}
/// Copies this memory to a new memory
pub fn fork(&mut self, store: &impl AsStoreRef) -> Result<VMMemory, MemoryError> {
pub fn duplicate(&mut self, store: &impl AsStoreRef) -> Result<VMMemory, MemoryError> {
let mem = self.handle.get(store.as_store_ref().objects());
mem.fork()
mem.duplicate()
}
}

View File

@@ -117,10 +117,12 @@ mod tests {
.unwrap()
}
}
fn try_clone(&self) -> Option<Box<dyn LinearMemory + 'static>> {
None
}
fn fork(&mut self) -> Result<Box<dyn LinearMemory + 'static>, MemoryError> {
fn duplicate(&mut self) -> Result<Box<dyn LinearMemory + 'static>, MemoryError> {
let mem = self.mem.clone();
Ok(Box::new(Self {
memory_definition: Some(UnsafeCell::new(VMMemoryDefinition {