mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-22 11:49:23 +02:00
[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:
parent
bd3d37552f
commit
6cb77ca590
@ -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);
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user