|
@@ -96,6 +96,19 @@ begin
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+ INST_global_get, INST_global_set:
|
|
|
|
+ begin
|
|
|
|
+ if not Assigned(f) then begin
|
|
|
|
+ Result:=false;
|
|
|
|
+ Exit;
|
|
|
|
+ end;
|
|
|
|
+
|
|
|
|
+ if (ci.operandIdx<>'') and (ci.operandNum<0) then begin
|
|
|
|
+ j:=FindGlobal(m, ci.operandIdx);
|
|
|
|
+ ci.operandNum:=j;
|
|
|
|
+ end;
|
|
|
|
+ end;
|
|
|
|
+
|
|
INST_call:
|
|
INST_call:
|
|
begin
|
|
begin
|
|
if (ci.operandIdx<>'') and (ci.operandNum<0) then
|
|
if (ci.operandIdx<>'') and (ci.operandNum<0) then
|
|
@@ -166,6 +179,14 @@ begin
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+procedure NormalizeGlobals(m: TWasmModule);
|
|
|
|
+var
|
|
|
|
+ i : integer;
|
|
|
|
+begin
|
|
|
|
+ for i:=0 to m.GlobalCount-1 do
|
|
|
|
+ m.GetGlobal(i).id.idNum:=i;
|
|
|
|
+end;
|
|
|
|
+
|
|
procedure NormalizeTable(m: TWasmModule);
|
|
procedure NormalizeTable(m: TWasmModule);
|
|
var
|
|
var
|
|
i : integer;
|
|
i : integer;
|
|
@@ -241,6 +262,7 @@ var
|
|
fnIdx : Integer;
|
|
fnIdx : Integer;
|
|
begin
|
|
begin
|
|
fnIdx := 0;
|
|
fnIdx := 0;
|
|
|
|
+ NormalizeGlobals(m);
|
|
NormalizeTable(m);
|
|
NormalizeTable(m);
|
|
NormalizeElems(m);
|
|
NormalizeElems(m);
|
|
NormalizeImport(m, fnIdx);
|
|
NormalizeImport(m, fnIdx);
|