|
@@ -770,9 +770,15 @@ var
|
|
i : integer;
|
|
i : integer;
|
|
j : integer;
|
|
j : integer;
|
|
ci : TWasmInstr;
|
|
ci : TWasmInstr;
|
|
|
|
+ endNeed : Integer;
|
|
begin
|
|
begin
|
|
|
|
+ endNeed := 1;
|
|
for i:=0 to l.Count-1 do begin
|
|
for i:=0 to l.Count-1 do begin
|
|
ci:=l[i];
|
|
ci:=l[i];
|
|
|
|
+
|
|
|
|
+ if INST_FLAGS[ci.code].Param = ipResType then
|
|
|
|
+ inc(endNeed);
|
|
|
|
+
|
|
case ci.code of
|
|
case ci.code of
|
|
INST_local_get, INST_local_set, INST_local_tee:
|
|
INST_local_get, INST_local_set, INST_local_tee:
|
|
begin
|
|
begin
|
|
@@ -797,13 +803,15 @@ begin
|
|
if Assigned(ci.insttype) and (ci.insttype.typeNum<0) then
|
|
if Assigned(ci.insttype) and (ci.insttype.typeNum<0) then
|
|
ci.insttype.typeNum:=RegisterFuncType(m, ci.insttype);
|
|
ci.insttype.typeNum:=RegisterFuncType(m, ci.insttype);
|
|
end;
|
|
end;
|
|
|
|
+
|
|
|
|
+ INST_END: dec(endNeed);
|
|
end;
|
|
end;
|
|
|
|
|
|
PopulateRelocData(m, ci);
|
|
PopulateRelocData(m, ci);
|
|
end;
|
|
end;
|
|
|
|
|
|
// adding end instruction
|
|
// adding end instruction
|
|
- if checkEnd and (l.Count>0) and (l[l.Count-1].code<>INST_END) then
|
|
|
|
|
|
+ if checkEnd and (endNeed>0) then
|
|
l.AddInstr(INST_END);
|
|
l.AddInstr(INST_END);
|
|
end;
|
|
end;
|
|
|
|
|