Browse Source

[PATCH 116/188] normalization of the block type

From 641f9387b8b5be52af1d4f0f51bfcbd0f98751ff Mon Sep 17 00:00:00 2001
From: Dmitry Boyarintsev <[email protected]>
Date: Wed, 18 Mar 2020 14:46:27 -0400

git-svn-id: branches/wasm@46112 -
nickysn 5 years ago
parent
commit
aaba4e1e79
1 changed files with 6 additions and 0 deletions
  1. 6 0
      utils/wasmbin/wasmmodule.pas

+ 6 - 0
utils/wasmbin/wasmmodule.pas

@@ -771,13 +771,19 @@ var
   j   : integer;
   ci  : TWasmInstr;
   endNeed : Integer;
+const
+  ValidResTypes = [VALTYPE_NONE,VALTYPE_I32,VALTYPE_I64,VALTYPE_F32,VALTYPE_F64];
 begin
   endNeed := 1;
   for i:=0 to l.Count-1 do begin
     ci:=l[i];
 
     if INST_FLAGS[ci.code].Param = ipResType then
+    begin
       inc(endNeed);
+      if not byte(ci.operandNum) in ValidResTypes then
+        ci.operandNum := VALTYPE_NONE;
+    end;
 
     case ci.code of
       INST_local_get, INST_local_set, INST_local_tee: