Skip to content

Commit 1dcc59f

Browse files
authored
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.
1 parent 5586f7b commit 1dcc59f

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

core/iwasm/fast-jit/jit_ir.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -474,8 +474,10 @@ jit_cc_destroy(JitCompContext *cc)
474474
}
475475

476476
/* Release entry and exit blocks. */
477-
jit_basic_block_delete(jit_cc_entry_basic_block(cc));
478-
jit_basic_block_delete(jit_cc_exit_basic_block(cc));
477+
if (0 != cc->entry_label)
478+
jit_basic_block_delete(jit_cc_entry_basic_block(cc));
479+
if (0 != cc->exit_label)
480+
jit_basic_block_delete(jit_cc_exit_basic_block(cc));
479481

480482
/* clang-format off */
481483
/* Release blocks and instructions. */

0 commit comments

Comments
 (0)