diff --git a/crates/runtime/src/instance.rs b/crates/runtime/src/instance.rs index cdb892842f..396d60f9ad 100644 --- a/crates/runtime/src/instance.rs +++ b/crates/runtime/src/instance.rs @@ -24,7 +24,7 @@ use std::ptr::NonNull; use std::rc::Rc; use std::sync::Arc; use std::{mem, ptr, slice}; -use wasmtime_environ::entity::{packed_option::ReservedValue, BoxedSlice, EntityRef, EntitySet}; +use wasmtime_environ::entity::{packed_option::ReservedValue, EntityRef, EntitySet, PrimaryMap}; use wasmtime_environ::wasm::{ DataIndex, DefinedGlobalIndex, DefinedMemoryIndex, DefinedTableIndex, ElemIndex, EntityIndex, FuncIndex, GlobalIndex, MemoryIndex, TableElementType, TableIndex, @@ -51,10 +51,10 @@ pub(crate) struct Instance { offsets: VMOffsets, /// WebAssembly linear memory data. - memories: BoxedSlice>, + memories: PrimaryMap>, /// WebAssembly table data. - tables: BoxedSlice, + tables: PrimaryMap, /// Stores the dropped passive element segments in this instantiation by index. /// If the index is present in the set, the segment has been dropped. diff --git a/crates/runtime/src/instance/allocator.rs b/crates/runtime/src/instance/allocator.rs index ba00aedaf9..590b532cae 100644 --- a/crates/runtime/src/instance/allocator.rs +++ b/crates/runtime/src/instance/allocator.rs @@ -17,9 +17,7 @@ use std::ptr::{self, NonNull}; use std::slice; use std::sync::Arc; use thiserror::Error; -use wasmtime_environ::entity::{ - packed_option::ReservedValue, BoxedSlice, EntityRef, EntitySet, PrimaryMap, -}; +use wasmtime_environ::entity::{packed_option::ReservedValue, EntityRef, EntitySet, PrimaryMap}; use wasmtime_environ::wasm::{ DefinedFuncIndex, DefinedMemoryIndex, DefinedTableIndex, FuncIndex, GlobalInit, SignatureIndex, TableElementType, WasmType, @@ -285,20 +283,20 @@ impl OnDemandInstanceAllocator { Self { mem_creator } } - fn create_tables(module: &Module) -> BoxedSlice { + fn create_tables(module: &Module) -> PrimaryMap { let num_imports = module.num_imported_tables; let mut tables: PrimaryMap = PrimaryMap::with_capacity(module.table_plans.len() - num_imports); for table in &module.table_plans.values().as_slice()[num_imports..] { tables.push(Table::new_dynamic(table)); } - tables.into_boxed_slice() + tables } fn create_memories( &self, module: &Module, - ) -> Result>, InstantiationError> + ) -> Result>, InstantiationError> { let creator = self .mem_creator @@ -314,7 +312,7 @@ impl OnDemandInstanceAllocator { .map_err(InstantiationError::Resource)?, ); } - Ok(memories.into_boxed_slice()) + Ok(memories) } fn check_table_init_bounds(instance: &Instance) -> Result<(), InstantiationError> {