mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-22 21:21:33 +00:00
Merge branch 'master' into feature/debug-prototype2
This commit is contained in:
@ -13,6 +13,7 @@ use crate::{
|
||||
module::ModuleInfo,
|
||||
sys::Memory,
|
||||
};
|
||||
use std::fmt;
|
||||
use std::{any::Any, ptr::NonNull};
|
||||
|
||||
use std::collections::HashMap;
|
||||
@ -109,9 +110,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.
|
||||
@ -150,13 +170,36 @@ impl ExceptionTable {
|
||||
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Serialize, Deserialize)]
|
||||
pub enum ExceptionCode {
|
||||
/// An `unreachable` opcode was executed.
|
||||
Unreachable,
|
||||
|
||||
Unreachable = 0,
|
||||
/// Call indirect incorrect signature trap.
|
||||
IncorrectCallIndirectSignature = 1,
|
||||
/// Memory out of bounds trap.
|
||||
MemoryOutOfBounds = 2,
|
||||
/// Call indirect out of bounds trap.
|
||||
CallIndirectOOB = 3,
|
||||
/// An arithmetic exception, e.g. divided by zero.
|
||||
Arithmetic,
|
||||
IllegalArithmetic = 4,
|
||||
/// Misaligned atomic access trap.
|
||||
MisalignedAtomicAccess = 5,
|
||||
}
|
||||
|
||||
/// Memory access exception, e.g. misaligned/out-of-bound read/write.
|
||||
Memory,
|
||||
impl fmt::Display for ExceptionCode {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(
|
||||
f,
|
||||
"{}",
|
||||
match self {
|
||||
ExceptionCode::Unreachable => "unreachable",
|
||||
ExceptionCode::IncorrectCallIndirectSignature => {
|
||||
"incorrect `call_indirect` signature"
|
||||
}
|
||||
ExceptionCode::MemoryOutOfBounds => "memory out-of-bounds access",
|
||||
ExceptionCode::CallIndirectOOB => "`call_indirect` out-of-bounds",
|
||||
ExceptionCode::IllegalArithmetic => "illegal arithmetic operation",
|
||||
ExceptionCode::MisalignedAtomicAccess => "misaligned atomic access",
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
pub trait Compiler {
|
||||
|
Reference in New Issue
Block a user