mirror of
https://github.com/fluencelabs/wasmer
synced 2025-03-19 09:30:52 +00:00
Emit exception table in singlepass.
This commit is contained in:
parent
8bf0c1966c
commit
0a23327401
@ -25,6 +25,7 @@ use wasmer_runtime_core::{
|
||||
sys::{Memory, Protect},
|
||||
Architecture, Backend, CacheGen, CompilerConfig, InlineBreakpoint, InlineBreakpointType,
|
||||
MemoryBoundCheckMode, RunnableModule, Token,
|
||||
ExceptionTable, ExceptionCode,
|
||||
},
|
||||
cache::{Artifact, Error as CacheError},
|
||||
codegen::*,
|
||||
@ -224,6 +225,8 @@ pub struct X64FunctionCode {
|
||||
unreachable_depth: usize,
|
||||
|
||||
config: Arc<CodegenConfig>,
|
||||
|
||||
exception_table: Option<ExceptionTable>,
|
||||
}
|
||||
|
||||
enum FuncPtrInner {}
|
||||
@ -242,6 +245,7 @@ pub struct X64ExecutionContext {
|
||||
breakpoints: BreakpointMap,
|
||||
func_import_count: usize,
|
||||
msm: ModuleStateMap,
|
||||
exception_table: ExceptionTable,
|
||||
}
|
||||
|
||||
/// On-disk cache format.
|
||||
@ -264,6 +268,9 @@ pub struct CacheImage {
|
||||
|
||||
/// Module state map.
|
||||
msm: ModuleStateMap,
|
||||
|
||||
/// An exception table that maps instruction offsets to exception codes.
|
||||
exception_table: ExceptionTable,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
@ -322,6 +329,10 @@ impl RunnableModule for X64ExecutionContext {
|
||||
Some(self.breakpoints.clone())
|
||||
}
|
||||
|
||||
fn get_exception_table(&self) -> Option<&ExceptionTable> {
|
||||
Some(&self.exception_table)
|
||||
}
|
||||
|
||||
unsafe fn patch_local_function(&self, idx: usize, target_address: usize) -> bool {
|
||||
/*
|
||||
0: 48 b8 42 42 42 42 42 42 42 42 movabsq $4774451407313060418, %rax
|
||||
@ -662,16 +673,18 @@ impl ModuleCodeGenerator<X64FunctionCode, X64ExecutionContext, CodegenError>
|
||||
&mut self,
|
||||
_module_info: Arc<RwLock<ModuleInfo>>,
|
||||
) -> Result<&mut X64FunctionCode, CodegenError> {
|
||||
let (mut assembler, mut function_labels, breakpoints) = match self.functions.last_mut() {
|
||||
let (mut assembler, mut function_labels, breakpoints, exception_table) = match self.functions.last_mut() {
|
||||
Some(x) => (
|
||||
x.assembler.take().unwrap(),
|
||||
x.function_labels.take().unwrap(),
|
||||
x.breakpoints.take().unwrap(),
|
||||
x.exception_table.take().unwrap(),
|
||||
),
|
||||
None => (
|
||||
self.assembler.take().unwrap(),
|
||||
self.function_labels.take().unwrap(),
|
||||
HashMap::new(),
|
||||
ExceptionTable::new(),
|
||||
),
|
||||
};
|
||||
|
||||
@ -707,6 +720,7 @@ impl ModuleCodeGenerator<X64FunctionCode, X64ExecutionContext, CodegenError>
|
||||
machine,
|
||||
unreachable_depth: 0,
|
||||
config: self.config.as_ref().unwrap().clone(),
|
||||
exception_table: Some(exception_table),
|
||||
};
|
||||
self.functions.push(code);
|
||||
Ok(self.functions.last_mut().unwrap())
|
||||
@ -716,16 +730,18 @@ impl ModuleCodeGenerator<X64FunctionCode, X64ExecutionContext, CodegenError>
|
||||
mut self,
|
||||
_: &ModuleInfo,
|
||||
) -> Result<(X64ExecutionContext, Box<dyn CacheGen>), CodegenError> {
|
||||
let (assembler, function_labels, breakpoints) = match self.functions.last_mut() {
|
||||
let (assembler, function_labels, breakpoints, exception_table) = match self.functions.last_mut() {
|
||||
Some(x) => (
|
||||
x.assembler.take().unwrap(),
|
||||
x.function_labels.take().unwrap(),
|
||||
x.breakpoints.take().unwrap(),
|
||||
x.exception_table.take().unwrap(),
|
||||
),
|
||||
None => (
|
||||
self.assembler.take().unwrap(),
|
||||
self.function_labels.take().unwrap(),
|
||||
HashMap::new(),
|
||||
ExceptionTable::new(),
|
||||
),
|
||||
};
|
||||
|
||||
@ -797,6 +813,7 @@ impl ModuleCodeGenerator<X64FunctionCode, X64ExecutionContext, CodegenError>
|
||||
function_offsets: out_offsets.iter().map(|x| x.0 as usize).collect(),
|
||||
func_import_count: self.func_import_count,
|
||||
msm: msm.clone(),
|
||||
exception_table: exception_table.clone(),
|
||||
};
|
||||
|
||||
let cache = SinglepassCache {
|
||||
@ -812,6 +829,7 @@ impl ModuleCodeGenerator<X64FunctionCode, X64ExecutionContext, CodegenError>
|
||||
function_pointers: out_labels,
|
||||
function_offsets: out_offsets,
|
||||
msm: msm,
|
||||
exception_table,
|
||||
},
|
||||
Box::new(cache),
|
||||
))
|
||||
@ -915,6 +933,7 @@ impl ModuleCodeGenerator<X64FunctionCode, X64ExecutionContext, CodegenError>
|
||||
breakpoints: Arc::new(HashMap::new()),
|
||||
func_import_count: cache_image.func_import_count,
|
||||
msm: cache_image.msm,
|
||||
exception_table: cache_image.exception_table,
|
||||
};
|
||||
Ok(ModuleInner {
|
||||
runnable_module: Arc::new(Box::new(ec)),
|
||||
@ -947,10 +966,22 @@ impl X64FunctionCode {
|
||||
.insert(m.state.wasm_inst_offset, SuspendOffset::Trappable(offset));
|
||||
}
|
||||
|
||||
/// Marks each address in the code range emitted by `f` with the exception code `code`.
|
||||
fn mark_range_with_exception_code<F: FnOnce(&mut Assembler) -> R, R>(a: &mut Assembler, etable: &mut ExceptionTable, code: ExceptionCode, f: F) -> R {
|
||||
let begin = a.get_offset().0;
|
||||
let ret = f(a);
|
||||
let end = a.get_offset().0;
|
||||
for i in begin..end {
|
||||
etable.offset_to_code.insert(i, code);
|
||||
}
|
||||
ret
|
||||
}
|
||||
|
||||
/// Moves `loc` to a valid location for `div`/`idiv`.
|
||||
fn emit_relaxed_xdiv(
|
||||
a: &mut Assembler,
|
||||
m: &mut Machine,
|
||||
etable: &mut ExceptionTable,
|
||||
op: fn(&mut Assembler, Size, Location),
|
||||
sz: Size,
|
||||
loc: Location,
|
||||
@ -962,10 +993,12 @@ impl X64FunctionCode {
|
||||
Location::Imm64(_) | Location::Imm32(_) => {
|
||||
a.emit_mov(sz, loc, Location::GPR(GPR::RCX)); // must not be used during div (rax, rdx)
|
||||
Self::mark_trappable(a, m, fsm, control_stack);
|
||||
etable.offset_to_code.insert(a.get_offset().0, ExceptionCode::Arithmetic);
|
||||
op(a, sz, Location::GPR(GPR::RCX));
|
||||
}
|
||||
_ => {
|
||||
Self::mark_trappable(a, m, fsm, control_stack);
|
||||
etable.offset_to_code.insert(a.get_offset().0, ExceptionCode::Arithmetic);
|
||||
op(a, sz, loc);
|
||||
}
|
||||
}
|
||||
@ -1876,6 +1909,7 @@ impl X64FunctionCode {
|
||||
config: &CodegenConfig,
|
||||
a: &mut Assembler,
|
||||
m: &mut Machine,
|
||||
etable: &mut ExceptionTable,
|
||||
addr: Location,
|
||||
memarg: &MemoryImmediate,
|
||||
check_alignment: bool,
|
||||
@ -1949,7 +1983,8 @@ impl X64FunctionCode {
|
||||
// Trap if the end address of the requested area is above that of the linear memory.
|
||||
a.emit_add(Size::S64, Location::GPR(tmp_base), Location::GPR(tmp_addr));
|
||||
a.emit_cmp(Size::S64, Location::GPR(tmp_bound), Location::GPR(tmp_addr));
|
||||
a.emit_conditional_trap(Condition::Above);
|
||||
|
||||
Self::mark_range_with_exception_code(a, etable, ExceptionCode::Memory, |a| a.emit_conditional_trap(Condition::Above));
|
||||
|
||||
m.release_temp_gpr(tmp_bound);
|
||||
}
|
||||
@ -1989,11 +2024,13 @@ impl X64FunctionCode {
|
||||
Location::Imm32(align - 1),
|
||||
Location::GPR(tmp_aligncheck),
|
||||
);
|
||||
a.emit_conditional_trap(Condition::NotEqual);
|
||||
Self::mark_range_with_exception_code(a, etable, ExceptionCode::Memory, |a| a.emit_conditional_trap(Condition::NotEqual));
|
||||
m.release_temp_gpr(tmp_aligncheck);
|
||||
}
|
||||
|
||||
cb(a, m, tmp_addr)?;
|
||||
Self::mark_range_with_exception_code(a, etable, ExceptionCode::Memory, |a| {
|
||||
cb(a, m, tmp_addr)
|
||||
})?;
|
||||
|
||||
m.release_temp_gpr(tmp_addr);
|
||||
Ok(())
|
||||
@ -2005,6 +2042,7 @@ impl X64FunctionCode {
|
||||
config: &CodegenConfig,
|
||||
a: &mut Assembler,
|
||||
m: &mut Machine,
|
||||
etable: &mut ExceptionTable,
|
||||
loc: Location,
|
||||
target: Location,
|
||||
ret: Location,
|
||||
@ -2038,6 +2076,7 @@ impl X64FunctionCode {
|
||||
config,
|
||||
a,
|
||||
m,
|
||||
etable,
|
||||
target,
|
||||
memarg,
|
||||
true,
|
||||
@ -2108,6 +2147,7 @@ impl X64FunctionCode {
|
||||
fn emit_f32_int_conv_check_trap(
|
||||
a: &mut Assembler,
|
||||
m: &mut Machine,
|
||||
etable: &mut ExceptionTable,
|
||||
reg: XMM,
|
||||
lower_bound: f32,
|
||||
upper_bound: f32,
|
||||
@ -2117,6 +2157,7 @@ impl X64FunctionCode {
|
||||
|
||||
Self::emit_f32_int_conv_check(a, m, reg, lower_bound, upper_bound, trap, trap, trap, end);
|
||||
a.emit_label(trap);
|
||||
etable.offset_to_code.insert(a.get_offset().0, ExceptionCode::Arithmetic);
|
||||
a.emit_ud2();
|
||||
a.emit_label(end);
|
||||
}
|
||||
@ -2232,6 +2273,7 @@ impl X64FunctionCode {
|
||||
fn emit_f64_int_conv_check_trap(
|
||||
a: &mut Assembler,
|
||||
m: &mut Machine,
|
||||
etable: &mut ExceptionTable,
|
||||
reg: XMM,
|
||||
lower_bound: f64,
|
||||
upper_bound: f64,
|
||||
@ -2241,6 +2283,7 @@ impl X64FunctionCode {
|
||||
|
||||
Self::emit_f64_int_conv_check(a, m, reg, lower_bound, upper_bound, trap, trap, trap, end);
|
||||
a.emit_label(trap);
|
||||
etable.offset_to_code.insert(a.get_offset().0, ExceptionCode::Arithmetic);
|
||||
a.emit_ud2();
|
||||
a.emit_label(end);
|
||||
}
|
||||
@ -2365,7 +2408,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
),
|
||||
Location::GPR(GPR::RSP),
|
||||
);
|
||||
a.emit_conditional_trap(Condition::Below);
|
||||
Self::mark_range_with_exception_code(a, self.exception_table.as_mut().unwrap(), ExceptionCode::Memory, |a| a.emit_conditional_trap(Condition::Below));
|
||||
}
|
||||
|
||||
self.locals = self
|
||||
@ -2788,6 +2831,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
Self::emit_relaxed_xdiv(
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
Assembler::emit_div,
|
||||
Size::S32,
|
||||
loc_b,
|
||||
@ -2813,6 +2857,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
Self::emit_relaxed_xdiv(
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
Assembler::emit_idiv,
|
||||
Size::S32,
|
||||
loc_b,
|
||||
@ -2838,6 +2883,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
Self::emit_relaxed_xdiv(
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
Assembler::emit_div,
|
||||
Size::S32,
|
||||
loc_b,
|
||||
@ -2889,6 +2935,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
Self::emit_relaxed_xdiv(
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
Assembler::emit_idiv,
|
||||
Size::S32,
|
||||
loc_b,
|
||||
@ -3187,6 +3234,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
Self::emit_relaxed_xdiv(
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
Assembler::emit_div,
|
||||
Size::S64,
|
||||
loc_b,
|
||||
@ -3212,6 +3260,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
Self::emit_relaxed_xdiv(
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
Assembler::emit_idiv,
|
||||
Size::S64,
|
||||
loc_b,
|
||||
@ -3237,6 +3286,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
Self::emit_relaxed_xdiv(
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
Assembler::emit_div,
|
||||
Size::S64,
|
||||
loc_b,
|
||||
@ -3296,6 +3346,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
Self::emit_relaxed_xdiv(
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
Assembler::emit_idiv,
|
||||
Size::S64,
|
||||
loc_b,
|
||||
@ -4748,6 +4799,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
Self::emit_f32_int_conv_check_trap(
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
tmp_in,
|
||||
GEF32_LT_U32_MIN,
|
||||
LEF32_GT_U32_MAX,
|
||||
@ -4859,6 +4911,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
Self::emit_f32_int_conv_check_trap(
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
tmp_in,
|
||||
GEF32_LT_I32_MIN,
|
||||
LEF32_GT_I32_MAX,
|
||||
@ -4976,6 +5029,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
Self::emit_f32_int_conv_check_trap(
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
tmp_in,
|
||||
GEF32_LT_I64_MIN,
|
||||
LEF32_GT_I64_MAX,
|
||||
@ -5093,6 +5147,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
Self::emit_f32_int_conv_check_trap(
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
tmp_in,
|
||||
GEF32_LT_U64_MIN,
|
||||
LEF32_GT_U64_MAX,
|
||||
@ -5253,6 +5308,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
Self::emit_f64_int_conv_check_trap(
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
tmp_in,
|
||||
GEF64_LT_U32_MIN,
|
||||
LEF64_GT_U32_MAX,
|
||||
@ -5370,6 +5426,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
Self::emit_f64_int_conv_check_trap(
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
real_in,
|
||||
GEF64_LT_I32_MIN,
|
||||
LEF64_GT_I32_MAX,
|
||||
@ -5493,6 +5550,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
Self::emit_f64_int_conv_check_trap(
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
tmp_in,
|
||||
GEF64_LT_I64_MIN,
|
||||
LEF64_GT_I64_MAX,
|
||||
@ -5611,6 +5669,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
Self::emit_f64_int_conv_check_trap(
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
tmp_in,
|
||||
GEF64_LT_U64_MIN,
|
||||
LEF64_GT_U64_MAX,
|
||||
@ -6210,7 +6269,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
Location::GPR(table_base),
|
||||
);
|
||||
a.emit_cmp(Size::S32, func_index, Location::GPR(table_count));
|
||||
a.emit_conditional_trap(Condition::BelowEqual);
|
||||
Self::mark_range_with_exception_code(a, self.exception_table.as_mut().unwrap(), ExceptionCode::Memory, |a| a.emit_conditional_trap(Condition::BelowEqual));
|
||||
a.emit_mov(Size::S64, func_index, Location::GPR(table_count));
|
||||
a.emit_imul_imm32_gpr64(vm::Anyfunc::size() as u32, table_count);
|
||||
a.emit_add(
|
||||
@ -6236,7 +6295,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
Location::GPR(sigidx),
|
||||
Location::Memory(table_count, (vm::Anyfunc::offset_sig_id() as usize) as i32),
|
||||
);
|
||||
a.emit_conditional_trap(Condition::NotEqual);
|
||||
Self::mark_range_with_exception_code(a, self.exception_table.as_mut().unwrap(), ExceptionCode::Memory, |a| a.emit_conditional_trap(Condition::NotEqual));
|
||||
|
||||
self.machine.release_temp_gpr(sigidx);
|
||||
self.machine.release_temp_gpr(table_count);
|
||||
@ -6587,6 +6646,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target,
|
||||
memarg,
|
||||
false,
|
||||
@ -6619,6 +6679,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target,
|
||||
memarg,
|
||||
false,
|
||||
@ -6651,6 +6712,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target,
|
||||
memarg,
|
||||
false,
|
||||
@ -6684,6 +6746,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target,
|
||||
memarg,
|
||||
false,
|
||||
@ -6717,6 +6780,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target,
|
||||
memarg,
|
||||
false,
|
||||
@ -6750,6 +6814,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target,
|
||||
memarg,
|
||||
false,
|
||||
@ -6779,6 +6844,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target_addr,
|
||||
memarg,
|
||||
false,
|
||||
@ -6807,6 +6873,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target_addr,
|
||||
memarg,
|
||||
false,
|
||||
@ -6835,6 +6902,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target_addr,
|
||||
memarg,
|
||||
false,
|
||||
@ -6863,6 +6931,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target_addr,
|
||||
memarg,
|
||||
false,
|
||||
@ -6895,6 +6964,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target,
|
||||
memarg,
|
||||
false,
|
||||
@ -6927,6 +6997,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target,
|
||||
memarg,
|
||||
false,
|
||||
@ -6959,6 +7030,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target,
|
||||
memarg,
|
||||
false,
|
||||
@ -6992,6 +7064,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target,
|
||||
memarg,
|
||||
false,
|
||||
@ -7025,6 +7098,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target,
|
||||
memarg,
|
||||
false,
|
||||
@ -7058,6 +7132,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target,
|
||||
memarg,
|
||||
false,
|
||||
@ -7091,6 +7166,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target,
|
||||
memarg,
|
||||
false,
|
||||
@ -7138,6 +7214,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target,
|
||||
memarg,
|
||||
false,
|
||||
@ -7167,6 +7244,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target_addr,
|
||||
memarg,
|
||||
false,
|
||||
@ -7195,6 +7273,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target_addr,
|
||||
memarg,
|
||||
false,
|
||||
@ -7223,6 +7302,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target_addr,
|
||||
memarg,
|
||||
false,
|
||||
@ -7251,6 +7331,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target_addr,
|
||||
memarg,
|
||||
false,
|
||||
@ -7279,6 +7360,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target_addr,
|
||||
memarg,
|
||||
false,
|
||||
@ -7298,6 +7380,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
}
|
||||
Operator::Unreachable => {
|
||||
Self::mark_trappable(a, &self.machine, &mut self.fsm, &mut self.control_stack);
|
||||
self.exception_table.as_mut().unwrap().offset_to_code.insert(a.get_offset().0, ExceptionCode::Unreachable);
|
||||
a.emit_ud2();
|
||||
self.unreachable_depth = 1;
|
||||
}
|
||||
@ -7526,6 +7609,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target,
|
||||
memarg,
|
||||
true,
|
||||
@ -7558,6 +7642,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target,
|
||||
memarg,
|
||||
true,
|
||||
@ -7591,6 +7676,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target,
|
||||
memarg,
|
||||
true,
|
||||
@ -7620,6 +7706,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target_addr,
|
||||
memarg,
|
||||
true,
|
||||
@ -7648,6 +7735,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target_addr,
|
||||
memarg,
|
||||
true,
|
||||
@ -7676,6 +7764,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target_addr,
|
||||
memarg,
|
||||
true,
|
||||
@ -7708,6 +7797,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target,
|
||||
memarg,
|
||||
true,
|
||||
@ -7740,6 +7830,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target,
|
||||
memarg,
|
||||
true,
|
||||
@ -7773,6 +7864,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target,
|
||||
memarg,
|
||||
true,
|
||||
@ -7806,6 +7898,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target,
|
||||
memarg,
|
||||
true,
|
||||
@ -7849,6 +7942,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target_addr,
|
||||
memarg,
|
||||
true,
|
||||
@ -7877,6 +7971,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target_addr,
|
||||
memarg,
|
||||
true,
|
||||
@ -7905,6 +8000,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target_addr,
|
||||
memarg,
|
||||
true,
|
||||
@ -7933,6 +8029,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target_addr,
|
||||
memarg,
|
||||
true,
|
||||
@ -7969,6 +8066,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target,
|
||||
memarg,
|
||||
true,
|
||||
@ -8004,6 +8102,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target,
|
||||
memarg,
|
||||
true,
|
||||
@ -8039,6 +8138,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target,
|
||||
memarg,
|
||||
true,
|
||||
@ -8070,6 +8170,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target,
|
||||
memarg,
|
||||
true,
|
||||
@ -8105,6 +8206,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target,
|
||||
memarg,
|
||||
true,
|
||||
@ -8136,6 +8238,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target,
|
||||
memarg,
|
||||
true,
|
||||
@ -8171,6 +8274,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target,
|
||||
memarg,
|
||||
true,
|
||||
@ -8207,6 +8311,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target,
|
||||
memarg,
|
||||
true,
|
||||
@ -8243,6 +8348,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target,
|
||||
memarg,
|
||||
true,
|
||||
@ -8279,6 +8385,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target,
|
||||
memarg,
|
||||
true,
|
||||
@ -8311,6 +8418,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target,
|
||||
memarg,
|
||||
true,
|
||||
@ -8347,6 +8455,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target,
|
||||
memarg,
|
||||
true,
|
||||
@ -8379,6 +8488,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target,
|
||||
memarg,
|
||||
true,
|
||||
@ -8415,6 +8525,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target,
|
||||
memarg,
|
||||
true,
|
||||
@ -8448,6 +8559,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
loc,
|
||||
target,
|
||||
ret,
|
||||
@ -8477,6 +8589,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
loc,
|
||||
target,
|
||||
ret,
|
||||
@ -8506,6 +8619,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
loc,
|
||||
target,
|
||||
ret,
|
||||
@ -8535,6 +8649,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
loc,
|
||||
target,
|
||||
ret,
|
||||
@ -8564,6 +8679,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
loc,
|
||||
target,
|
||||
ret,
|
||||
@ -8593,6 +8709,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
loc,
|
||||
target,
|
||||
ret,
|
||||
@ -8622,6 +8739,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
loc,
|
||||
target,
|
||||
ret,
|
||||
@ -8651,6 +8769,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
loc,
|
||||
target,
|
||||
ret,
|
||||
@ -8680,6 +8799,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
loc,
|
||||
target,
|
||||
ret,
|
||||
@ -8709,6 +8829,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
loc,
|
||||
target,
|
||||
ret,
|
||||
@ -8738,6 +8859,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
loc,
|
||||
target,
|
||||
ret,
|
||||
@ -8767,6 +8889,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
loc,
|
||||
target,
|
||||
ret,
|
||||
@ -8796,6 +8919,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
loc,
|
||||
target,
|
||||
ret,
|
||||
@ -8825,6 +8949,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
loc,
|
||||
target,
|
||||
ret,
|
||||
@ -8854,6 +8979,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
loc,
|
||||
target,
|
||||
ret,
|
||||
@ -8883,6 +9009,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
loc,
|
||||
target,
|
||||
ret,
|
||||
@ -8912,6 +9039,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
loc,
|
||||
target,
|
||||
ret,
|
||||
@ -8941,6 +9069,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
loc,
|
||||
target,
|
||||
ret,
|
||||
@ -8970,6 +9099,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
loc,
|
||||
target,
|
||||
ret,
|
||||
@ -8999,6 +9129,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
loc,
|
||||
target,
|
||||
ret,
|
||||
@ -9028,6 +9159,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
loc,
|
||||
target,
|
||||
ret,
|
||||
@ -9059,6 +9191,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target,
|
||||
memarg,
|
||||
true,
|
||||
@ -9090,6 +9223,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target,
|
||||
memarg,
|
||||
true,
|
||||
@ -9121,6 +9255,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target,
|
||||
memarg,
|
||||
true,
|
||||
@ -9152,6 +9287,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target,
|
||||
memarg,
|
||||
true,
|
||||
@ -9183,6 +9319,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target,
|
||||
memarg,
|
||||
true,
|
||||
@ -9214,6 +9351,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target,
|
||||
memarg,
|
||||
true,
|
||||
@ -9245,6 +9383,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target,
|
||||
memarg,
|
||||
true,
|
||||
@ -9290,6 +9429,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target,
|
||||
memarg,
|
||||
true,
|
||||
@ -9340,6 +9480,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target,
|
||||
memarg,
|
||||
true,
|
||||
@ -9390,6 +9531,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target,
|
||||
memarg,
|
||||
true,
|
||||
@ -9440,6 +9582,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target,
|
||||
memarg,
|
||||
true,
|
||||
@ -9490,6 +9633,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target,
|
||||
memarg,
|
||||
true,
|
||||
@ -9540,6 +9684,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target,
|
||||
memarg,
|
||||
true,
|
||||
@ -9590,6 +9735,7 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
|
||||
&self.config,
|
||||
a,
|
||||
&mut self.machine,
|
||||
self.exception_table.as_mut().unwrap(),
|
||||
target,
|
||||
memarg,
|
||||
true,
|
||||
|
Loading…
x
Reference in New Issue
Block a user