1183: Make full preemption an optional feature. r=syrusakbary a=losfair

Full preemption requires two additional memory loads on loop backedges and function calls. This PR allows disabling full preemption at code generation time, and disables it by default.

Co-authored-by: losfair <zhy20000919@hotmail.com>
Co-authored-by: Heyang Zhou <zhy20000919@hotmail.com>
This commit is contained in:
bors[bot]
2020-02-05 01:05:04 +00:00
committed by GitHub
3 changed files with 87 additions and 48 deletions

View File

@ -109,9 +109,28 @@ impl BackendCompilerConfig {
pub struct CompilerConfig {
/// Symbol information generated from emscripten; used for more detailed debug messages
pub symbol_map: Option<HashMap<u32, String>>,
/// How to make the decision whether to emit bounds checks for memory accesses.
pub memory_bound_check_mode: MemoryBoundCheckMode,
/// Whether to generate explicit native stack checks against `stack_lower_bound` in `InternalCtx`.
///
/// Usually it's adequate to use hardware memory protection mechanisms such as `mprotect` on Unix to
/// prevent stack overflow. But for low-level environments, e.g. the kernel, faults are generally
/// not expected and relying on hardware memory protection would add too much complexity.
pub enforce_stack_check: bool,
/// Whether to enable state tracking. Necessary for managed mode.
pub track_state: bool,
/// Whether to enable full preemption checkpoint generation.
///
/// This inserts checkpoints at critical locations such as loop backedges and function calls,
/// allowing preemptive unwinding/task switching.
///
/// When enabled there can be a small amount of runtime performance overhead.
pub full_preemption: bool,
pub features: Features,
// Target info. Presently only supported by LLVM.