+ more consistency checks for unexpected instructions when converting to wasm structured instruction form

This commit is contained in:
Nikolay Nikolov 2023-10-05 20:24:43 +03:00
parent 089e7ca6c8
commit 84f0b94549

View File

@ -272,7 +272,7 @@ uses
p:=tai(srclist.First); p:=tai(srclist.First);
if not assigned(p) then if not assigned(p) then
internalerror(2023100302); internalerror(2023100302);
if (p.typ=ait_instruction) and (taicpu(p).opcode in [a_else,a_end_if]) then if (p.typ=ait_instruction) and (taicpu(p).opcode in [a_else,a_end_if,a_end_block,a_end_loop,a_end_try,a_catch,a_catch_all]) then
begin begin
srclist.Remove(p); srclist.Remove(p);
case taicpu(p).opcode of case taicpu(p).opcode of
@ -539,12 +539,10 @@ uses
Done:=False; Done:=False;
repeat repeat
pp:=tai(srclist.First); pp:=tai(srclist.First);
if (pp.typ=ait_instruction) and (taicpu(pp).opcode in [a_catch,a_catch_all,a_end_try]) then if (pp.typ=ait_instruction) and (taicpu(pp).opcode=a_end_try) then
begin begin
srclist.Remove(pp); srclist.Remove(pp);
Done:=True; Done:=True;
if taicpu(pp).opcode in [a_catch,a_catch_all] then
internalerror(2023100313);
end end
else else
catch_all_asmlist.Concat(wasm_convert_first_item_to_structured(srclist)); catch_all_asmlist.Concat(wasm_convert_first_item_to_structured(srclist));