+ support the BR and BR_IF instructions in TWasmValidationStacks.Validate

This commit is contained in:
Nikolay Nikolov 2024-02-25 13:52:34 +02:00
parent 13f58fe343
commit 0ae014a98f

View File

@ -641,6 +641,7 @@ uses
var
frame: TWasmControlFrame;
n: TCGInt;
begin
case a.opcode of
a_nop:
@ -1084,6 +1085,31 @@ uses
internalerror(2024022515);
PushVals(frame.end_types);
end;
a_br:
begin
if a.ops<>1 then
internalerror(2024022516);
if a.oper[0]^.typ<>top_const then
internalerror(2024022517);
n:=a.oper[0]^.val;
if FCtrlStack.Count < n then
internalerror(2024022518);
PopVals(label_types(FCtrlStack[n]));
Unreachable;
end;
a_br_if:
begin
if a.ops<>1 then
internalerror(2024022519);
if a.oper[0]^.typ<>top_const then
internalerror(2024022520);
n:=a.oper[0]^.val;
if FCtrlStack.Count < n then
internalerror(2024022521);
PopVal(wbt_i32);
PopVals(label_types(FCtrlStack[n]));
PushVals(label_types(FCtrlStack[n]));
end;
else
internalerror(2024030502);
end;