-
Notifications
You must be signed in to change notification settings - Fork 824
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
Add CompilerConfig
opt to disable IR verification in debug mode
#1332
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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,6 +136,13 @@ pub struct CompilerConfig { | |
/// Enabling this makes execution deterministic but increases runtime overhead. | ||
pub nan_canonicalization: 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, | ||
|
||
// Target info. Presently only supported by LLVM. | ||
|
@@ -148,6 +155,30 @@ pub struct CompilerConfig { | |
pub generate_debug_info: bool, | ||
} | ||
|
||
impl Default for CompilerConfig { | ||
fn default() -> Self { | ||
Self { | ||
symbol_map: Default::default(), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Couldn't you use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That would infinite loop I believe! My understanding of what There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, just verified this:
|
||
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 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional.
⛳
builder.set("enable_verifier", if enable_verifier { "true" } else { "false" }).unwrap();