Skip to content

Commit

Permalink
Remove module_start from ArtifactBuild::new, provide builder instead
Browse files Browse the repository at this point in the history
Remove the added module_start argument in ArtifactBuild::new() to avoid
a breaking change.

Introduce a with_module_start() method instead.
  • Loading branch information
theduke committed Dec 15, 2022
1 parent 62541e0 commit 6ef298d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 7 additions & 2 deletions lib/compiler/src/artifact_builders/artifact_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ impl ArtifactBuild {
target: &Target,
memory_styles: PrimaryMap<MemoryIndex, MemoryStyle>,
table_styles: PrimaryMap<TableIndex, TableStyle>,
module_start: Option<Pages>,
) -> Result<Self, CompileError> {
let environ = ModuleEnvironment::new();
let features = inner_engine.features().clone();
Expand Down Expand Up @@ -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<Pages>) -> 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"))]
Expand Down
4 changes: 2 additions & 2 deletions lib/compiler/src/engine/artifact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 6ef298d

Please sign in to comment.