+ introduced TWasmValidationStacks.PushCtrl

This commit is contained in:
Nikolay Nikolov 2024-01-31 02:25:44 +02:00
parent 18c6e13f45
commit 4cc5cf4d0e

View File

@ -98,6 +98,8 @@ uses
function PopVal(expect: TWasmBasicType): TWasmBasicType;
procedure PushVals(vals: TWasmBasicTypeList);
function PopVals(vals: TWasmBasicTypeList): TWasmBasicTypeList;
procedure PushCtrl(_opcode: tasmop; _in, _out: TWasmBasicTypeList);
end;
twasmstruc_stack = class;
@ -499,6 +501,22 @@ uses
Result[I]:=PopVal(vals[I]);
end;
procedure TWasmValidationStacks.PushCtrl(_opcode: tasmop; _in, _out: TWasmBasicTypeList);
var
frame: TWasmControlFrame;
begin
FillChar(frame,SizeOf(frame),0);
with frame do
begin
opcode:=_opcode;
start_types:=Copy(_in);
end_types:=Copy(_out);
height:=FValueStack.Count;
unreachable:=False;
end;
FCtrlStack.Push(frame);
end;
{ twasmstruc_stack }
function twasmstruc_stack.Get(Index: Integer): taicpu_wasm_structured_instruction;