mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-16 18:59:11 +02:00
[PATCH 154/188] normalizing table limit, if set to zero, making
minmax to element From b13b522b323f3a996b3548a7e15eb0c432a844a7 Mon Sep 17 00:00:00 2001 From: Dmitry Boyarintsev <skalogryz.lists@gmail.com> Date: Thu, 26 Mar 2020 16:59:02 -0400 git-svn-id: branches/wasm@46150 -
This commit is contained in:
parent
be37f0577e
commit
e4674b03b4
@ -193,6 +193,26 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure NormalizeTableLimit(m: TWasmModule);
|
||||||
|
var
|
||||||
|
i : integer;
|
||||||
|
elCount : integer;
|
||||||
|
t : TWasmTable;
|
||||||
|
begin
|
||||||
|
elCount:=0;
|
||||||
|
for i:=0 to m.ElementCount-1 do
|
||||||
|
inc(elCount, m.GetElement(i).funcCount );
|
||||||
|
|
||||||
|
for i:=0 to m.TableCount-1 do begin
|
||||||
|
t := m.GetTable(i);
|
||||||
|
if (t.min=0) and (t.max=0) then begin
|
||||||
|
t.min := elCount;
|
||||||
|
t.max := elCount;
|
||||||
|
Break;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure NormalizeElems(m: TWasmModule);
|
procedure NormalizeElems(m: TWasmModule);
|
||||||
var
|
var
|
||||||
i : integer;
|
i : integer;
|
||||||
@ -220,6 +240,7 @@ begin
|
|||||||
NormalizeTable(m);
|
NormalizeTable(m);
|
||||||
NormalizeElems(m);
|
NormalizeElems(m);
|
||||||
NormalizeImport(m, fnIdx);
|
NormalizeImport(m, fnIdx);
|
||||||
|
NormalizeTableLimit(m);
|
||||||
|
|
||||||
for i:=0 to m.FuncCount-1 do begin
|
for i:=0 to m.FuncCount-1 do begin
|
||||||
f:=m.GetFunc(i);
|
f:=m.GetFunc(i);
|
||||||
|
Loading…
Reference in New Issue
Block a user