diff --git a/piecrust/Cargo.toml b/piecrust/Cargo.toml index 6110adf8..fe97e95a 100644 --- a/piecrust/Cargo.toml +++ b/piecrust/Cargo.toml @@ -16,7 +16,7 @@ license = "MPL-2.0" crumbles = { version = "0.3", path = "../crumbles" } piecrust-uplink = { version = "0.19.0-rc.0", path = "../piecrust-uplink" } -dusk-wasmtime = { version = "21.0.0-alpha", default-features = false, features = ["cranelift", "runtime", "parallel-compilation"] } +dusk-wasmtime = { version = "33.0.2", git = "https://github.com/dusk-network/wasmtime", branch = "33-alpha-2", default-features = false, features = ["cranelift", "runtime", "parallel-compilation"] } bytecheck = "0.6" rkyv = { version = "0.7", features = ["size_32", "validation"] } blake3 = "1" @@ -28,6 +28,7 @@ hex = "0.4" dusk-merkle = { version = "0.5", features = ["rkyv-impl"] } const-decoder = "0.3" tracing = "0.1.40" +indexmap = "=2.11.4" [dev-dependencies] once_cell = "1.18" diff --git a/piecrust/src/store/memory.rs b/piecrust/src/store/memory.rs index abe63b9c..f219cd9c 100644 --- a/piecrust/src/store/memory.rs +++ b/piecrust/src/store/memory.rs @@ -8,7 +8,7 @@ use std::sync::atomic::Ordering; use std::{ fmt::{Debug, Formatter}, io, - ops::{Deref, DerefMut, Range}, + ops::{Deref, DerefMut}, sync::atomic::AtomicUsize, }; @@ -161,28 +161,20 @@ unsafe impl LinearMemory for Memory { self.inner.current_len } - fn maximum_byte_size(&self) -> Option { - Some(self.inner.len()) - } - fn grow_to(&mut self, new_size: usize) -> Result<(), dusk_wasmtime::Error> { self.inner.current_len = new_size; Ok(()) } - fn needs_init(&self) -> bool { - self.is_new - } - fn as_ptr(&self) -> *mut u8 { self.inner.as_ptr() as _ } - fn wasm_accessible(&self) -> Range { - let begin = self.inner.mmap.as_ptr() as _; - let len = self.inner.current_len; - let end = begin + len; + fn byte_capacity(&self) -> usize { + self.inner.len() + } - begin..end + fn needs_init(&self) -> bool { + self.is_new } } diff --git a/piecrust/src/vm.rs b/piecrust/src/vm.rs index 385aae8c..e978a581 100644 --- a/piecrust/src/vm.rs +++ b/piecrust/src/vm.rs @@ -44,9 +44,12 @@ fn config() -> Config { // Host memory creator is set in the session. // config.with_host_memory() - config.static_memory_forced(true); - config.static_memory_guard_size(0); - config.dynamic_memory_guard_size(0); + // This setting doesn't exist anymore. + // Changed here: https://github.com/bytecodealliance/wasmtime/pull/9545 + //config.static_memory_forced(true); change to memory_may_move + config.memory_may_move(false); + + config.memory_guard_size(0); config.guard_before_linear_memory(false); config.memory_init_cow(false); @@ -88,7 +91,7 @@ fn config() -> Config { V128Store32Lane: BYTE16_STORE_COST, V128Store64Lane: BYTE16_STORE_COST, - ..Default::default() + ..OperatorCost::new() }); config