A lightweight WebAssembly runtime that is fast, secure, and standards-compliant
Move `wasmtime-slab` crate into `wasmtime-core` (#12407)
Alex Crichtonab401d663cc5
diff --git a/Cargo.lock b/Cargo.lockindex a87a68ff44..db111d5880 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -4549,7 +4549,6 @@ dependencies = ["wasmtime-internal-fiber","wasmtime-internal-jit-debug","wasmtime-internal-jit-icache-coherence",- "wasmtime-internal-slab","wasmtime-internal-unwinder","wasmtime-internal-versioned-export-macros","wasmtime-internal-winch",@@ -4958,10 +4957,6 @@ dependencies = ["windows-sys 0.61.2",]-[[package]]-name = "wasmtime-internal-slab"-version = "42.0.0"-[[package]]name = "wasmtime-internal-unwinder"version = "42.0.0"diff --git a/Cargo.toml b/Cargo.tomlindex 1ae4258e11..679c0e3bdb 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -277,7 +277,6 @@ wasmtime-jit-debug = { path = "crates/jit-debug", version = "=42.0.0", package =wasmtime-component-util = { path = "crates/component-util", version = "=42.0.0", package = 'wasmtime-internal-component-util' }wasmtime-component-macro = { path = "crates/component-macro", version = "=42.0.0", package = 'wasmtime-internal-component-macro' }wasmtime-versioned-export-macros = { path = "crates/versioned-export-macros", version = "=42.0.0", package = 'wasmtime-internal-versioned-export-macros' }-wasmtime-slab = { path = "crates/slab", version = "=42.0.0", package = 'wasmtime-internal-slab' }wasmtime-jit-icache-coherence = { path = "crates/jit-icache-coherence", version = "=42.0.0", package = 'wasmtime-internal-jit-icache-coherence' }wasmtime-wit-bindgen = { path = "crates/wit-bindgen", version = "=42.0.0", package = 'wasmtime-internal-wit-bindgen' }wasmtime-unwinder = { path = "crates/unwinder", version = "=42.0.0", package = 'wasmtime-internal-unwinder' }diff --git a/crates/core/src/lib.rs b/crates/core/src/lib.rsindex 08ad1e8dfa..60cbb99344 100644--- a/crates/core/src/lib.rs+++ b/crates/core/src/lib.rs@@ -17,3 +17,4 @@ extern crate std;pub mod alloc;pub mod math;+pub mod slab;diff --git a/crates/slab/src/lib.rs b/crates/core/src/slab.rssimilarity index 98%rename from crates/slab/src/lib.rsrename to crates/core/src/slab.rsindex 8a9ce5071c..eba9848cc0 100644--- a/crates/slab/src/lib.rs+++ b/crates/core/src/slab.rs@@ -14,7 +14,7 @@//! # Example//!//! ```-//! use wasmtime_internal_slab::{Id, Slab};+//! use wasmtime_internal_core::slab::{Id, Slab};//!//! let mut slab = Slab::new();//!@@ -79,7 +79,7 @@//!//! ```rust//! pub struct GenerationalId {-//! id: wasmtime_internal_slab::Id,+//! id: wasmtime_internal_core::slab::Id,//! generation: u32,//! }//!@@ -89,7 +89,7 @@//! }//!//! pub struct GenerationalSlab<T> {-//! slab: wasmtime_internal_slab::Slab<GenerationalEntry<T>>,+//! slab: wasmtime_internal_core::slab::Slab<GenerationalEntry<T>>,//! generation: u32,//! }//!@@ -127,15 +127,9 @@//! }//! ```-#![no_std]-#![forbid(unsafe_code)]-#![deny(missing_docs, missing_debug_implementations)]--extern crate alloc;--use alloc::vec::Vec;use core::fmt;use core::num::NonZeroU32;+use std_alloc::vec::Vec;/// An identifier for an allocated value inside a `slab`.#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]diff --git a/crates/slab/Cargo.toml b/crates/slab/Cargo.tomldeleted file mode 100644index 0c0aeaf426..0000000000--- a/crates/slab/Cargo.toml+++ /dev/null@@ -1,14 +0,0 @@-[package]-authors = ["The Wasmtime Project Developers"]-description = "INTERNAL: Uni-typed slab with a free list for use in Wasmtime"-edition.workspace = true-rust-version.workspace = true-license = "Apache-2.0 WITH LLVM-exception"-name = "wasmtime-internal-slab"-repository = "https://github.com/bytecodealliance/wasmtime"-version.workspace = true--[lints]-workspace = true--[dependencies]diff --git a/crates/wasmtime/Cargo.toml b/crates/wasmtime/Cargo.tomlindex bc8faefbe7..37e37363ad 100644--- a/crates/wasmtime/Cargo.toml+++ b/crates/wasmtime/Cargo.toml@@ -27,7 +27,6 @@ wasmtime-unwinder = { workspace = true, optional = true }wasmtime-winch = { workspace = true, optional = true }wasmtime-component-macro = { workspace = true, optional = true }wasmtime-component-util = { workspace = true, optional = true }-wasmtime-slab = { workspace = true, optional = true }wasmtime-versioned-export-macros = { workspace = true }wasmtime-wmemcheck = { workspace = true, optional = true }wasmtime-core = { workspace = true }@@ -268,7 +267,6 @@ runtime = ["dep:smallvec","dep:mach2","dep:memfd",- "dep:wasmtime-slab","dep:wasmtime-versioned-export-macros","dep:windows-sys","pulley-interpreter/interp",@@ -343,6 +341,7 @@ addr2line = ["dep:addr2line", "dep:gimli", "std"]std = ['postcard/use-std','wasmtime-environ/std',+ 'wasmtime-core/std','object/std','once_cell','wasmtime-fiber?/std',diff --git a/crates/wasmtime/src/runtime/gc/enabled/rooting.rs b/crates/wasmtime/src/runtime/gc/enabled/rooting.rsindex 02f3c2757f..3f40d856e3 100644--- a/crates/wasmtime/src/runtime/gc/enabled/rooting.rs+++ b/crates/wasmtime/src/runtime/gc/enabled/rooting.rs@@ -177,7 +177,7 @@ use core::{hash::{Hash, Hasher},ops::{Deref, DerefMut},};-use wasmtime_slab::{Id as SlabId, Slab};+use wasmtime_core::slab::{Id as SlabId, Slab};mod sealed {use super::*;diff --git a/crates/wasmtime/src/runtime/type_registry.rs b/crates/wasmtime/src/runtime/type_registry.rsindex a0a2002334..8374c92600 100644--- a/crates/wasmtime/src/runtime/type_registry.rs+++ b/crates/wasmtime/src/runtime/type_registry.rs@@ -21,12 +21,12 @@ use core::{Ordering::{AcqRel, Acquire, Release},},};+use wasmtime_core::slab::{Id as SlabId, Slab};use wasmtime_environ::{EngineOrModuleTypeIndex, GcLayout, ModuleInternedTypeIndex, ModuleTypes, PrimaryMap,SecondaryMap, TypeTrace, VMSharedTypeIndex, WasmRecGroup, WasmSubType, iter_entity_range,packed_option::{PackedOption, ReservedValue},};-use wasmtime_slab::{Id as SlabId, Slab};// ### Notes on the Lifetime Management of Types//diff --git a/crates/wasmtime/src/runtime/vm/gc/func_ref.rs b/crates/wasmtime/src/runtime/vm/gc/func_ref.rsindex 5146dfdfaf..54c8163f99 100644--- a/crates/wasmtime/src/runtime/vm/gc/func_ref.rs+++ b/crates/wasmtime/src/runtime/vm/gc/func_ref.rs@@ -13,8 +13,8 @@ use crate::{type_registry::TypeRegistry,vm::{SendSyncPtr, VMFuncRef},};+use wasmtime_core::slab::{Id, Slab};use wasmtime_environ::VMSharedTypeIndex;-use wasmtime_slab::{Id, Slab};/// An identifier into the `FuncRefTable`.#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]diff --git a/crates/wasmtime/src/runtime/vm/gc/host_data.rs b/crates/wasmtime/src/runtime/vm/gc/host_data.rsindex 4d7044c488..835beb6043 100644--- a/crates/wasmtime/src/runtime/vm/gc/host_data.rs+++ b/crates/wasmtime/src/runtime/vm/gc/host_data.rs@@ -15,7 +15,7 @@use crate::prelude::*;use core::any::Any;-use wasmtime_slab::{Id, Slab};+use wasmtime_core::slab::{Id, Slab};/// Side table for each `externref`'s host data value.#[derive(Default)]diff --git a/scripts/publish.rs b/scripts/publish.rsindex 965609b79d..f44871fe80 100644--- a/scripts/publish.rs+++ b/scripts/publish.rs@@ -54,7 +54,6 @@ const CRATES_TO_PUBLISH: &[&str] = &["wiggle-macro",// wasmtime"wasmtime-internal-versioned-export-macros",- "wasmtime-internal-slab","wasmtime-internal-wit-bindgen","wasmtime-internal-component-macro","wasmtime-internal-jit-debug",diff --git a/supply-chain/config.toml b/supply-chain/config.tomlindex ccb2b85ddb..52a82f1a6c 100644--- a/supply-chain/config.toml+++ b/supply-chain/config.toml@@ -163,9 +163,6 @@ audit-as-crates-io = true[policy.wasmtime-internal-jit-icache-coherence]audit-as-crates-io = true-[policy.wasmtime-internal-slab]-audit-as-crates-io = true-[policy.wasmtime-internal-unwinder]audit-as-crates-io = truediff --git a/supply-chain/imports.lock b/supply-chain/imports.lockindex 0b60d6e173..64abe8c8be 100644--- a/supply-chain/imports.lock+++ b/supply-chain/imports.lock@@ -1338,11 +1338,6 @@ version = "40.0.1"when = "2026-01-07"trusted-publisher = "github:bytecodealliance/wasmtime"-[[publisher.wasmtime-internal-slab]]-version = "40.0.1"-when = "2026-01-07"-trusted-publisher = "github:bytecodealliance/wasmtime"-[[publisher.wasmtime-internal-unwinder]]version = "40.0.1"when = "2026-01-07"