diff --git a/crates/wasmtime/src/lib.rs b/crates/wasmtime/src/lib.rs index 197c2f3759ab..b12e16e7dba2 100644 --- a/crates/wasmtime/src/lib.rs +++ b/crates/wasmtime/src/lib.rs @@ -295,7 +295,6 @@ not(feature = "coredump"), not(feature = "runtime"), not(feature = "component-model"), - not(feature = "threads"), not(feature = "std"), ), allow(dead_code, unused_imports) diff --git a/crates/wasmtime/src/runtime/vm/memory.rs b/crates/wasmtime/src/runtime/vm/memory.rs index 5d4f595eec14..af70997ee7af 100644 --- a/crates/wasmtime/src/runtime/vm/memory.rs +++ b/crates/wasmtime/src/runtime/vm/memory.rs @@ -78,11 +78,13 @@ use crate::prelude::*; use crate::runtime::vm::vmcontext::VMMemoryDefinition; #[cfg(has_virtual_memory)] use crate::runtime::vm::{HostAlignedByteCount, MmapOffset}; -use crate::runtime::vm::{MemoryImage, MemoryImageSlot, SendSyncPtr, VMStore, WaitResult}; +use crate::runtime::vm::{MemoryImage, MemoryImageSlot, SendSyncPtr, VMStore}; use alloc::sync::Arc; -use core::time::Duration; use core::{ops::Range, ptr::NonNull}; -use wasmtime_environ::{Trap, Tunables}; +use wasmtime_environ::Tunables; + +#[cfg(feature = "threads")] +use wasmtime_environ::Trap; #[cfg(has_virtual_memory)] mod mmap; @@ -434,6 +436,7 @@ impl Memory { } /// Implementation of `memory.atomic.notify` for all memories. + #[cfg(feature = "threads")] pub fn atomic_notify(&mut self, addr: u64, count: u32) -> Result { match self.as_shared_memory() { Some(m) => m.atomic_notify(addr, count), @@ -445,12 +448,13 @@ impl Memory { } /// Implementation of `memory.atomic.wait32` for all memories. + #[cfg(feature = "threads")] pub fn atomic_wait32( &mut self, addr: u64, expected: u32, - timeout: Option, - ) -> Result { + timeout: Option, + ) -> Result { match self.as_shared_memory() { Some(m) => m.atomic_wait32(addr, expected, timeout), None => { @@ -461,12 +465,13 @@ impl Memory { } /// Implementation of `memory.atomic.wait64` for all memories. + #[cfg(feature = "threads")] pub fn atomic_wait64( &mut self, addr: u64, expected: u64, - timeout: Option, - ) -> Result { + timeout: Option, + ) -> Result { match self.as_shared_memory() { Some(m) => m.atomic_wait64(addr, expected, timeout), None => { @@ -736,6 +741,7 @@ impl LocalMemory { /// we are using static memories with virtual memory guard pages) this manual /// check is here so we don't segfault from Rust. For other configurations, /// these checks are required anyways. +#[cfg(feature = "threads")] pub fn validate_atomic_addr( def: &VMMemoryDefinition, addr: u64, diff --git a/crates/wasmtime/src/runtime/vm/memory/shared_memory_disabled.rs b/crates/wasmtime/src/runtime/vm/memory/shared_memory_disabled.rs index 936f4ad484a7..47f4789f3d44 100644 --- a/crates/wasmtime/src/runtime/vm/memory/shared_memory_disabled.rs +++ b/crates/wasmtime/src/runtime/vm/memory/shared_memory_disabled.rs @@ -6,7 +6,7 @@ use crate::runtime::vm::{VMMemoryDefinition, VMStore, WaitResult}; use core::ops::Range; use core::ptr::NonNull; use core::time::Duration; -use wasmtime_environ::{Trap, Tunables}; +use wasmtime_environ::Trap; #[derive(Clone)] pub enum SharedMemory {} @@ -66,14 +66,6 @@ impl SharedMemory { match *self {} } - pub(crate) fn grow_to(&mut self, _size: usize) -> Result<()> { - match *self {} - } - - pub(crate) fn vmmemory(&mut self) -> VMMemoryDefinition { - match *self {} - } - pub(crate) fn needs_init(&self) -> bool { match *self {} }