Просмотр исходного кода

Fix fast jit destroy entry/exit basic block issue in jit_cc_destroy (#1401)

The entry and exit basic blocks might be destroyed before they are created.
Found by instrument test. Add checks to fix the issue.
Qiang 3 лет назад
Родитель
Сommit
1dcc59f234
1 измененных файлов с 4 добавлено и 2 удалено
  1. 4 2
      core/iwasm/fast-jit/jit_ir.c

+ 4 - 2
core/iwasm/fast-jit/jit_ir.c

@@ -474,8 +474,10 @@ jit_cc_destroy(JitCompContext *cc)
     }
 
     /* Release entry and exit blocks.  */
-    jit_basic_block_delete(jit_cc_entry_basic_block(cc));
-    jit_basic_block_delete(jit_cc_exit_basic_block(cc));
+    if (0 != cc->entry_label)
+        jit_basic_block_delete(jit_cc_entry_basic_block(cc));
+    if (0 != cc->exit_label)
+        jit_basic_block_delete(jit_cc_exit_basic_block(cc));
 
     /* clang-format off */
     /* Release blocks and instructions.  */