diff --git a/crates/wasmtime/src/module.rs b/crates/wasmtime/src/module.rs index 011e7437fc..9abdcb1e10 100644 --- a/crates/wasmtime/src/module.rs +++ b/crates/wasmtime/src/module.rs @@ -332,14 +332,7 @@ impl Module { } }; - let module = CompiledModule::from_artifacts( - mmap, - info, - &*engine.config().profiler, - engine.unique_id_allocator(), - )?; - - Self::from_parts(engine, module, Arc::new(types)) + Self::from_parts(engine, mmap, info, Arc::new(types)) } /// Converts an input binary-encoded WebAssembly module to compilation @@ -498,9 +491,17 @@ impl Module { fn from_parts( engine: &Engine, - module: Arc, + mmap: MmapVec, + info: Option, types: Arc, ) -> Result { + let module = CompiledModule::from_artifacts( + mmap, + info, + &*engine.config().profiler, + engine.unique_id_allocator(), + )?; + // Validate the module can be used with the current allocator engine.allocator().validate(module.module())?; diff --git a/crates/wasmtime/src/module/serialization.rs b/crates/wasmtime/src/module/serialization.rs index 14985fd640..1feaa2d5ff 100644 --- a/crates/wasmtime/src/module/serialization.rs +++ b/crates/wasmtime/src/module/serialization.rs @@ -49,7 +49,7 @@ use std::path::Path; use std::str::FromStr; use std::sync::Arc; use wasmtime_environ::{FlagValue, Tunables, TypeTables}; -use wasmtime_jit::{subslice_range, CompiledModule, CompiledModuleInfo}; +use wasmtime_jit::{subslice_range, CompiledModuleInfo}; use wasmtime_runtime::MmapVec; const HEADER: &[u8] = b"\0wasmtime-aot"; @@ -206,14 +206,7 @@ impl<'a> SerializedModule<'a> { pub fn into_module(self, engine: &Engine) -> Result { let (mmap, info, types) = self.into_parts(engine)?; - let module = CompiledModule::from_artifacts( - mmap, - info, - &*engine.config().profiler, - engine.unique_id_allocator(), - )?; - - Module::from_parts(engine, module, Arc::new(types)) + Module::from_parts(engine, mmap, info, Arc::new(types)) } pub fn into_parts(