Skip to content

Commit 4c872ba

Browse files
shqkingdstogov
authored andcommitted
Support failed JIT test case: send_val_001.phpt
Updates in function zend_jit_type_check() are made to support TYPE_CHECK opcode for statement "is_array($type)". New path is touched in function zend_jit_concat_helper() to support opcode CONCAT for statement "$type ."ops"". Besides, one new path is covered in function zend_jit_return() when leaving.
1 parent f11b440 commit 4c872ba

File tree

1 file changed

+92
-3
lines changed

1 file changed

+92
-3
lines changed

ext/opcache/jit/zend_jit_arm64.dasc

Lines changed: 92 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3533,7 +3533,6 @@ static int zend_jit_concat_helper(dasm_State **Dst,
35333533
{
35343534
if ((op1_info & MAY_BE_STRING) && (op2_info & MAY_BE_STRING)) {
35353535
if (op1_info & ((MAY_BE_UNDEF|MAY_BE_ANY|MAY_BE_REF) - MAY_BE_STRING)) {
3536-
| brk #0 // TODO
35373536
| IF_NOT_ZVAL_TYPE op1_addr, IS_STRING, >6, TMP1w, TMP2
35383537
}
35393538
if (op2_info & ((MAY_BE_UNDEF|MAY_BE_ANY|MAY_BE_REF) - MAY_BE_STRING)) {
@@ -7009,7 +7008,87 @@ static int zend_jit_type_check(dasm_State **Dst, const zend_op *opline, uint32_t
70097008
// TODO: support for is_resource() ???
70107009
ZEND_ASSERT(opline->extended_value != MAY_BE_RESOURCE);
70117010

7012-
| brk #0 // TODO
7011+
if (op1_info & MAY_BE_UNDEF) {
7012+
| brk #0 // TODO
7013+
}
7014+
7015+
if (op1_info & (MAY_BE_ANY|MAY_BE_REF)) {
7016+
mask = opline->extended_value;
7017+
if (!(op1_info & MAY_BE_GUARD) && !(op1_info & (MAY_BE_ANY - mask))) {
7018+
| brk #0 // TODO
7019+
} else if (!(op1_info & MAY_BE_GUARD) && !(op1_info & mask)) {
7020+
| brk #0 // TODO
7021+
} else {
7022+
bool invert = 0;
7023+
zend_uchar type;
7024+
7025+
switch (mask) {
7026+
case MAY_BE_NULL: type = IS_NULL; break;
7027+
case MAY_BE_FALSE: type = IS_FALSE; break;
7028+
case MAY_BE_TRUE: type = IS_TRUE; break;
7029+
case MAY_BE_LONG: type = IS_LONG; break;
7030+
case MAY_BE_DOUBLE: type = IS_DOUBLE; break;
7031+
case MAY_BE_STRING: type = IS_STRING; break;
7032+
case MAY_BE_ARRAY: type = IS_ARRAY; break;
7033+
case MAY_BE_OBJECT: type = IS_OBJECT; break;
7034+
case MAY_BE_ANY - MAY_BE_NULL: type = IS_NULL; invert = 1; break;
7035+
case MAY_BE_ANY - MAY_BE_FALSE: type = IS_FALSE; invert = 1; break;
7036+
case MAY_BE_ANY - MAY_BE_TRUE: type = IS_TRUE; invert = 1; break;
7037+
case MAY_BE_ANY - MAY_BE_LONG: type = IS_LONG; invert = 1; break;
7038+
case MAY_BE_ANY - MAY_BE_DOUBLE: type = IS_DOUBLE; invert = 1; break;
7039+
case MAY_BE_ANY - MAY_BE_STRING: type = IS_STRING; invert = 1; break;
7040+
case MAY_BE_ANY - MAY_BE_ARRAY: type = IS_ARRAY; invert = 1; break;
7041+
case MAY_BE_ANY - MAY_BE_OBJECT: type = IS_OBJECT; invert = 1; break;
7042+
case MAY_BE_ANY - MAY_BE_RESOURCE: type = IS_OBJECT; invert = 1; break;
7043+
default:
7044+
type = 0;
7045+
}
7046+
7047+
if (op1_info & MAY_BE_REF) {
7048+
| brk #0 // TODO
7049+
}
7050+
if (type == 0) {
7051+
| brk #0 // TODO
7052+
} else {
7053+
if (smart_branch_opcode &&
7054+
(opline->op1_type & (IS_VAR|IS_TMP_VAR)) &&
7055+
(op1_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE))) {
7056+
| brk #0 // TODO
7057+
} else {
7058+
if (op1_info & MAY_BE_REF) {
7059+
| brk #0 // TODO
7060+
} else {
7061+
| LOAD_32BIT_VAL TMP1w, (opline->op1.var + 8)
7062+
| ldrb TMP2w, [FP, TMP1]
7063+
| cmp TMP2w, #type
7064+
}
7065+
}
7066+
if (exit_addr) {
7067+
| brk #0 // TODO
7068+
} else if (smart_branch_opcode) {
7069+
if (invert) {
7070+
| brk #0 // TODO
7071+
} else {
7072+
if (smart_branch_opcode == ZEND_JMPZ) {
7073+
| bne =>target_label
7074+
} else if (smart_branch_opcode == ZEND_JMPNZ) {
7075+
| brk #0 // TODO
7076+
} else if (smart_branch_opcode == ZEND_JMPZNZ) {
7077+
| brk #0 // TODO
7078+
} else {
7079+
ZEND_UNREACHABLE();
7080+
}
7081+
}
7082+
} else {
7083+
zend_jit_addr res_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->result.var);
7084+
7085+
| brk #0 // TODO
7086+
}
7087+
}
7088+
}
7089+
}
7090+
7091+
|7:
70137092

70147093
return 1;
70157094
}
@@ -7338,7 +7417,17 @@ static int zend_jit_return(dasm_State **Dst, const zend_op *opline, const zend_o
73387417
}
73397418
| ZVAL_COPY_VALUE ret_addr, MAY_BE_ANY, op1_addr, op1_info, ZREG_REG0, ZREG_REG2, ZREG_TMP1, ZREG_TMP2, ZREG_FPR0
73407419
if (op1_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) {
7341-
| brk #0 // TODO
7420+
if (JIT_G(trigger) != ZEND_JIT_ON_HOT_TRACE ||
7421+
(op1_info & (MAY_BE_REF|MAY_BE_OBJECT)) ||
7422+
!op_array->function_name) {
7423+
| lsr REG0w, REG0w, #8
7424+
| and REG0w, REG0w, #0xff
7425+
| TRY_ADDREF op1_info, REG0w, REG2, TMP1
7426+
} else if (return_value_used != 1) {
7427+
| // if (EXPECTED(!(EX_CALL_INFO() & ZEND_CALL_CODE))) ZVAL_NULL(retval_ptr);
7428+
| brk #0 // TODO
7429+
| SET_ZVAL_TYPE_INFO op1_addr, IS_NULL, TMP1w, TMP2
7430+
}
73427431
}
73437432
} else {
73447433
| brk #0 // TODO

0 commit comments

Comments
 (0)