+ generate exception checks after calls to fpc_overflow class in WebAssembly

branchful exceptions mode, because fpc_overflow can raise an exception in case
  unit SysUtils is included.
This commit is contained in:
Nikolay Nikolov 2022-06-22 03:21:21 +03:00
parent b2350d90ea
commit 9b16fafc52
2 changed files with 3 additions and 0 deletions

View File

@ -2169,6 +2169,7 @@ implementation
list.concat(taicpu.op_none(a_block));
a_cmp_const_loc_label(list,s32inttype,OC_EQ,0,ovloc,hl);
g_call_system_proc(list,'fpc_overflow',[],nil);
hlcg.g_maybe_checkforexceptions(current_asmdata.CurrAsmList);
list.concat(taicpu.op_none(a_end_block));
a_label(list,hl);
end;

View File

@ -162,6 +162,7 @@ implementation
current_asmdata.CurrAsmList.concat(taicpu.op_none(a_block));
hlcg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,resultdef,OC_NE,-1,tmpreg,lab);
hlcg.g_call_system_proc(current_asmdata.CurrAsmList,'fpc_overflow',[],nil);
hlcg.g_maybe_checkforexceptions(current_asmdata.CurrAsmList);
hlcg.a_label(current_asmdata.CurrAsmList,lab);
current_asmdata.CurrAsmList.concat(taicpu.op_none(a_end_block));
end;
@ -228,6 +229,7 @@ implementation
current_asmdata.CurrAsmList.concat(taicpu.op_none(a_block));
hlcg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,resultdef,OC_NE,torddef(resultdef).low.svalue,left.location.register,hl);
hlcg.g_call_system_proc(current_asmdata.CurrAsmList,'fpc_overflow',[],nil).resetiftemp;
hlcg.g_maybe_checkforexceptions(current_asmdata.CurrAsmList);
hlcg.a_label(current_asmdata.CurrAsmList,hl);
current_asmdata.CurrAsmList.concat(taicpu.op_none(a_end_block));
end;