Skip to content

Commit f11b440

Browse files
shqkingdstogov
authored andcommitted
Support failed JIT test case: send_ref_001.phpt
Part of generated opcodes for $foo are: ... BB1: 0002 INIT_FCALL 1 96 string("foo") 0003 #5.V1 [rcn, object (instanceof A)] = FETCH_THIS 0004 SEND_REF #5.V1 [rcn, object (instanceof A)] 1 0005 DO_UCALL Updates in functions zend_jit_fetch_this() and zend_jit_load_this() are made to support FETCH_THIS opcode. One new path is covered in function zend_jit_send_ref() by SEND_REF opcode.
1 parent bb67754 commit f11b440

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed

ext/opcache/jit/zend_jit_arm64.dasc

+28-3
Original file line numberDiff line numberDiff line change
@@ -6784,7 +6784,6 @@ static int zend_jit_send_ref(dasm_State **Dst, const zend_op *opline, const zend
67846784
| // ZVAL_NEW_REF(arg, varptr);
67856785
if (opline->op1_type == IS_VAR) {
67866786
if (Z_REG(op1_addr) != ZREG_REG0 || Z_OFFSET(op1_addr) != 0) {
6787-
| brk #0 // TODO
67886787
| LOAD_ZVAL_ADDR REG0, op1_addr
67896788
}
67906789
| str REG0, T1 // save
@@ -8707,13 +8706,39 @@ static int zend_jit_load_this(dasm_State **Dst, uint32_t var)
87078706
{
87088707
zend_jit_addr var_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, var);
87098708

8710-
| brk #0 // TODO
8709+
| ldr FCARG1x, EX->This.value.ptr
8710+
| SET_ZVAL_PTR var_addr, FCARG1x, TMP1
8711+
| SET_ZVAL_TYPE_INFO var_addr, IS_OBJECT_EX, TMP1w, TMP2
8712+
| GC_ADDREF FCARG1x, TMP1w
87118713
return 1;
87128714
}
87138715

87148716
static int zend_jit_fetch_this(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, bool check_only)
87158717
{
8716-
| brk #0 // TODO
8718+
if (!op_array->scope || (op_array->fn_flags & ZEND_ACC_STATIC)) {
8719+
if (JIT_G(trigger) == ZEND_JIT_ON_HOT_TRACE) {
8720+
if (!JIT_G(current_frame) ||
8721+
!TRACE_FRAME_IS_THIS_CHECKED(JIT_G(current_frame))) {
8722+
8723+
int32_t exit_point = zend_jit_trace_get_exit_point(opline, ZEND_JIT_EXIT_TO_VM);
8724+
const void *exit_addr = zend_jit_trace_get_exit_addr(exit_point);
8725+
8726+
| brk #0 // TODO
8727+
8728+
if (JIT_G(current_frame)) {
8729+
TRACE_FRAME_SET_THIS_CHECKED(JIT_G(current_frame));
8730+
}
8731+
}
8732+
} else {
8733+
| brk #0 // TODO
8734+
}
8735+
}
8736+
8737+
if (!check_only) {
8738+
if (!zend_jit_load_this(Dst, opline->result.var)) {
8739+
return 0;
8740+
}
8741+
}
87178742
return 1;
87188743
}
87198744

0 commit comments

Comments
 (0)