+ insert try and end_try instructions in the try..finally code in native

WebAssembly exceptions mode
This commit is contained in:
Nikolay Nikolov 2021-09-17 21:09:17 +03:00
parent 45e53ddc16
commit 619a27cbfc

View File

@ -605,6 +605,10 @@ implementation
thlcgwasm(hlcg).loopContBr:=thlcgwasm(hlcg).br_blocks;
end;
{ the inner 'try..end_try' block }
current_asmdata.CurrAsmList.concat(taicpu.op_none(a_try));
thlcgwasm(hlcg).incblock;
{ try code }
if assigned(left) then
begin
@ -620,7 +624,11 @@ implementation
{ we've reached the end of the 'try' block, with no exceptions/exit/break/continue, so set exceptionreason:=0 }
hlcg.g_exception_reason_save_const(current_asmdata.CurrAsmList,exceptionreasontype,0,excepttemps.reasonbuf);
current_asmdata.CurrAsmList.concat(taicpu.op_const(a_br,3)); // jump to the 'finally' section
current_asmdata.CurrAsmList.concat(taicpu.op_const(a_br,4)); // jump to the 'finally' section
{ exit the inner 'try..end_try' block }
current_asmdata.CurrAsmList.concat(taicpu.op_none(a_end_try));
thlcgwasm(hlcg).decblock;
{ exit the 'continue' block }
current_asmdata.CurrAsmList.concat(taicpu.op_none(a_end_block));