diff --git a/lib/compiler/src/artifact_builders/artifact_builder.rs b/lib/compiler/src/artifact_builders/artifact_builder.rs index 69e68ac1bc5..e95061fb29b 100644 --- a/lib/compiler/src/artifact_builders/artifact_builder.rs +++ b/lib/compiler/src/artifact_builders/artifact_builder.rs @@ -43,7 +43,6 @@ impl ArtifactBuild { target: &Target, memory_styles: PrimaryMap, table_styles: PrimaryMap, - module_start: Option, ) -> Result { let environ = ModuleEnvironment::new(); let features = inner_engine.features().clone(); @@ -120,11 +119,17 @@ impl ArtifactBuild { compile_info, data_initializers, cpu_features: cpu_features.as_u64(), - module_start, + module_start: None, }; Ok(Self { serializable }) } + /// Specify the fixed virtual memory address for the compiled module + pub fn with_module_start(mut self, module_start: Option) -> Self { + self.serializable.module_start = module_start; + self + } + /// Compile a data buffer into a `ArtifactBuild`, which may then be instantiated. #[cfg(not(feature = "compiler"))] #[cfg(not(target_arch = "wasm32"))] diff --git a/lib/compiler/src/engine/artifact.rs b/lib/compiler/src/engine/artifact.rs index d61c3958ed8..35383189fec 100644 --- a/lib/compiler/src/engine/artifact.rs +++ b/lib/compiler/src/engine/artifact.rs @@ -83,8 +83,8 @@ impl Artifact { engine.target(), memory_styles, table_styles, - tunables.module_start(), - )?; + )? + .with_module_start(tunables.module_start()); Self::from_parts(&mut inner_engine, artifact) }