[PATCH 082/188] writing out constant parameters

From f628b39868ab7547b215ee2fd92164484909e1b7 Mon Sep 17 00:00:00 2001
From: Dmitry Boyarintsev <skalogryz.lists@gmail.com>
Date: Mon, 9 Mar 2020 10:59:49 -0400

git-svn-id: branches/wasm@46078 -
This commit is contained in:
nickysn 2020-08-03 13:00:10 +00:00
parent 8117cba863
commit 4f7ba10fe1
2 changed files with 21 additions and 1 deletions

View File

@ -461,15 +461,35 @@ begin
end;
end;
procedure TBinWriter.WriteInstList(list: TWasmInstrList; ofsAddition: LongWord);
var
i : integer;
ci : TWasmInstr;
u32 : LongWord;
i32 : LongWord;
err : integer;
begin
for i:=0 to list.Count-1 do begin
ci :=list[i];
dst.WriteByte(ci.code);
case INST_FLAGS[ci.code].Param of
ipi32: begin
Val(ci.operandText, u32, err);
if err = 0 then begin
WriteU32(dst, u32);
end else begin
Val(ci.operandText, i32, err);
if err = 0 then WriteU32(dst, i32);
end;
end;
ipi64, // signed Leb of maximum 8 bytes
ipf32, // float point single
ipf64, // float point double
ipLeb:
if INST_RELOC_FLAGS[ci.code].doReloc then begin
AddReloc(INST_RELOC_FLAGS[ci.code].relocType, dst.Position+ofsAddition, ci.operandNum);

View File

@ -629,7 +629,7 @@ begin
INST_CALL:
begin
if (ci.operandIdx<>'') and ( ci.operandNum<0) then
if (ci.operandIdx<>'') and (ci.operandNum<0) then
ci.operandNum:=FindFunc(m,ci.operandIdx);
end;
end;