Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion piecrust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
20 changes: 6 additions & 14 deletions piecrust/src/store/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Expand Down Expand Up @@ -161,28 +161,20 @@ unsafe impl LinearMemory for Memory {
self.inner.current_len
}

fn maximum_byte_size(&self) -> Option<usize> {
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<usize> {
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
}
}
11 changes: 7 additions & 4 deletions piecrust/src/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -88,7 +91,7 @@ fn config() -> Config {
V128Store32Lane: BYTE16_STORE_COST,
V128Store64Lane: BYTE16_STORE_COST,

..Default::default()
..OperatorCost::new()
});

config
Expand Down