Skip to content

Commit 180fa34

Browse files
committed
Clean build with gc disabled (cargo check -p wasmtime --no-default-features --features runtime).
1 parent bec5a77 commit 180fa34

File tree

7 files changed

+81
-4
lines changed

7 files changed

+81
-4
lines changed

crates/environ/src/gc/drc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,6 @@ impl GcTypeLayouts for DrcTypeLayouts {
3838
}
3939

4040
fn exn_layout(&self, ty: &WasmExnType) -> GcExceptionLayout {
41-
common_exn_layout(ty, HEADER_SIZE, HEADER_ALIGN)
41+
common_exn_layout(ty, HEADER_SIZE, HEADER_ALIGN)
4242
}
4343
}

crates/wasmtime/src/runtime/externals/tag.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
use crate::Result;
22
use crate::runtime::types::TagType;
3-
use crate::store::InstanceId;
43
use crate::trampoline::generate_tag_export;
54
use crate::{
65
AsContext, AsContextMut,
76
store::{StoreInstanceId, StoreOpaque},
87
};
98
use wasmtime_environ::{DefinedTagIndex, VMSharedTypeIndex};
109

10+
#[cfg(feature = "gc")]
11+
use crate::store::InstanceId;
12+
1113
/// A WebAssembly `tag`.
1214
#[derive(Copy, Clone, Debug)]
1315
#[repr(C)] // here for the C API in the future
@@ -121,6 +123,7 @@ impl Tag {
121123
/// used to "serialize" the tag as safe (tamper-proof,
122124
/// bounds-checked) values, e.g. within the GC store for an
123125
/// exception object.
126+
#[cfg(feature = "gc")]
124127
pub(crate) fn to_raw_indices(&self) -> (InstanceId, DefinedTagIndex) {
125128
(self.instance.instance(), self.index)
126129
}
@@ -131,6 +134,7 @@ impl Tag {
131134
/// # Panics
132135
///
133136
/// Panics if the indices are out-of-bounds in the given store.
137+
#[cfg(feature = "gc")]
134138
pub(crate) fn from_raw_indices(
135139
store: &StoreOpaque,
136140
instance: InstanceId,

crates/wasmtime/src/runtime/gc/disabled.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
mod anyref;
1212
mod arrayref;
1313
mod eqref;
14+
mod exnref;
1415
mod externref;
1516
mod i31;
1617
mod rooting;
@@ -19,6 +20,7 @@ mod structref;
1920
pub use anyref::*;
2021
pub use arrayref::*;
2122
pub use eqref::*;
23+
pub use exnref::*;
2224
pub use externref::*;
2325
pub use i31::*;
2426
pub use rooting::*;
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
//! `exnref` implementation stubs when GC is disabled.
2+
3+
use crate::{
4+
AsContext, AsContextMut, ExnType, GcRefImpl, HeapType, Result, Rooted, Tag, Val,
5+
store::{AutoAssertNoGc, StoreContextMut, StoreOpaque},
6+
};
7+
8+
/// Support for `ExnRefPre` disabled at compile time because the `gc`
9+
/// cargo feature was not enabled.
10+
pub enum ExnRefPre {}
11+
12+
/// Support for `exnref` disabled at compile time because the `gc`
13+
/// cargo feature was not enabled.
14+
pub enum ExnRef {}
15+
16+
impl GcRefImpl for ExnRef {}
17+
18+
impl ExnRef {
19+
pub unsafe fn from_raw(_store: impl AsContextMut, _raw: u32) -> Option<Rooted<Self>> {
20+
None
21+
}
22+
23+
pub(crate) fn _from_raw(_store: &mut AutoAssertNoGc, _raw: u32) -> Option<Rooted<Self>> {
24+
None
25+
}
26+
27+
pub unsafe fn to_raw(&self, _store: impl AsContextMut) -> Result<u32> {
28+
Ok(0)
29+
}
30+
31+
pub(crate) unsafe fn _to_raw(&self, _store: &mut AutoAssertNoGc<'_>) -> Result<u32> {
32+
Ok(0)
33+
}
34+
35+
pub fn ty(&self, _store: impl AsContext) -> Result<ExnType> {
36+
match *self {}
37+
}
38+
39+
pub(crate) fn _ty(&self, _store: &StoreOpaque) -> Result<ExnType> {
40+
match *self {}
41+
}
42+
43+
pub fn matches_ty(&self, _store: impl AsContext, _ty: &HeapType) -> Result<bool> {
44+
match *self {}
45+
}
46+
47+
pub(crate) fn _matches_ty(&self, _store: &StoreOpaque, _ty: &HeapType) -> Result<bool> {
48+
match *self {}
49+
}
50+
51+
pub fn tag(&self, _store: impl AsContextMut) -> Result<Tag> {
52+
match *self {}
53+
}
54+
55+
pub fn fields<'a, T: 'static>(
56+
&self,
57+
_store: impl Into<StoreContextMut<'a, T>>,
58+
) -> Result<impl ExactSizeIterator<Item = Val> + 'a + '_> {
59+
match *self {}
60+
Ok([].into_iter())
61+
}
62+
63+
pub fn field(&self, _store: impl AsContextMut, _index: usize) -> Result<Val> {
64+
match *self {}
65+
}
66+
67+
pub fn set_field(&self, _store: impl AsContextMut, _index: usize, _value: Val) -> Result<()> {
68+
match *self {}
69+
}
70+
}

crates/wasmtime/src/runtime/instance.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,7 @@ impl Instance {
536536
self.get_export(store, name)?.into_tag()
537537
}
538538

539+
#[cfg(feature = "gc")]
539540
pub(crate) fn id(&self) -> InstanceId {
540541
self.id.instance()
541542
}

crates/wasmtime/src/runtime/types.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2930,7 +2930,6 @@ impl ExnType {
29302930
self.type_index() == other.type_index()
29312931
}
29322932

2933-
#[cfg(feature = "gc")]
29342933
pub(crate) fn registered_type(&self) -> &RegisteredType {
29352934
&self.registered_type
29362935
}

crates/wasmtime/src/runtime/vm/gc/enabled/null.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ use crate::{
1717
use core::ptr::NonNull;
1818
use core::{alloc::Layout, any::Any, num::NonZeroU32};
1919
use wasmtime_environ::{
20-
null::NullTypeLayouts, GcArrayLayout, GcExceptionLayout, GcStructLayout, GcTypeLayouts, VMGcKind, VMSharedTypeIndex
20+
GcArrayLayout, GcExceptionLayout, GcStructLayout, GcTypeLayouts, VMGcKind, VMSharedTypeIndex,
21+
null::NullTypeLayouts,
2122
};
2223

2324
/// The null collector.

0 commit comments

Comments
 (0)