[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
for j:=0 to el.funcCount-1 do begin
AddReloc(R_WASM_FUNCTION_INDEX_LEB, dst.Position - sc.datapos, el.funcs[j]);
WriteRelocU32(el.funcs[j]);
AddReloc(R_WASM_FUNCTION_INDEX_LEB, dst.Position - sc.datapos, el.funcs[j].idNum);
WriteRelocU32(el.funcs[j].idNum);
end;
end else
for j:=0 to el.funcCount-1 do
WriteU32(dst, el.funcs[j]);
WriteU32(dst, el.funcs[j].idNum);
end;
SectionEnd(sc);

View File

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