|
@@ -127,7 +127,7 @@ type
|
|
|
|
|
|
TWasmFunc = class(TObject)
|
|
TWasmFunc = class(TObject)
|
|
public
|
|
public
|
|
- locals : TList;
|
|
|
|
|
|
+ locals : TList;
|
|
LinkInfo : TLinkInfo;
|
|
LinkInfo : TLinkInfo;
|
|
id : string;
|
|
id : string;
|
|
idNum : Integer; // reference number (after Normalization)
|
|
idNum : Integer; // reference number (after Normalization)
|
|
@@ -268,6 +268,7 @@ type
|
|
function WasmBasTypeToChar(b: byte): Char;
|
|
function WasmBasTypeToChar(b: byte): Char;
|
|
function WasmFuncTypeDescr(t: TWasmFuncType): string;
|
|
function WasmFuncTypeDescr(t: TWasmFuncType): string;
|
|
|
|
|
|
|
|
+function FindGlobal(m: TWasmModule; const globIdx: string): integer;
|
|
function FindFunc(m: TWasmModule; const funcIdx: string): integer;
|
|
function FindFunc(m: TWasmModule; const funcIdx: string): integer;
|
|
function FindParam(l: TList; const idx: string): Integer;
|
|
function FindParam(l: TList; const idx: string): Integer;
|
|
|
|
|
|
@@ -896,7 +897,7 @@ begin
|
|
Result:=i;
|
|
Result:=i;
|
|
Exit;
|
|
Exit;
|
|
end;
|
|
end;
|
|
- Result:=i;
|
|
|
|
|
|
+ Result:=-1;
|
|
end;
|
|
end;
|
|
|
|
|
|
// finding functions by funcIdx
|
|
// finding functions by funcIdx
|
|
@@ -921,6 +922,27 @@ begin
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+function FindGlobal(m: TWasmModule; const globIdx: string): integer;
|
|
|
|
+var
|
|
|
|
+ i : integer;
|
|
|
|
+ im : TWasmImport;
|
|
|
|
+begin
|
|
|
|
+ Result:=-1;
|
|
|
|
+ {for i:=0 to m.ImportCount-1 do begin
|
|
|
|
+ im:=m.GetImport(i);
|
|
|
|
+ if Assigned(im.fn) and (im.fn.id = funcIdx) then begin
|
|
|
|
+ Result:=im.fn.idNum;
|
|
|
|
+ Exit;
|
|
|
|
+ end;
|
|
|
|
+ end;}
|
|
|
|
+
|
|
|
|
+ for i:=0 to m.GlobalCount-1 do
|
|
|
|
+ if m.GetGlobal(i).id.id = globIdx then begin
|
|
|
|
+ Result:=m.GetGlobal(i).id.idNum;
|
|
|
|
+ Exit;
|
|
|
|
+ end;
|
|
|
|
+end;
|
|
|
|
+
|
|
// only looking up for the by the type index name
|
|
// only looking up for the by the type index name
|
|
function FindFuncType(m: TWasmModule; const typeIdx: string): integer;
|
|
function FindFuncType(m: TWasmModule; const typeIdx: string): integer;
|
|
var
|
|
var
|