Added stackoverflow traps on function calls in singlepass

This commit is contained in:
Syrus
2020-12-03 22:09:40 -08:00
parent 917eadb784
commit 2178f27a47

View File

@@ -5224,6 +5224,15 @@ impl<'a> FuncGen<'a> {
self.emit_call_sysv(
|this| {
let offset = this.assembler.get_offset().0;
this.instructions_address_map.push(InstructionAddressMap {
srcloc: SourceLoc::new(this.src_loc),
code_offset: offset,
code_len: 3,
});
this.trap_table
.offset_to_code
.insert(offset, TrapCode::StackOverflow);
this.assembler.emit_call_location(Location::GPR(GPR::RAX));
},
params.iter().copied(),
@@ -5417,6 +5426,15 @@ impl<'a> FuncGen<'a> {
),
);
} else {
let offset = this.assembler.get_offset().0;
this.instructions_address_map.push(InstructionAddressMap {
srcloc: SourceLoc::new(this.src_loc),
code_offset: offset,
code_len: 3,
});
this.trap_table
.offset_to_code
.insert(offset, TrapCode::StackOverflow);
this.assembler.emit_call_location(Location::Memory(
GPR::RAX,
vmcaller_checked_anyfunc_func_ptr as i32,