Skip to content

Commit 0a97554

Browse files
shqkingdstogov
authored andcommitted
Support failed JIT test case: jmpz_001.phpt
Opcode SEND_VAR_EX used in $test and opcode ZEND_SEND_VAR_NO_REF_EX used in $main cover two new branches in function zend_jit_send_var() respectively. The updates in function zend_jit_bool_jmpznz() are made to support opcode JMPNZ_EX used in $test.
1 parent 7309d5a commit 0a97554

File tree

1 file changed

+58
-5
lines changed

1 file changed

+58
-5
lines changed

ext/opcache/jit/zend_jit_arm64.dasc

Lines changed: 58 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5184,7 +5184,17 @@ static int zend_jit_bool_jmpznz(dasm_State **Dst, const zend_op *opline, uint32_
51845184
if (Z_MODE(op1_addr) == IS_CONST_ZVAL) {
51855185
if (zend_is_true(Z_ZV(op1_addr))) {
51865186
/* Always TRUE */
5187-
| brk #0 // TODO
5187+
if (set_bool) {
5188+
if (set_bool_not) {
5189+
| brk #0 // TODO
5190+
| SET_ZVAL_TYPE_INFO res_addr, IS_FALSE, TMP1w, TMP2
5191+
} else {
5192+
| SET_ZVAL_TYPE_INFO res_addr, IS_TRUE, TMP1w, TMP2
5193+
}
5194+
}
5195+
if (true_label != (uint32_t)-1) {
5196+
| b =>true_label;
5197+
}
51885198
} else {
51895199
/* Always FALSE */
51905200
| brk #0 // TODO
@@ -5219,7 +5229,7 @@ static int zend_jit_bool_jmpznz(dasm_State **Dst, const zend_op *opline, uint32_
52195229
} else if (false_label != (uint32_t)-1) {
52205230
| brk #0 // TODO
52215231
} else {
5222-
| brk #0 // TODO
5232+
| blt >9
52235233
}
52245234
jmp_done = 1;
52255235
} else {
@@ -5237,7 +5247,7 @@ static int zend_jit_bool_jmpznz(dasm_State **Dst, const zend_op *opline, uint32_
52375247
| brk #0 // TODO
52385248
} else {
52395249
if (true_label != (uint32_t)-1) {
5240-
| brk #0 // TODO
5250+
| beq =>true_label
52415251
} else if (!(op1_info & (MAY_BE_UNDEF|MAY_BE_LONG))) {
52425252
| bne =>false_label
52435253
jmp_done = 1;
@@ -6832,9 +6842,52 @@ static int zend_jit_send_var(dasm_State **Dst, const zend_op *opline, const zend
68326842
}
68336843

68346844
if (opline->opcode == ZEND_SEND_VAR_EX) {
6835-
| brk #0 // TODO
6845+
if (JIT_G(trigger) == ZEND_JIT_ON_HOT_TRACE
6846+
&& JIT_G(current_frame)
6847+
&& JIT_G(current_frame)->call
6848+
&& JIT_G(current_frame)->call->func) {
6849+
if (ARG_SHOULD_BE_SENT_BY_REF(JIT_G(current_frame)->call->func, arg_num)) {
6850+
if (!zend_jit_send_ref(Dst, opline, op_array, op1_info, 0)) {
6851+
return 0;
6852+
}
6853+
return 1;
6854+
}
6855+
} else {
6856+
uint32_t mask = (ZEND_SEND_BY_REF|ZEND_SEND_PREFER_REF) << ((arg_num + 3) * 2);
6857+
6858+
| ldr REG0, EX:RX->func
6859+
| ldr TMP1w, [REG0, #offsetof(zend_function, quick_arg_flags)]
6860+
| LOAD_32BIT_VAL TMP2w, mask
6861+
| tst TMP1w, TMP2w
6862+
| bne >1
6863+
|.cold_code
6864+
|1:
6865+
| brk #0 // TODO
6866+
if (!zend_jit_send_ref(Dst, opline, op_array, op1_info, 1)) {
6867+
return 0;
6868+
}
6869+
| b >7
6870+
|.code
6871+
}
68366872
} else if (opline->opcode == ZEND_SEND_VAR_NO_REF_EX) {
6837-
| brk #0 // TODO
6873+
if (JIT_G(trigger) == ZEND_JIT_ON_HOT_TRACE
6874+
&& JIT_G(current_frame)
6875+
&& JIT_G(current_frame)->call
6876+
&& JIT_G(current_frame)->call->func) {
6877+
| brk #0 // TODO
6878+
} else {
6879+
uint32_t mask = (ZEND_SEND_BY_REF|ZEND_SEND_PREFER_REF) << ((arg_num + 3) * 2);
6880+
6881+
| ldr REG0, EX:RX->func
6882+
| ldr TMP1w, [REG0, #offsetof(zend_function, quick_arg_flags)]
6883+
| LOAD_32BIT_VAL TMP2w, mask
6884+
| tst TMP1w, TMP2w
6885+
| bne >1
6886+
|.cold_code
6887+
|1:
6888+
| brk #0 // TODO
6889+
|.code
6890+
}
68386891
} else if (opline->opcode == ZEND_SEND_FUNC_ARG) {
68396892
if (JIT_G(trigger) == ZEND_JIT_ON_HOT_TRACE
68406893
&& JIT_G(current_frame)

0 commit comments

Comments
 (0)