mirror of
https://github.com/fluencelabs/wasmer
synced 2025-04-24 18:02:13 +00:00
Add CompilerConifg
opt to disable IR verification in debug mode
This commit is contained in:
parent
56aec04d1d
commit
403e14bc1e
@ -2,6 +2,7 @@
|
||||
|
||||
## **[Unreleased]**
|
||||
|
||||
- [#1332](https://github.com/wasmerio/wasmer/pull/1332) Add option to `CompilerConfig` to force compiler IR verification off even when `debug_assertions` are enabled. This can be used to make debug builds faster, which may be important if you're creating a library that wraps Wasmer and depend on the speed of debug builds.
|
||||
- [#1320](https://github.com/wasmerio/wasmer/pull/1320) Change `custom_sections` field in `ModuleInfo` to be more standards compliant by allowing multiple custom sections with the same name. To get the old behavior with the new API, you can add `.last().unwrap()` to accesses. For example, `module_info.custom_sections["custom_section_name"].last().unwrap()`.
|
||||
- [#1303](https://github.com/wasmerio/wasmer/pull/1303) NaN canonicalization for singlepass backend.
|
||||
- [#1292](https://github.com/wasmerio/wasmer/pull/1292) Experimental Support for Android (x86_64 and AArch64)
|
||||
|
@ -43,16 +43,22 @@ fn get_isa(config: Option<&CompilerConfig>) -> Box<dyn isa::TargetIsa> {
|
||||
builder.set("opt_level", "speed_and_size").unwrap();
|
||||
builder.set("enable_jump_tables", "false").unwrap();
|
||||
|
||||
if cfg!(test) || cfg!(debug_assertions) {
|
||||
builder.set("enable_verifier", "true").unwrap();
|
||||
} else {
|
||||
builder.set("enable_verifier", "false").unwrap();
|
||||
}
|
||||
let enable_verifier: bool;
|
||||
|
||||
if let Some(config) = config {
|
||||
if config.nan_canonicalization {
|
||||
builder.set("enable_nan_canonicalization", "true").unwrap();
|
||||
}
|
||||
enable_verifier = !config.disable_debug_mode_verification;
|
||||
} else {
|
||||
// Set defaults if no config found.
|
||||
enable_verifier = true;
|
||||
}
|
||||
|
||||
if (cfg!(test) || cfg!(debug_assertions)) && enable_verifier {
|
||||
builder.set("enable_verifier", "true").unwrap();
|
||||
} else {
|
||||
builder.set("enable_verifier", "false").unwrap();
|
||||
}
|
||||
|
||||
let flags = settings::Flags::new(builder);
|
||||
|
@ -86,7 +86,7 @@ impl Trampolines {
|
||||
let sig_index = module.func_assoc[*exported_func_index];
|
||||
let func_sig = &module.signatures[sig_index];
|
||||
|
||||
let trampoline_func = generate_func(&func_sig);
|
||||
let trampoline_func = generate_func(isa, &func_sig);
|
||||
|
||||
ctx.func = trampoline_func;
|
||||
|
||||
@ -150,13 +150,13 @@ impl Trampolines {
|
||||
|
||||
/// This function generates a trampoline for the specific signature
|
||||
/// passed into it.
|
||||
fn generate_func(func_sig: &FuncSig) -> ir::Function {
|
||||
let trampoline_sig = generate_trampoline_signature();
|
||||
fn generate_func(isa: &dyn isa::TargetIsa, func_sig: &FuncSig) -> ir::Function {
|
||||
let trampoline_sig = generate_trampoline_signature(isa);
|
||||
|
||||
let mut func =
|
||||
ir::Function::with_name_signature(ir::ExternalName::testcase("trampln"), trampoline_sig);
|
||||
|
||||
let export_sig_ref = func.import_signature(generate_export_signature(func_sig));
|
||||
let export_sig_ref = func.import_signature(generate_export_signature(isa, func_sig));
|
||||
|
||||
let entry_ebb = func.dfg.make_block();
|
||||
let vmctx_ptr = func.dfg.append_block_param(entry_ebb, ir::types::I64);
|
||||
@ -211,8 +211,8 @@ fn wasm_ty_to_clif(ty: Type) -> ir::types::Type {
|
||||
}
|
||||
}
|
||||
|
||||
fn generate_trampoline_signature() -> ir::Signature {
|
||||
let call_convention = super::get_isa(None).default_call_conv();
|
||||
fn generate_trampoline_signature(isa: &dyn isa::TargetIsa) -> ir::Signature {
|
||||
let call_convention = isa.default_call_conv();
|
||||
let mut sig = ir::Signature::new(call_convention);
|
||||
|
||||
let ptr_param = ir::AbiParam {
|
||||
@ -227,8 +227,8 @@ fn generate_trampoline_signature() -> ir::Signature {
|
||||
sig
|
||||
}
|
||||
|
||||
fn generate_export_signature(func_sig: &FuncSig) -> ir::Signature {
|
||||
let call_convention = super::get_isa(None).default_call_conv();
|
||||
fn generate_export_signature(isa: &dyn isa::TargetIsa, func_sig: &FuncSig) -> ir::Signature {
|
||||
let call_convention = isa.default_call_conv();
|
||||
let mut export_clif_sig = ir::Signature::new(call_convention);
|
||||
|
||||
let func_sig_iter = func_sig.params().iter().map(|wasm_ty| ir::AbiParam {
|
||||
|
@ -136,6 +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,
|
||||
|
||||
pub features: Features,
|
||||
|
||||
// Target info. Presently only supported by LLVM.
|
||||
|
Loading…
x
Reference in New Issue
Block a user