mirror of
https://github.com/danog/ir.git
synced 2025-01-22 05:31:32 +01:00
Restore ability to reach "local" exit table base address
This commit is contained in:
parent
dab739f3d2
commit
eeed93083e
3
ir.h
3
ir.h
@ -547,7 +547,7 @@ struct _ir_ctx {
|
||||
ir_ref consts_count; /* number of constants stored in constants buffer */
|
||||
ir_ref consts_limit; /* size of allocated constants buffer (it's extended when overflow) */
|
||||
uint32_t flags; /* IR context flags (see IR_* defines above) */
|
||||
uint32_t flags2; /* IR context provate flags (see IR_* defines in ir_private.h) */
|
||||
uint32_t flags2; /* IR context private flags (see IR_* defines in ir_private.h) */
|
||||
ir_type ret_type; /* Function return type */
|
||||
uint32_t mflags; /* CPU specific flags (see IR_X86_... macros below) */
|
||||
int32_t status; /* non-zero error code (see IR_ERROR_... macros), app may use negative codes */
|
||||
@ -602,6 +602,7 @@ struct _ir_ctx {
|
||||
ir_code_buffer *code_buffer;
|
||||
#if defined(IR_TARGET_AARCH64)
|
||||
int32_t deoptimization_exits;
|
||||
const void *deoptimization_exits_base;
|
||||
ir_get_exit_addr_t get_exit_addr;
|
||||
ir_get_veneer_t get_veneer;
|
||||
ir_set_veneer_t set_veneer;
|
||||
|
@ -5349,8 +5349,8 @@ void *ir_emit_code(ir_ctx *ctx, size_t *size_ptr)
|
||||
dasm_init(&data.dasm_state, DASM_MAXSECTION);
|
||||
dasm_setupglobal(&data.dasm_state, dasm_labels, ir_lb_MAX);
|
||||
dasm_setup(&data.dasm_state, dasm_actions);
|
||||
/* labels for each block + for each constant + rodata label + jmp_table label + for each entry */
|
||||
dasm_growpc(&data.dasm_state, ctx->cfg_blocks_count + 1 + ctx->consts_count + 1 + 1 + 1 + ctx->entries_count);
|
||||
/* labels for each block + for each constant + rodata label + jmp_table label + for each entry + exit_table label */
|
||||
dasm_growpc(&data.dasm_state, ctx->cfg_blocks_count + 1 + ctx->consts_count + 1 + 1 + 1 + ctx->entries_count + 1);
|
||||
data.emit_constants = ir_bitset_malloc(ctx->consts_count);
|
||||
|
||||
if (!(ctx->flags & IR_SKIP_PROLOGUE)) {
|
||||
@ -5607,6 +5607,9 @@ void *ir_emit_code(ir_ctx *ctx, size_t *size_ptr)
|
||||
}
|
||||
|
||||
if (ctx->deoptimization_exits) {
|
||||
uint32_t exit_table_label = ctx->cfg_blocks_count + 1 + ctx->consts_count + 1 + 1 + 1 + ctx->entries_count;
|
||||
|
||||
|=>exit_table_label:
|
||||
for (i = 0; i < ctx->deoptimization_exits; i++) {
|
||||
const void *exit_addr = ctx->get_exit_addr(i);
|
||||
|
||||
@ -5757,6 +5760,12 @@ void *ir_emit_code(ir_ctx *ctx, size_t *size_ptr)
|
||||
ir_mem_unprotect(entry, size);
|
||||
}
|
||||
|
||||
if (ctx->deoptimization_exits) {
|
||||
uint32_t exit_table_label = ctx->cfg_blocks_count + 1 + ctx->consts_count + 1 + 1 + 1 + ctx->entries_count;
|
||||
|
||||
ctx->deoptimization_exits_base = (const void*)((char*)entry + dasm_getpclabel(&data.dasm_state, exit_table_label));
|
||||
}
|
||||
|
||||
ir_current_ctx = ctx;
|
||||
ret = dasm_encode(&data.dasm_state, entry);
|
||||
if (ret != DASM_S_OK) {
|
||||
|
@ -904,6 +904,8 @@ IR_ALWAYS_INLINE uint32_t ir_insn_len(const ir_insn *insn)
|
||||
#define IR_RA_HAVE_SPLITS (1<<25)
|
||||
#define IR_RA_HAVE_SPILLS (1<<26)
|
||||
|
||||
#define IR_RESERVED_FLAG_1 (1U<<31)
|
||||
|
||||
/*** IR Binding ***/
|
||||
IR_ALWAYS_INLINE ir_ref ir_binding_find(const ir_ctx *ctx, ir_ref ref)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user