+ added TWasmControlStack and frame. Not used, yet. Will be used in the future

for WebAssembly stack tracking and validation.
This commit is contained in:
Nikolay Nikolov 2024-01-22 10:14:43 +02:00
parent e0a5d07e37
commit fadf43a33b

View File

@ -55,6 +55,34 @@ uses
property Items[AIndex: Integer]: TWasmBasicType read GetItems write SetItems; default;
end;
{ TWasmControlFrame }
TWasmControlFrame = class
opcode: tasmop;
start_types: array of TWasmBasicType;
end_types: array of TWasmBasicType;
height: Integer;
unreachable: Boolean;
end;
{ TWasmControlStack }
TWasmControlStack = class
end;
{ TWasmValidationStacks }
TWasmValidationStacks = class
private
FValueStack: TWasmValueStack;
FCtrlStack: TWasmControlStack;
public
constructor Create;
destructor Destroy; override;
procedure PushVal(vt: TWasmBasicType);
end;
twasmstruc_stack = class;
TAsmMapFuncResultType = (amfrtNoChange, amfrtNewAi, amfrtNewList, amfrtDeleteAi);
TAsmMapFuncResult = record
@ -346,6 +374,26 @@ uses
SetLength(FValStack,Length(FValStack)-1);
end;
{ TWasmValidationStacks }
constructor TWasmValidationStacks.Create;
begin
FValueStack:=TWasmValueStack.Create;
FCtrlStack:=TWasmControlStack.Create;
end;
destructor TWasmValidationStacks.Destroy;
begin
FValueStack.Free;
FCtrlStack.Free;
inherited Destroy;
end;
procedure TWasmValidationStacks.PushVal(vt: TWasmBasicType);
begin
FValueStack.Push(vt);
end;
{ twasmstruc_stack }
function twasmstruc_stack.Get(Index: Integer): taicpu_wasm_structured_instruction;