mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-14 09:21:20 +00:00
ExceptionCode
and ExceptionTable
.
This commit is contained in:
@ -183,6 +183,26 @@ pub struct CompilerConfig {
|
||||
pub backend_specific_config: Option<BackendCompilerConfig>,
|
||||
}
|
||||
|
||||
/// An exception table for a `RunnableModule`.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct ExceptionTable {
|
||||
/// Mappings from offsets in generated machine code to the corresponding exception code.
|
||||
pub offset_to_code: HashMap<usize, ExceptionCode>,
|
||||
}
|
||||
|
||||
/// The code of an exception.
|
||||
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
|
||||
pub enum ExceptionCode {
|
||||
/// An `unreachable` opcode was executed.
|
||||
Unreachable,
|
||||
|
||||
/// An arithmetic exception, e.g. divided by zero.
|
||||
Arithmetic,
|
||||
|
||||
/// Memory access exception, e.g. misaligned/out-of-bound read/write.
|
||||
Memory,
|
||||
}
|
||||
|
||||
pub trait Compiler {
|
||||
/// Compiles a `Module` from WebAssembly binary format.
|
||||
/// The `CompileToken` parameter ensures that this can only
|
||||
@ -214,6 +234,10 @@ pub trait RunnableModule: Send + Sync {
|
||||
None
|
||||
}
|
||||
|
||||
fn get_exception_table(&self) -> Option<&ExceptionTable> {
|
||||
None
|
||||
}
|
||||
|
||||
unsafe fn patch_local_function(&self, _idx: usize, _target_address: usize) -> bool {
|
||||
false
|
||||
}
|
||||
|
Reference in New Issue
Block a user