[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:
nickysn 2020-08-03 13:01:46 +00:00
parent be37f0577e
commit e4674b03b4

View File

@ -193,6 +193,26 @@ begin
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);
var
i : integer;
@ -220,6 +240,7 @@ begin
NormalizeTable(m);
NormalizeElems(m);
NormalizeImport(m, fnIdx);
NormalizeTableLimit(m);
for i:=0 to m.FuncCount-1 do begin
f:=m.GetFunc(i);