[PATCH 104/188] using TWasmId type for elements

From f17f4d7de1bd5337670989c30c5713f86416f9b7 Mon Sep 17 00:00:00 2001
From: Dmitry Boyarintsev <skalogryz.lists@gmail.com>
Date: Tue, 17 Mar 2020 15:42:51 -0400

git-svn-id: branches/wasm@46100 -
This commit is contained in:
nickysn 2020-08-03 13:00:53 +00:00
parent bd3d37552f
commit 6cb77ca590
2 changed files with 13 additions and 13 deletions

View File

@ -452,12 +452,12 @@ begin
if writeReloc then begin if writeReloc then begin
for j:=0 to el.funcCount-1 do begin for j:=0 to el.funcCount-1 do begin
AddReloc(R_WASM_FUNCTION_INDEX_LEB, dst.Position - sc.datapos, el.funcs[j]); AddReloc(R_WASM_FUNCTION_INDEX_LEB, dst.Position - sc.datapos, el.funcs[j].idNum);
WriteRelocU32(el.funcs[j]); WriteRelocU32(el.funcs[j].idNum);
end; end;
end else end else
for j:=0 to el.funcCount-1 do for j:=0 to el.funcCount-1 do
WriteU32(dst, el.funcs[j]); WriteU32(dst, el.funcs[j].idNum);
end; end;
SectionEnd(sc); SectionEnd(sc);

View File

@ -25,6 +25,13 @@ type
name : string; name : string;
end; end;
{ TWasmId }
TWasmId = record
idNum : integer;
id : string;
end;
{ TWasmParam } { TWasmParam }
TWasmParam = class(TObject) TWasmParam = class(TObject)
@ -121,7 +128,7 @@ type
tableIdx : Integer; tableIdx : Integer;
offset : Integer; offset : Integer;
funcCount : Integer; funcCount : Integer;
funcs : array of LongWord; funcs : array of TWasmId;
function AddFunc(idx: integer): integer; function AddFunc(idx: integer): integer;
constructor Create; constructor Create;
end; end;
@ -146,13 +153,6 @@ type
function AddFunc: TWasmFunc; function AddFunc: TWasmFunc;
end; end;
{ TWasmId }
TWasmId = record
idNum : integer;
id : string;
end;
{ TWasmTable } { TWasmTable }
TWasmTable = class(TObject) TWasmTable = class(TObject)
@ -284,7 +284,7 @@ begin
else SetLength(funcs, funcCount*2); else SetLength(funcs, funcCount*2);
end; end;
Result:=funcCount; Result:=funcCount;
funcs[funcCount]:=idx; funcs[funcCount].idNum :=idx;
inc(funcCount); inc(funcCount);
end; end;
@ -870,7 +870,7 @@ begin
el := m.GetElement(0); el := m.GetElement(0);
Result:=-1; Result:=-1;
for i:=0 to el.funcCount-1 do begin for i:=0 to el.funcCount-1 do begin
if el.funcs[i] = func then if el.funcs[i].idNum = func then
Result:=i; Result:=i;
end; end;
if Result<0 then if Result<0 then