|
@@ -137,6 +137,8 @@ type
|
|
funcCount : Integer;
|
|
funcCount : Integer;
|
|
funcs : array of TWasmId;
|
|
funcs : array of TWasmId;
|
|
function AddFunc(idx: integer): integer;
|
|
function AddFunc(idx: integer): integer;
|
|
|
|
+ function AddFuncId(const idx: TWasmID): integer;
|
|
|
|
+ function AddOffset: TWasmInstrList;
|
|
constructor Create;
|
|
constructor Create;
|
|
destructor Destroy; override;
|
|
destructor Destroy; override;
|
|
end;
|
|
end;
|
|
@@ -168,6 +170,9 @@ type
|
|
elemsType : Byte; // type of elements
|
|
elemsType : Byte; // type of elements
|
|
min : LongWord;
|
|
min : LongWord;
|
|
max : LongWord;
|
|
max : LongWord;
|
|
|
|
+ elem : TWasmElement;
|
|
|
|
+ function AddElem: TWasmElement;
|
|
|
|
+ destructor Destroy; override;
|
|
end;
|
|
end;
|
|
|
|
|
|
{ TWasmData }
|
|
{ TWasmData }
|
|
@@ -321,6 +326,21 @@ begin
|
|
l.Clear;
|
|
l.Clear;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+{ TWasmTable }
|
|
|
|
+
|
|
|
|
+function TWasmTable.AddElem: TWasmElement;
|
|
|
|
+begin
|
|
|
|
+ if not Assigned(elem) then
|
|
|
|
+ elem:= TWasmElement.Create;
|
|
|
|
+ Result := elem;
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+destructor TWasmTable.Destroy;
|
|
|
|
+begin
|
|
|
|
+ elem.Free;
|
|
|
|
+ inherited Destroy;
|
|
|
|
+end;
|
|
|
|
+
|
|
{ TWasmData }
|
|
{ TWasmData }
|
|
|
|
|
|
function TWasmData.StartOffset: TWasmInstrList;
|
|
function TWasmData.StartOffset: TWasmInstrList;
|
|
@@ -339,16 +359,31 @@ end;
|
|
{ TWasmElement }
|
|
{ TWasmElement }
|
|
|
|
|
|
function TWasmElement.AddFunc(idx: integer): integer;
|
|
function TWasmElement.AddFunc(idx: integer): integer;
|
|
|
|
+var
|
|
|
|
+ w : TWasmId;
|
|
|
|
+begin
|
|
|
|
+ w.id:='';
|
|
|
|
+ w.idNum:=idx;
|
|
|
|
+ AddFuncId(w);
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+function TWasmElement.AddFuncId(const idx: TWasmID): integer;
|
|
begin
|
|
begin
|
|
if funcCount = length(funcs) then begin
|
|
if funcCount = length(funcs) then begin
|
|
if funcCount=0 then SetLength(funcs, 4)
|
|
if funcCount=0 then SetLength(funcs, 4)
|
|
else SetLength(funcs, funcCount*2);
|
|
else SetLength(funcs, funcCount*2);
|
|
end;
|
|
end;
|
|
Result:=funcCount;
|
|
Result:=funcCount;
|
|
- funcs[funcCount].idNum :=idx;
|
|
|
|
|
|
+ funcs[funcCount] := idx;
|
|
inc(funcCount);
|
|
inc(funcCount);
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+function TWasmElement.AddOffset: TWasmInstrList;
|
|
|
|
+begin
|
|
|
|
+ if not Assigned(offset) then offset:=TWasmInstrList.Create;
|
|
|
|
+ Result := offset;
|
|
|
|
+end;
|
|
|
|
+
|
|
constructor TWasmElement.Create;
|
|
constructor TWasmElement.Create;
|
|
begin
|
|
begin
|
|
inherited Create;
|
|
inherited Create;
|