Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed create-exe tests for object-format serialized #3496

Merged
merged 1 commit into from
Jan 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 1 addition & 13 deletions lib/compiler/src/artifact_builders/artifact_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use wasmer_types::entity::PrimaryMap;
use wasmer_types::CompileModuleInfo;
use wasmer_types::{
CompileError, CpuFeature, CustomSection, Dwarf, FunctionIndex, LocalFunctionIndex, MemoryIndex,
MemoryStyle, ModuleInfo, OwnedDataInitializer, Pages, Relocation, SectionIndex, SignatureIndex,
MemoryStyle, ModuleInfo, OwnedDataInitializer, Relocation, SectionIndex, SignatureIndex,
TableIndex, TableStyle, Target,
};
use wasmer_types::{
Expand Down Expand Up @@ -119,17 +119,10 @@ impl ArtifactBuild {
compile_info,
data_initializers,
cpu_features: cpu_features.as_u64(),
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 All @@ -150,11 +143,6 @@ impl ArtifactBuild {
Self { serializable }
}

/// Returns the memory start address for this compiled module
pub fn get_memory_start(&self) -> Option<Pages> {
self.serializable.module_start
}

/// Get Functions Bodies ref
pub fn get_function_bodies_ref(&self) -> &PrimaryMap<LocalFunctionIndex, FunctionBody> {
&self.serializable.compilation.function_bodies
Expand Down
4 changes: 1 addition & 3 deletions lib/compiler/src/engine/artifact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@ impl Artifact {
engine.target(),
memory_styles,
table_styles,
)?
.with_module_start(tunables.module_start());
)?;

Self::from_parts(&mut inner_engine, artifact)
}
Expand Down Expand Up @@ -712,7 +711,6 @@ impl Artifact {
compile_info: metadata.compile_info,
data_initializers: metadata.data_initializers,
cpu_features: metadata.cpu_features,
module_start: None,
});

let finished_function_lengths = finished_functions
Expand Down
5 changes: 0 additions & 5 deletions lib/compiler/src/engine/tunables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ use wasmer_vm::{VMMemoryDefinition, VMTableDefinition};
/// An engine delegates the creation of memories, tables, and globals
/// to a foreign implementor of this trait.
pub trait Tunables {
/// Fixed virtual memory address for the compiled module
fn module_start(&self) -> Option<Pages> {
None
}

/// Construct a `MemoryStyle` for the provided `MemoryType`
fn memory_style(&self, memory: &MemoryType) -> MemoryStyle;

Expand Down
3 changes: 0 additions & 3 deletions lib/types/src/serialize.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use crate::entity::PrimaryMap;
use crate::Pages;
use crate::{
compilation::target::CpuFeature, CompileModuleInfo, CompiledFunctionFrameInfo, CustomSection,
DeserializeError, Dwarf, Features, FunctionBody, FunctionIndex, LocalFunctionIndex,
Expand Down Expand Up @@ -62,8 +61,6 @@ pub struct SerializableModule {
pub data_initializers: Box<[OwnedDataInitializer]>,
/// CPU Feature flags for this compilation
pub cpu_features: u64,
/// The start memory address of this serializable module
pub module_start: Option<Pages>,
}

fn to_serialize_error(err: impl std::error::Error) -> SerializeError {
Expand Down
8 changes: 2 additions & 6 deletions tests/integration/cli/tests/create_exe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -483,9 +483,7 @@ fn create_exe_works_with_file() -> anyhow::Result<()> {

// Ignored because of -lunwind linker issue on Windows
// see https://github.com/wasmerio/wasmer/issues/3459
//#[cfg_attr(target_os = "windows", ignore)]
// TODO: fix the cretae_exe with serialized object issue #3481
#[ignore]
#[cfg_attr(target_os = "windows", ignore)]
#[test]
fn create_exe_serialized_works() -> anyhow::Result<()> {
let temp_dir = tempfile::tempdir()?;
Expand Down Expand Up @@ -685,9 +683,7 @@ fn create_exe_with_object_input_symbols() -> anyhow::Result<()> {

// Ignored because of -lunwind linker issue on Windows
// see https://github.com/wasmerio/wasmer/issues/3459
//#[cfg_attr(target_os = "windows", ignore)]
// TODO: fix the cretae_exe with serialized object issue #3481
#[ignore]
#[cfg_attr(target_os = "windows", ignore)]
#[test]
fn create_exe_with_object_input_serialized() -> anyhow::Result<()> {
create_exe_with_object_input(vec![
Expand Down