[php-src] jit-arm64: Support for tracing JIT
| From: | Dmitry Stogov | Date: | Wed, 28 Apr 2021 19:48:41 +0000 |
| Subject: | [php-src] jit-arm64: Support for tracing JIT | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-115938@lists.php.net to get a copy of this message | ||
Author: Dmitry Stogov (dstogov)
Date: 2021-04-28T22:48:27+03:00
Commit: https://github.com/php/php-src/commit/17c972661f87c50f782b4ce4d2db174f0e51972e
Raw diff: https://github.com/php/php-src/commit/17c972661f87c50f782b4ce4d2db174f0e51972e.diff
Support for tracing JIT
Changed paths:
M ext/opcache/jit/zend_jit_arm64.dasc
M ext/opcache/jit/zend_jit_trace.c
Diff:
diff --git a/ext/opcache/jit/zend_jit_arm64.dasc b/ext/opcache/jit/zend_jit_arm64.dasc
index ad97a6cfed6d..82573c34dae0 100644
--- a/ext/opcache/jit/zend_jit_arm64.dasc
+++ b/ext/opcache/jit/zend_jit_arm64.dasc
@@ -1711,7 +1711,15 @@ static int zend_jit_exception_handler_stub(dasm_State **Dst)
| ldp x29, x30, [sp], #SPAD // stack alignment
| EXT_JMP handler, REG0
} else if (JIT_G(trigger) == ZEND_JIT_ON_HOT_TRACE) {
- | NIY_STUB // TODO: tracing
+ | mov FCARG1x, FP
+ | EXT_CALL handler, REG0
+ | ldp FP, RX, T2 // retore FP and IP
+ | ldp x29, x30, [sp], #NR_SPAD // stack alignment
+ | tst RETVALw, RETVALw
+ | blt >1
+ | mov RETVALw, #1 // ZEND_VM_ENTER
+ |1:
+ | ret
} else {
| mov FCARG1x, FP
| ldp FP, RX, T2 // retore FP and IP
@@ -2228,7 +2236,18 @@ static int zend_jit_hybrid_loop_trace_counter_stub(dasm_State **Dst)
static int zend_jit_trace_halt_stub(dasm_State **Dst)
{
|->trace_halt:
- | NIY_STUB // TODO
+ if (zend_jit_vm_kind == ZEND_VM_KIND_HYBRID) {
+ | ADD_HYBRID_SPAD
+ | EXT_JMP zend_jit_halt_op->handler, REG0
+ } else if (GCC_GLOBAL_REGS) {
+ | ldp x29, x30, [sp], #SPAD // stack alignment
+ | ret // PC must be zero
+ } else {
+ | ldp FP, RX, T2 // retore FP and IP
+ | ldp x29, x30, [sp], #NR_SPAD // stack alignment
+ | sub RETVALx, xzr, #1 // ZEND_VM_RETURN (-1)
+ | ret
+ }
return 1;
}
@@ -2908,7 +2927,7 @@ static int zend_jit_patch(const void *code, size_t size, uint32_t
jmp_table_size
delta = (uint32_t*)from_addr - ins_ptr;
if (((ins ^ (uint32_t)delta) & 0x01ffffffu) == 0) {
delta = (uint32_t*)to_addr - ins_ptr;
- if (((delta + 0x02000000) >> 26) == 0) {
+ if (((delta + 0x02000000) >> 26) != 0) {
abort(); // brnach target out of range
}
*ins_ptr = (ins & 0xfc000000u) | ((uint32_t)delta & 0x03ffffffu);
@@ -2920,7 +2939,7 @@ static int zend_jit_patch(const void *code, size_t size, uint32_t
jmp_table_size
delta = (uint32_t*)from_addr - ins_ptr;
if (((ins ^ ((uint32_t)delta << 5)) & 0x00ffffe0u) == 0) {
delta = (uint32_t*)to_addr - ins_ptr;
- if (((delta + 0x80000) >> 19) == 0) {
+ if (((delta + 0x40000) >> 19) != 0) {
abort(); // brnach target out of range
}
*ins_ptr = (ins & 0xff00001fu) | (((uint32_t)delta & 0x7ffffu) << 5);
@@ -2931,7 +2950,7 @@ static int zend_jit_patch(const void *code, size_t size, uint32_t
jmp_table_size
delta = (uint32_t*)from_addr - ins_ptr;
if (((ins ^ ((uint32_t)delta << 5)) & 0x0007ffe0u) == 0) {
delta = (uint32_t*)to_addr - ins_ptr;
- if (((delta + 0x2000) >> 14) == 0) {
+ if (((delta + 0x2000) >> 14) != 0) {
abort(); // brnach target out of range
}
*ins_ptr = (ins & 0xfff8001fu) | (((uint32_t)delta & 0x3fffu) << 5);
@@ -3000,7 +3019,6 @@ static int zend_jit_trace_return(dasm_State **Dst, bool original_handler)
if (!original_handler) {
| JMP_IP TMP1
} else {
- | NIY // TODO: test
| ldr REG0, EX->func
| ldr REG0, [REG0, #offsetof(zend_op_array, reserved[zend_func_info_rid])]
| ldr REG0, [REG0, #offsetof(zend_jit_op_array_trace_extension, offset)]
@@ -3013,7 +3031,6 @@ static int zend_jit_trace_return(dasm_State **Dst, bool original_handler)
if (!original_handler) {
| JMP_IP TMP1
} else {
- | NIY // TODO: test
| ldr REG0, EX->func
| ldr REG0, [REG0, #offsetof(zend_op_array, reserved[zend_func_info_rid])]
| ldr REG0, [REG0, #offsetof(zend_jit_op_array_trace_extension, offset)]
@@ -3023,7 +3040,6 @@ static int zend_jit_trace_return(dasm_State **Dst, bool original_handler)
}
} else {
if (original_handler) {
- | NIY // TODO: test
| mov FCARG1x, FP
| ldr REG0, EX->func
| ldr REG0, [REG0, #offsetof(zend_op_array, reserved[zend_func_info_rid])]
@@ -3137,7 +3153,7 @@ static int zend_jit_trace_handler(dasm_State **Dst, const zend_op_array
*op_arra
} else if (GCC_GLOBAL_REGS) {
| cbz IP, ->trace_halt
} else {
- | tst RETVALx, RETVALx
+ | tst RETVALw, RETVALw
| blt ->trace_halt
}
} else if (opline->opcode == ZEND_EXIT ||
@@ -3315,7 +3331,8 @@ static int zend_jit_trace_opline_guard(dasm_State **Dst, const zend_op
*opline)
if (!exit_addr) {
return 0;
}
- | NIY // TODO
+ | CMP_IP opline, TMP1, TMP2
+ | bne &exit_addr
zend_jit_set_last_valid_opline(opline);
@@ -3476,20 +3493,72 @@ static int zend_jit_update_regs(dasm_State **Dst, uint32_t var,
zend_jit_addr sr
static int zend_jit_escape_if_undef_r0(dasm_State **Dst, int var, uint32_t flags, const zend_op
*opline)
{
- | NIY // TODO
+ zend_jit_addr val_addr = ZEND_ADDR_MEM_ZVAL(ZREG_REG0, 0);
+
+ | IF_NOT_ZVAL_TYPE val_addr, IS_UNDEF, >1, TMP1w, TMP2
+
+ if (flags & ZEND_JIT_EXIT_RESTORE_CALL) {
+ if (!zend_jit_save_call_chain(Dst, -1)) {
+ return 0;
+ }
+ }
+
+ ZEND_ASSERT(opline);
+
+ | LOAD_IP_ADDR (opline - 1)
+ | b ->trace_escape
+ |1:
return 1;
}
static int zend_jit_store_const(dasm_State **Dst, int var, zend_reg reg)
{
- | NIY // TODO
+ zend_jit_addr dst = ZEND_ADDR_MEM_ZVAL(ZREG_FP, EX_NUM_TO_VAR(var));
+
+ if (reg == ZREG_LONG_MIN_MINUS_1) {
+ uint64_t val = 0xc3e0000000000000;
+ | SET_ZVAL_LVAL dst, val, TMP1, TMP2
+ | SET_ZVAL_TYPE_INFO dst, IS_DOUBLE, TMP1w, TMP2
+ } else if (reg == ZREG_LONG_MIN) {
+ uint64_t val = 0x8000000000000000;
+ | SET_ZVAL_LVAL dst, val, TMP1, TMP2
+ | SET_ZVAL_TYPE_INFO dst, IS_LONG, TMP1w, TMP2
+ } else if (reg == ZREG_LONG_MAX) {
+ uint64_t val = 0x7fffffffffffffff;
+ | SET_ZVAL_LVAL dst, val, TMP1, TMP2
+ | SET_ZVAL_TYPE_INFO dst, IS_LONG, TMP1w, TMP2
+ } else if (reg == ZREG_LONG_MAX_PLUS_1) {
+ uint64_t val = 0x43e0000000000000;
+ | SET_ZVAL_LVAL dst, val, TMP1, TMP2
+ | SET_ZVAL_TYPE_INFO dst, IS_DOUBLE, TMP1w, TMP2
+ } else if (reg == ZREG_NULL) {
+ | SET_ZVAL_TYPE_INFO dst, IS_NULL, TMP1w, TMP2
+ } else if (reg == ZREG_ZVAL_TRY_ADDREF) {
+ | IF_NOT_ZVAL_REFCOUNTED dst, >1, ZREG_TMP1, ZREG_TMP2
+ | GET_ZVAL_PTR TMP1, dst, TMP2
+ | GC_ADDREF TMP1, TMP2w
+ |1:
+ } else if (reg == ZREG_ZVAL_COPY_GPR0) {
+ zend_jit_addr val_addr = ZEND_ADDR_MEM_ZVAL(ZREG_REG0, 0);
+
+ | ZVAL_COPY_VALUE dst, -1, val_addr, -1, ZREG_REG1, ZREG_REG2, ZREG_TMP1, ZREG_TMP2, ZREG_FPR0
+ | TRY_ADDREF -1, REG1w, REG2, TMP1w
+ } else {
+ ZEND_UNREACHABLE();
+ }
return 1;
}
static int zend_jit_free_trampoline(dasm_State **Dst)
{
- | NIY // TODO
+ | // if (UNEXPECTED(func->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE))
+ | ldr TMP1w, [REG0, #offsetof(zend_function, common.fn_flags)]
+ | tst TMP1w, #ZEND_ACC_CALL_VIA_TRAMPOLINE
+ | beq >1
+ | mov FCARG1x, REG0
+ | EXT_CALL zend_jit_free_trampoline_helper, REG0
+ |1:
return 1;
}
@@ -8315,7 +8384,43 @@ static int zend_jit_push_call_frame(dasm_State **Dst, const zend_op *opline,
con
| // Z_CE(call->This) = called_scope;
| str xzr, EX:RX->This.value.ptr
} else {
- | NIY // TODO
+ if (opline->op2_type == IS_CV) {
+ | // GC_ADDREF(closure);
+ | ldr TMP1w, [REG0]
+ | add TMP1w, TMP1w, #1
+ | str TMP1w, [REG0]
+ }
+ | // object_or_called_scope = closure->called_scope;
+ | SAFE_MEM_ACC_WITH_UOFFSET ldr, REG1, REG0, offsetof(zend_closure, called_scope), TMP2
+ | str REG1, EX:RX->This.value.ptr
+ | // call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_DYNAMIC | ZEND_CALL_CLOSURE |
+ | // (closure->func->common.fn_flags & ZEND_ACC_FAKE_CLOSURE);
+ | ldr REG2w, [REG0, #offsetof(zend_closure, func.common.fn_flags)]
+ | and REG2w, REG2w, #ZEND_ACC_FAKE_CLOSURE
+ | LOAD_32BIT_VAL TMP1w, (ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_DYNAMIC | ZEND_CALL_CLOSURE)
+ | orr REG2w, REG2w, TMP1w
+ | // if (Z_TYPE(closure->this_ptr) != IS_UNDEF) {
+ | SAFE_MEM_ACC_WITH_UOFFSET_BYTE ldrb, TMP1w, REG0, offsetof(zend_closure, this_ptr.u1.v.type),
TMP2
+ | cmp TMP1w, #IS_UNDEF
+ | beq >1
+ | // call_info |= ZEND_CALL_HAS_THIS;
+ | LOAD_32BIT_VAL TMP1w, ZEND_CALL_HAS_THIS
+ | orr REG2w, REG2w, TMP1w
+ | // object_or_called_scope = Z_OBJ(closure->this_ptr);
+ | SAFE_MEM_ACC_WITH_UOFFSET ldr, REG1, REG0, offsetof(zend_closure, this_ptr.value.ptr), TMP2
+ |1:
+ | // ZEND_SET_CALL_INFO(call, 0, call_info);
+ | ldr TMP1w, EX:RX->This.u1.type_info
+ | orr TMP1w, TMP1w, REG2w
+ | str TMP1w, EX:RX->This.u1.type_info
+ | // Z_PTR(call->This) = object_or_called_scope;
+ | str REG1, EX:RX->This.value.ptr
+ | ldr TMP1, [REG0, #offsetof(zend_closure, func.op_array.run_time_cache__ptr)]
+ | cmp TMP1, xzr
+ | bne >1
+ | add FCARG1x, REG0, #offsetof(zend_closure, func)
+ | EXT_CALL zend_jit_init_func_run_time_cache_helper, REG0
+ |1:
}
| // ZEND_CALL_NUM_ARGS(call) = num_args;
| LOAD_32BIT_VAL TMP1w, opline->extended_value
@@ -8506,7 +8611,54 @@ static int zend_jit_needs_call_chain(zend_call_info *call_info, uint32_t b,
cons
static int zend_jit_init_fcall_guard(dasm_State **Dst, uint32_t level, const zend_function *func,
const zend_op *to_opline)
{
- | NIY // TODO
+ int32_t exit_point;
+ const void *exit_addr;
+
+ if (func->type == ZEND_INTERNAL_FUNCTION) {
+#ifdef ZEND_WIN32
+ // TODO: ASLR may cause different addresses in different workers ???
+ return 0;
+#endif
+ } else if (func->type == ZEND_USER_FUNCTION) {
+ if (!zend_accel_in_shm(func->op_array.opcodes)) {
+ /* op_array and op_array->opcodes are not persistent. We can't link. */
+ return 0;
+ }
+ } else {
+ ZEND_UNREACHABLE();
+ return 0;
+ }
+
+ exit_point = zend_jit_trace_get_exit_point(to_opline, ZEND_JIT_EXIT_POLYMORPHISM);
+ exit_addr = zend_jit_trace_get_exit_addr(exit_point);
+ if (!exit_addr) {
+ return 0;
+ }
+
+ | // call = EX(call);
+ | ldr REG1, EX->call
+ while (level > 0) {
+ | ldr REG1, EX:REG1->prev_execute_data
+ level--;
+ }
+
+ if (func->type == ZEND_USER_FUNCTION &&
+ (!(func->common.fn_flags & ZEND_ACC_IMMUTABLE) ||
+ (func->common.fn_flags & ZEND_ACC_CLOSURE) ||
+ !func->common.function_name)) {
+ const zend_op *opcodes = func->op_array.opcodes;
+
+ | ldr REG1, EX:REG1->func
+ | LOAD_ADDR REG2, ((ptrdiff_t)opcodes)
+ | ldr TMP1, [REG1, #offsetof(zend_op_array, opcodes)]
+ | cmp TMP1, REG2
+ | bne &exit_addr
+ } else {
+ | LOAD_ADDR REG2, ((ptrdiff_t)func)
+ | ldr TMP1, EX:REG1->func
+ | cmp TMP1, REG2
+ | bne &exit_addr
+ }
return 1;
}
@@ -8585,7 +8737,29 @@ static int zend_jit_init_fcall(dasm_State **Dst, const zend_op *opline,
uint32_t
| mov REG0, RETVALx
| str REG0, [REG1, #opline->result.num]
if (JIT_G(trigger) == ZEND_JIT_ON_HOT_TRACE) {
- | NIY // TODO. tracing mode.
+ int32_t exit_point = zend_jit_trace_get_exit_point(opline, 0);
+ const void *exit_addr = zend_jit_trace_get_exit_addr(exit_point);
+
+ if (!exit_addr) {
+ return 0;
+ }
+
+ if (!func || opline->opcode == ZEND_INIT_FCALL) {
+ | cbnz REG0, >3
+ } else if (func->type == ZEND_USER_FUNCTION
+ && !(func->common.fn_flags & ZEND_ACC_IMMUTABLE)) {
+ const zend_op *opcodes = func->op_array.opcodes;
+
+ | LOAD_ADDR REG1, ((ptrdiff_t)opcodes)
+ | ldr TMP1, [REG0, #offsetof(zend_op_array, opcodes)]
+ | cmp TMP1, REG1
+ | beq >3
+ } else {
+ | LOAD_ADDR REG1, ((ptrdiff_t)func)
+ | cmp REG0, REG1
+ | beq >3
+ }
+ | b &exit_addr
} else {
| cbnz REG0, >3
| // SAVE_OPLINE();
@@ -8848,7 +9022,80 @@ static int zend_jit_init_closure_call(dasm_State **Dst,
zend_jit_trace_rec *trace,
bool stack_check)
{
- | NIY // TODO
+ zend_function *func = NULL;
+ zend_jit_addr op2_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->op2.var);
+
+ | GET_ZVAL_PTR REG0, op2_addr, TMP1
+
+ if (ssa->var_info[ssa_op->op2_use].ce != zend_ce_closure
+ && !(ssa->var_info[ssa_op->op2_use].type & MAY_BE_CLASS_GUARD)) {
+ int32_t exit_point = zend_jit_trace_get_exit_point(opline, ZEND_JIT_EXIT_TO_VM);
+ const void *exit_addr = zend_jit_trace_get_exit_addr(exit_point);
+
+ if (!exit_addr) {
+ return 0;
+ }
+
+ | LOAD_ADDR FCARG1x, ((ptrdiff_t)zend_ce_closure)
+ | ldr, TMP1, [REG0, #offsetof(zend_object, ce)]
+ | cmp TMP1, FCARG1x
+ | bne &exit_addr
+ if (ssa->var_info && ssa_op->op2_use >= 0) {
+ ssa->var_info[ssa_op->op2_use].type |= MAY_BE_CLASS_GUARD;
+ ssa->var_info[ssa_op->op2_use].ce = zend_ce_closure;
+ ssa->var_info[ssa_op->op2_use].is_instanceof = 0;
+ }
+ }
+
+ if (trace
+ && trace->op == ZEND_JIT_TRACE_INIT_CALL
+ && trace->func
+ && trace->func->type == ZEND_USER_FUNCTION) {
+ const zend_op *opcodes;
+ int32_t exit_point;
+ const void *exit_addr;
+
+ func = (zend_function*)trace->func;
+ opcodes = func->op_array.opcodes;
+ exit_point = zend_jit_trace_get_exit_point(opline, ZEND_JIT_EXIT_CLOSURE_CALL);
+ exit_addr = zend_jit_trace_get_exit_addr(exit_point);
+ if (!exit_addr) {
+ return 0;
+ }
+
+ | LOAD_ADDR FCARG1x, ((ptrdiff_t)opcodes)
+ | ldr TMP1, [REG0, #offsetof(zend_closure, func.op_array.opcodes)]
+ | cmp TMP1, FCARG1x
+ | bne &exit_addr
+ }
+
+ if (delayed_call_chain) {
+ if (!zend_jit_save_call_chain(Dst, delayed_call_level)) {
+ return 0;
+ }
+ }
+
+ if (!zend_jit_push_call_frame(Dst, opline, NULL, func, 1, 0, stack_check)) {
+ return 0;
+ }
+
+ if (zend_jit_needs_call_chain(NULL, b, op_array, ssa, ssa_op, opline, trace)) {
+ if (!zend_jit_save_call_chain(Dst, call_level)) {
+ return 0;
+ }
+ } else {
+ delayed_call_chain = 1;
+ delayed_call_level = call_level;
+ }
+
+ if (trace
+ && trace->op == ZEND_JIT_TRACE_END
+ && trace->stop == ZEND_JIT_TRACE_STOP_INTERPRETER) {
+ if (!zend_jit_set_valid_ip(Dst, opline + 1)) {
+ return 0;
+ }
+ }
+
return 1;
}
@@ -9868,7 +10115,37 @@ static int zend_jit_check_func_arg(dasm_State **Dst, const zend_op *opline)
&& JIT_G(current_frame)
&& JIT_G(current_frame)->call
&& JIT_G(current_frame)->call->func) {
- | NIY // tracing
+ if (ARG_SHOULD_BE_SENT_BY_REF(JIT_G(current_frame)->call->func, arg_num)) {
+ if (!TRACE_FRAME_IS_LAST_SEND_BY_REF(JIT_G(current_frame)->call)) {
+ TRACE_FRAME_SET_LAST_SEND_BY_REF(JIT_G(current_frame)->call);
+ | // ZEND_ADD_CALL_FLAG(EX(call), ZEND_CALL_SEND_ARG_BY_REF);
+ || if (reuse_ip) {
+ | ldr TMP1w, [RX, #offsetof(zend_execute_data, This.u1.type_info)]
+ | orr TMP1w, TMP1w, #ZEND_CALL_SEND_ARG_BY_REF
+ | str TMP1w, [RX, #offsetof(zend_execute_data, This.u1.type_info)]
+ || } else {
+ | ldr REG0, EX->call
+ | ldr TMP1w, [REG0, #offsetof(zend_execute_data, This.u1.type_info)]
+ | orr TMP1w, TMP1w, #ZEND_CALL_SEND_ARG_BY_REF
+ | str TMP1w, [REG0, #offsetof(zend_execute_data, This.u1.type_info)]
+ || }
+ }
+ } else {
+ if (!TRACE_FRAME_IS_LAST_SEND_BY_VAL(JIT_G(current_frame)->call)) {
+ TRACE_FRAME_SET_LAST_SEND_BY_VAL(JIT_G(current_frame)->call);
+ | // ZEND_DEL_CALL_FLAG(EX(call), ZEND_CALL_SEND_ARG_BY_REF);
+ || if (reuse_ip) {
+ | ldr TMP1w, [RX, #offsetof(zend_execute_data, This.u1.type_info)]
+ | and TMP1w, TMP1w, #(~ZEND_CALL_SEND_ARG_BY_REF)
+ | str TMP1w, [RX, #offsetof(zend_execute_data, This.u1.type_info)]
+ || } else {
+ | ldr REG0, EX->call
+ | ldr TMP1w, [REG0, #offsetof(zend_execute_data, This.u1.type_info)]
+ | and TMP1w, TMP1w, #(~ZEND_CALL_SEND_ARG_BY_REF)
+ | str TMP1w, [REG0, #offsetof(zend_execute_data, This.u1.type_info)]
+ || }
+ }
+ }
} else {
// if (QUICK_ARG_SHOULD_BE_SENT_BY_REF(EX(call)->func, arg_num)) {
uint32_t mask = (ZEND_SEND_BY_REF|ZEND_SEND_PREFER_REF) << ((arg_num + 3) * 2);
@@ -10394,7 +10671,8 @@ static int zend_jit_free_cv(dasm_State **Dst, uint32_t info, uint32_t var)
static int zend_jit_free_op(dasm_State **Dst, const zend_op *opline, uint32_t info, uint32_t
var_offset)
{
if (info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF)) {
- | NIY // TODO
+ zend_jit_addr addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, var_offset);
+ | ZVAL_PTR_DTOR addr, info, 0, 1, opline, ZREG_TMP1, ZREG_TMP2
}
return 1;
}
@@ -10464,7 +10742,7 @@ static int zend_jit_leave_func(dasm_State **Dst,
} else if (GCC_GLOBAL_REGS) {
| cbz IP, ->trace_halt
} else {
- | tst RETVALx, RETVALx
+ | tst RETVALw, RETVALw
| blt ->trace_halt
}
}
@@ -11697,7 +11975,7 @@ static int zend_jit_recv(dasm_State **Dst, const zend_op *opline, const
zend_op_
if (!exit_addr) {
return 0;
}
- | NIY // TODO
+ | blt &exit_addr
} else {
| blt >1
|.cold_code
@@ -11890,7 +12168,11 @@ static int zend_jit_class_guard(dasm_State **Dst, const zend_op *opline,
zend_cl
return 0;
}
- | NIY // tracing
+ | LOAD_ADDR TMP1, ((ptrdiff_t)ce)
+ | ldr TMP2, [FCARG1x, #offsetof(zend_object, ce)]
+ | cmp TMP2, TMP1
+ | bne &exit_addr
+
return 1;
}
@@ -13534,7 +13816,8 @@ static int zend_jit_switch(dasm_State **Dst, const zend_op *opline, const
zend_o
}
| GET_ZVAL_PTR FCARG2x, op1_addr, TMP1
if (fallback_label) {
- | NIY // IF_NOT_Z_TYPE FCARG2a + offsetof(zend_reference, val), IS_LONG, &fallback_label
+ | add TMP1, FCARG2x, #offsetof(zend_reference, val)
+ | IF_NOT_Z_TYPE TMP1, IS_LONG, &fallback_label, TMP2w
} else {
| add TMP1, FCARG2x, #offsetof(zend_reference, val)
| IF_NOT_Z_TYPE TMP1, IS_LONG, >3, TMP2w
@@ -13630,7 +13913,8 @@ static int zend_jit_switch(dasm_State **Dst, const zend_op *opline, const
zend_o
}
| GET_ZVAL_PTR FCARG2x, op1_addr, TMP1
if (fallback_label) {
- | NIY // IF_NOT_Z_TYPE FCARG2a + offsetof(zend_reference, val), IS_STRING,
&fallback_label
+ | add TMP1, FCARG2x, #offsetof(zend_reference, val)
+ | IF_NOT_Z_TYPE TMP1, IS_STRING, &fallback_label, TMP2w
} else {
| add TMP1, FCARG2x, #offsetof(zend_reference, val)
| IF_NOT_Z_TYPE TMP1, IS_STRING, >3, TMP2w
@@ -14139,7 +14423,7 @@ static bool zend_jit_noref_guard(dasm_State **Dst, const zend_op *opline,
zend_j
if (!exit_addr) {
return 0;
}
- | NIY // IF_ZVAL_TYPE var_addr, IS_REFERENCE, &exit_addr
+ | IF_ZVAL_TYPE var_addr, IS_REFERENCE, &exit_addr, TMP1w, TMP2
return 1;
}
diff --git a/ext/opcache/jit/zend_jit_trace.c b/ext/opcache/jit/zend_jit_trace.c
index bf8b5c39d409..4ff86d708e35 100644
--- a/ext/opcache/jit/zend_jit_trace.c
+++ b/ext/opcache/jit/zend_jit_trace.c
@@ -7500,7 +7500,7 @@ int ZEND_FASTCALL zend_jit_trace_exit(uint32_t exit_num,
zend_jit_registers_buf
}
}
if (t->exit_info[exit_num].flags & ZEND_JIT_EXIT_METHOD_CALL) {
- zend_function *func = (zend_function*)regs->gpr[0];
+ zend_function *func = (zend_function*)regs->gpr[ZREG_REG0];
if (UNEXPECTED(func->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE)) {
zend_string_release_ex(func->common.function_name, 0);