Browse Source

[PATCH 156/188] normalizing call_indirect index

From 1c745e12ed007214835dd1286d51f4dc82b69dc8 Mon Sep 17 00:00:00 2001
From: Dmitry Boyarintsev <[email protected]>
Date: Fri, 27 Mar 2020 09:06:48 -0400

git-svn-id: branches/wasm@46152 -
nickysn 5 years ago
parent
commit
260a3a3061
1 changed files with 6 additions and 2 deletions
  1. 6 2
      utils/wasmbin/wasmnormalize.pas

+ 6 - 2
utils/wasmbin/wasmnormalize.pas

@@ -104,8 +104,12 @@ begin
 
 
         INST_call_indirect:
         INST_call_indirect:
         begin
         begin
-          if Assigned(ci.insttype) and (ci.insttype.typeNum<0) then
-            ci.insttype.typeNum:=RegisterFuncType(m, ci.insttype);
+          if Assigned(ci.insttype) and (ci.insttype.typeNum<0) then begin
+            if ci.insttype.typeIdx <> '' then
+              ci.insttype.typeNum:=FindFuncType(m, ci.insttype.typeIdx)
+            else
+              ci.insttype.typeNum:=RegisterFuncType(m, ci.insttype);
+          end;
         end;
         end;
 
 
         INST_br, INST_br_if, INST_br_table: begin
         INST_br, INST_br_if, INST_br_table: begin