mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-23 05:31:32 +00:00
Update opt name in CompilerConfig, enable IR verification in spectests
This commit is contained in:
@ -49,13 +49,15 @@ fn get_isa(config: Option<&CompilerConfig>) -> Box<dyn isa::TargetIsa> {
|
||||
if config.nan_canonicalization {
|
||||
builder.set("enable_nan_canonicalization", "true").unwrap();
|
||||
}
|
||||
enable_verifier = !config.disable_debug_mode_verification;
|
||||
enable_verifier = config.enable_verification;
|
||||
} else {
|
||||
// Set defaults if no config found.
|
||||
enable_verifier = true;
|
||||
// NOTE: cfg(test) probably does nothing when not running `cargo test`
|
||||
// on this crate
|
||||
enable_verifier = cfg!(test) || cfg!(debug_assertions);
|
||||
}
|
||||
|
||||
if (cfg!(test) || cfg!(debug_assertions)) && enable_verifier {
|
||||
if enable_verifier {
|
||||
builder.set("enable_verifier", "true").unwrap();
|
||||
} else {
|
||||
builder.set("enable_verifier", "false").unwrap();
|
||||
|
@ -106,7 +106,7 @@ impl BackendCompilerConfig {
|
||||
}
|
||||
|
||||
/// Configuration data for the compiler
|
||||
#[derive(Debug, Default)]
|
||||
#[derive(Debug)]
|
||||
pub struct CompilerConfig {
|
||||
/// Symbol information generated from emscripten; used for more detailed debug messages
|
||||
pub symbol_map: Option<HashMap<u32, String>>,
|
||||
@ -136,11 +136,12 @@ pub struct CompilerConfig {
|
||||
/// Enabling this makes execution deterministic but increases runtime overhead.
|
||||
pub nan_canonicalization: bool,
|
||||
|
||||
/// Turns off verification that is done by default when `debug_assertions` are enabled
|
||||
/// (for example in 'debug' builds). Enabling this flag will make compilation faster at the
|
||||
/// cost of not detecting bugs in the compiler. The verification steps that this flag
|
||||
/// disables are disabled by default in 'release' builds.
|
||||
pub disable_debug_mode_verification: bool,
|
||||
/// Turns on verification that is done by default when `debug_assertions` are enabled
|
||||
/// (for example in 'debug' builds). Disabling this flag will make compilation faster
|
||||
/// in debug mode at the cost of not detecting bugs in the compiler.
|
||||
///
|
||||
/// These verifications are disabled by default in 'release' builds.
|
||||
pub enable_verification: bool,
|
||||
|
||||
pub features: Features,
|
||||
|
||||
@ -154,6 +155,30 @@ pub struct CompilerConfig {
|
||||
pub generate_debug_info: bool,
|
||||
}
|
||||
|
||||
impl Default for CompilerConfig {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
symbol_map: Default::default(),
|
||||
memory_bound_check_mode: Default::default(),
|
||||
enforce_stack_check: Default::default(),
|
||||
track_state: Default::default(),
|
||||
full_preemption: Default::default(),
|
||||
nan_canonicalization: Default::default(),
|
||||
features: Default::default(),
|
||||
triple: Default::default(),
|
||||
cpu_name: Default::default(),
|
||||
cpu_features: Default::default(),
|
||||
backend_specific_config: Default::default(),
|
||||
generate_debug_info: Default::default(),
|
||||
|
||||
// Default verification to 'on' when testing or running in debug mode.
|
||||
// NOTE: cfg(test) probably does nothing when not running `cargo test`
|
||||
// on this crate
|
||||
enable_verification: cfg!(test) || cfg!(debug_assertions),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl CompilerConfig {
|
||||
/// Use this to check if we should be generating debug information.
|
||||
/// This function takes into account the features that runtime-core was
|
||||
|
@ -337,6 +337,7 @@ mod tests {
|
||||
threads: true,
|
||||
},
|
||||
nan_canonicalization: true,
|
||||
enable_verification: true,
|
||||
..Default::default()
|
||||
};
|
||||
let module = compile_with_config(&module.into_vec(), config)
|
||||
@ -776,6 +777,7 @@ mod tests {
|
||||
threads: true,
|
||||
},
|
||||
nan_canonicalization: true,
|
||||
enable_verification: true,
|
||||
..Default::default()
|
||||
};
|
||||
compile_with_config(&module.into_vec(), config)
|
||||
@ -829,6 +831,7 @@ mod tests {
|
||||
threads: true,
|
||||
},
|
||||
nan_canonicalization: true,
|
||||
enable_verification: true,
|
||||
..Default::default()
|
||||
};
|
||||
compile_with_config(&module.into_vec(), config)
|
||||
@ -881,6 +884,7 @@ mod tests {
|
||||
threads: true,
|
||||
},
|
||||
nan_canonicalization: true,
|
||||
enable_verification: true,
|
||||
..Default::default()
|
||||
};
|
||||
let module = compile_with_config(&module.into_vec(), config)
|
||||
@ -977,6 +981,7 @@ mod tests {
|
||||
threads: true,
|
||||
},
|
||||
nan_canonicalization: true,
|
||||
enable_verification: true,
|
||||
..Default::default()
|
||||
};
|
||||
let module = compile_with_config(&module.into_vec(), config)
|
||||
|
Reference in New Issue
Block a user