Skip to content

A lightweight WebAssembly runtime that is fast, secure, and standards-compliant

Add missing `gc` feature gates (#12074)

primoly17060bb1b1fd
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 364a2fa940..6673f8b600 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -366,6 +366,8 @@ jobs:
-p wasmtime --no-default-features --features stack-switching
-p wasmtime --no-default-features --features cranelift,stack-switching
-p wasmtime --no-default-features --features runtime,stack-switching
+ -p wasmtime --no-default-features --features debug
+ -p wasmtime --no-default-features --features debug,gc
-p wasmtime --features incremental-cache
-p wasmtime --features profile-pulley
-p wasmtime --all-features
diff --git a/crates/wasmtime/src/runtime/module.rs b/crates/wasmtime/src/runtime/module.rs
index 30492b8b9e..f498eca796 100644
--- a/crates/wasmtime/src/runtime/module.rs
+++ b/crates/wasmtime/src/runtime/module.rs
@@ -1132,7 +1132,7 @@ impl Module {
/// Get the text offset (relative PC) for a given absolute PC in
/// this module.
- #[cfg(any(feature = "gc", feature = "debug"))]
+ #[cfg(feature = "gc")]
pub(crate) fn text_offset(&self, pc: usize) -> u32 {
u32::try_from(pc - self.inner.module.text().as_ptr() as usize).unwrap()
}
diff --git a/crates/wasmtime/src/runtime/vm/traphandlers.rs b/crates/wasmtime/src/runtime/vm/traphandlers.rs
index 353f8e6083..bb86206669 100644
--- a/crates/wasmtime/src/runtime/vm/traphandlers.rs
+++ b/crates/wasmtime/src/runtime/vm/traphandlers.rs
@@ -21,7 +21,7 @@ use crate::runtime::module::lookup_code;
use crate::runtime::store::{ExecutorRef, StoreOpaque};
use crate::runtime::vm::sys::traphandlers;
use crate::runtime::vm::{InterpreterRef, VMContext, VMStore, VMStoreContext, f32x4, f64x2, i8x16};
-#[cfg(feature = "debug")]
+#[cfg(all(feature = "debug", feature = "gc"))]
use crate::store::AsStoreOpaque;
use crate::{EntryStoreContext, prelude::*};
use crate::{StoreContextMut, WasmBacktrace};
@@ -830,6 +830,7 @@ impl CallThreadState {
#[cfg(feature = "debug")]
{
let result = match &unwind {
+ #[cfg(feature = "gc")]
UnwindState::UnwindToWasm(_) => {
assert!(store.as_store_opaque().has_pending_exception());
let exn = store
@@ -838,12 +839,11 @@ impl CallThreadState {
.expect("exception should be set when we are throwing");
store.block_on_debug_handler(crate::DebugEvent::CaughtExceptionThrown(exn))
}
-
+ #[cfg(feature = "gc")]
UnwindState::UnwindToHost {
reason: UnwindReason::Trap(TrapReason::Exception),
..
} => {
- use crate::store::AsStoreOpaque;
let exn = store
.as_store_opaque()
.pending_exception_owned_rooted()