@@ -5349,8 +5349,8 @@ void *ir_emit_code(ir_ctx *ctx, size_t *size_ptr)
5349
5349
dasm_init(&data.dasm_state, DASM_MAXSECTION);
5350
5350
dasm_setupglobal(&data.dasm_state, dasm_labels, ir_lb_MAX);
5351
5351
dasm_setup(&data.dasm_state, dasm_actions);
5352
- /* labels for each block + for each constant + rodata label + jmp_table label + for each entry */
5353
- dasm_growpc(&data.dasm_state, ctx->cfg_blocks_count + 1 + ctx->consts_count + 1 + 1 + 1 + ctx->entries_count);
5352
+ /* labels for each block + for each constant + rodata label + jmp_table label + for each entry + exit_table label */
5353
+ dasm_growpc(&data.dasm_state, ctx->cfg_blocks_count + 1 + ctx->consts_count + 1 + 1 + 1 + ctx->entries_count + 1 );
5354
5354
data.emit_constants = ir_bitset_malloc(ctx->consts_count);
5355
5355
5356
5356
if (!(ctx->flags & IR_SKIP_PROLOGUE)) {
@@ -5607,6 +5607,9 @@ void *ir_emit_code(ir_ctx *ctx, size_t *size_ptr)
5607
5607
}
5608
5608
5609
5609
if (ctx->deoptimization_exits) {
5610
+ uint32_t exit_table_label = ctx->cfg_blocks_count + 1 + ctx->consts_count + 1 + 1 + 1 + ctx->entries_count;
5611
+
5612
+ |=>exit_table_label:
5610
5613
for (i = 0; i < ctx->deoptimization_exits; i++) {
5611
5614
const void *exit_addr = ctx->get_exit_addr(i);
5612
5615
@@ -5757,6 +5760,12 @@ void *ir_emit_code(ir_ctx *ctx, size_t *size_ptr)
5757
5760
ir_mem_unprotect(entry, size);
5758
5761
}
5759
5762
5763
+ if (ctx->deoptimization_exits) {
5764
+ uint32_t exit_table_label = ctx->cfg_blocks_count + 1 + ctx->consts_count + 1 + 1 + 1 + ctx->entries_count;
5765
+
5766
+ ctx->deoptimization_exits_base = (const void*)((char*)entry + dasm_getpclabel(&data.dasm_state, exit_table_label));
5767
+ }
5768
+
5760
5769
ir_current_ctx = ctx;
5761
5770
ret = dasm_encode(&data.dasm_state, entry);
5762
5771
if (ret != DASM_S_OK) {
0 commit comments