Skip to content

Commit 3597d4b

Browse files
committed
zend_vm: Add OPcode specialization for !== []
1 parent a8d26be commit 3597d4b

File tree

3 files changed

+324
-246
lines changed

3 files changed

+324
-246
lines changed

Zend/zend_vm_def.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10075,6 +10075,19 @@ ZEND_VM_TYPE_SPEC_HANDLER(ZEND_IS_IDENTICAL, op->op2_type == IS_CONST && (Z_TYPE
1007510075
ZEND_VM_SMART_BRANCH(result, 0);
1007610076
}
1007710077

10078+
ZEND_VM_TYPE_SPEC_HANDLER(ZEND_IS_NOT_IDENTICAL, op->op2_type == IS_CONST && (Z_TYPE_P(RT_CONSTANT(op, op->op2)) == IS_ARRAY && zend_hash_num_elements(Z_ARR_P(RT_CONSTANT(op, op->op2))) == 0), ZEND_IS_NOT_IDENTICAL_EMPTY_ARRAY, TMPVARCV, CONST, SPEC(SMART_BRANCH,COMMUTATIVE))
10079+
{
10080+
USE_OPLINE
10081+
zval *op1;
10082+
bool result;
10083+
10084+
op1 = GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R);
10085+
result = Z_TYPE_P(op1) != IS_ARRAY || zend_hash_num_elements(Z_ARR_P(op1)) > 0;
10086+
FREE_OP1();
10087+
FREE_OP2();
10088+
ZEND_VM_SMART_BRANCH(result, 0);
10089+
}
10090+
1007810091
ZEND_VM_TYPE_SPEC_HANDLER(ZEND_IS_IDENTICAL, op->op1_type == IS_CV && (op->op2_type & (IS_CONST|IS_CV)) && !(op1_info & (MAY_BE_UNDEF|MAY_BE_REF)) && !(op2_info & (MAY_BE_UNDEF|MAY_BE_REF)), ZEND_IS_IDENTICAL_NOTHROW, CV, CONST|CV, SPEC(COMMUTATIVE))
1007910092
{
1008010093
/* This is declared below the specializations for MAY_BE_LONG/MAY_BE_DOUBLE so those will be used instead if possible. */

Zend/zend_vm_execute.h

Lines changed: 132 additions & 70 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)