Merge branch 'PHP-7.0'

* PHP-7.0:
  More effecient fix for bug #71756
This commit is contained in:
Dmitry Stogov 2016-03-10 13:34:00 +03:00
commit ff8337b783
3 changed files with 80 additions and 6 deletions

View File

@ -1435,8 +1435,6 @@ num_index:
retval = zend_hash_index_add_new(ht, hval, &EG(uninitialized_zval));
break;
}
} else if (type == BP_VAR_R) {
ZVAL_DEREF(retval);
}
} else if (EXPECTED(Z_TYPE_P(dim) == IS_STRING)) {
offset_key = Z_STR_P(dim);
@ -1467,11 +1465,7 @@ str_index:
ZVAL_NULL(retval);
break;
}
} else if (type == BP_VAR_R) {
ZVAL_DEREF(retval);
}
} else if (type == BP_VAR_R) {
ZVAL_DEREF(retval);
}
} else {
switch (type) {

View File

@ -4991,6 +4991,14 @@ ZEND_VM_HANDLER(48, ZEND_CASE, CONST|TMPVAR|CV, CONST|TMPVAR|CV)
SAVE_OPLINE();
if (OP1_TYPE == IS_CV && UNEXPECTED(Z_TYPE_P(op1) == IS_UNDEF)) {
op1 = GET_OP1_UNDEF_CV(op1, BP_VAR_R);
} else if ((OP1_TYPE & (IS_VAR|IS_CV)) && UNEXPECTED(Z_ISREF_P(op1))) {
/* Don't keep lock on reference, lock the value instead */
if (UNEXPECTED(Z_REFCOUNT_P(op1) == 1)) {
ZVAL_UNREF(op1);
} else {
Z_DELREF_P(op1);
ZVAL_COPY(op1, Z_REFVAL_P(op1));
}
}
if (OP2_TYPE == IS_CV && UNEXPECTED(Z_TYPE_P(op2) == IS_UNDEF)) {
op2 = GET_OP2_UNDEF_CV(op2, BP_VAR_R);

View File

@ -6209,6 +6209,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CASE_SPEC_CONST_CONST_HANDLER(
SAVE_OPLINE();
if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(op1) == IS_UNDEF)) {
op1 = GET_OP1_UNDEF_CV(op1, BP_VAR_R);
} else if ((IS_CONST & (IS_VAR|IS_CV)) && UNEXPECTED(Z_ISREF_P(op1))) {
/* Don't keep lock on reference, lock the value instead */
if (UNEXPECTED(Z_REFCOUNT_P(op1) == 1)) {
ZVAL_UNREF(op1);
} else {
Z_DELREF_P(op1);
ZVAL_COPY(op1, Z_REFVAL_P(op1));
}
}
if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(op2) == IS_UNDEF)) {
op2 = GET_OP2_UNDEF_CV(op2, BP_VAR_R);
@ -9964,6 +9972,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CASE_SPEC_CONST_CV_HANDLER(ZEN
SAVE_OPLINE();
if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(op1) == IS_UNDEF)) {
op1 = GET_OP1_UNDEF_CV(op1, BP_VAR_R);
} else if ((IS_CONST & (IS_VAR|IS_CV)) && UNEXPECTED(Z_ISREF_P(op1))) {
/* Don't keep lock on reference, lock the value instead */
if (UNEXPECTED(Z_REFCOUNT_P(op1) == 1)) {
ZVAL_UNREF(op1);
} else {
Z_DELREF_P(op1);
ZVAL_COPY(op1, Z_REFVAL_P(op1));
}
}
if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_P(op2) == IS_UNDEF)) {
op2 = GET_OP2_UNDEF_CV(op2, BP_VAR_R);
@ -11719,6 +11735,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CASE_SPEC_CONST_TMPVAR_HANDLER
SAVE_OPLINE();
if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(op1) == IS_UNDEF)) {
op1 = GET_OP1_UNDEF_CV(op1, BP_VAR_R);
} else if ((IS_CONST & (IS_VAR|IS_CV)) && UNEXPECTED(Z_ISREF_P(op1))) {
/* Don't keep lock on reference, lock the value instead */
if (UNEXPECTED(Z_REFCOUNT_P(op1) == 1)) {
ZVAL_UNREF(op1);
} else {
Z_DELREF_P(op1);
ZVAL_COPY(op1, Z_REFVAL_P(op1));
}
}
if ((IS_TMP_VAR|IS_VAR) == IS_CV && UNEXPECTED(Z_TYPE_P(op2) == IS_UNDEF)) {
op2 = GET_OP2_UNDEF_CV(op2, BP_VAR_R);
@ -38702,6 +38726,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CASE_SPEC_CV_CONST_HANDLER(ZEN
SAVE_OPLINE();
if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_P(op1) == IS_UNDEF)) {
op1 = GET_OP1_UNDEF_CV(op1, BP_VAR_R);
} else if ((IS_CV & (IS_VAR|IS_CV)) && UNEXPECTED(Z_ISREF_P(op1))) {
/* Don't keep lock on reference, lock the value instead */
if (UNEXPECTED(Z_REFCOUNT_P(op1) == 1)) {
ZVAL_UNREF(op1);
} else {
Z_DELREF_P(op1);
ZVAL_COPY(op1, Z_REFVAL_P(op1));
}
}
if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(op2) == IS_UNDEF)) {
op2 = GET_OP2_UNDEF_CV(op2, BP_VAR_R);
@ -45075,6 +45107,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CASE_SPEC_CV_CV_HANDLER(ZEND_O
SAVE_OPLINE();
if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_P(op1) == IS_UNDEF)) {
op1 = GET_OP1_UNDEF_CV(op1, BP_VAR_R);
} else if ((IS_CV & (IS_VAR|IS_CV)) && UNEXPECTED(Z_ISREF_P(op1))) {
/* Don't keep lock on reference, lock the value instead */
if (UNEXPECTED(Z_REFCOUNT_P(op1) == 1)) {
ZVAL_UNREF(op1);
} else {
Z_DELREF_P(op1);
ZVAL_COPY(op1, Z_REFVAL_P(op1));
}
}
if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_P(op2) == IS_UNDEF)) {
op2 = GET_OP2_UNDEF_CV(op2, BP_VAR_R);
@ -48501,6 +48541,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CASE_SPEC_CV_TMPVAR_HANDLER(ZE
SAVE_OPLINE();
if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_P(op1) == IS_UNDEF)) {
op1 = GET_OP1_UNDEF_CV(op1, BP_VAR_R);
} else if ((IS_CV & (IS_VAR|IS_CV)) && UNEXPECTED(Z_ISREF_P(op1))) {
/* Don't keep lock on reference, lock the value instead */
if (UNEXPECTED(Z_REFCOUNT_P(op1) == 1)) {
ZVAL_UNREF(op1);
} else {
Z_DELREF_P(op1);
ZVAL_COPY(op1, Z_REFVAL_P(op1));
}
}
if ((IS_TMP_VAR|IS_VAR) == IS_CV && UNEXPECTED(Z_TYPE_P(op2) == IS_UNDEF)) {
op2 = GET_OP2_UNDEF_CV(op2, BP_VAR_R);
@ -50666,6 +50714,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CASE_SPEC_TMPVAR_CONST_HANDLER
SAVE_OPLINE();
if ((IS_TMP_VAR|IS_VAR) == IS_CV && UNEXPECTED(Z_TYPE_P(op1) == IS_UNDEF)) {
op1 = GET_OP1_UNDEF_CV(op1, BP_VAR_R);
} else if (((IS_TMP_VAR|IS_VAR) & (IS_VAR|IS_CV)) && UNEXPECTED(Z_ISREF_P(op1))) {
/* Don't keep lock on reference, lock the value instead */
if (UNEXPECTED(Z_REFCOUNT_P(op1) == 1)) {
ZVAL_UNREF(op1);
} else {
Z_DELREF_P(op1);
ZVAL_COPY(op1, Z_REFVAL_P(op1));
}
}
if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(op2) == IS_UNDEF)) {
op2 = GET_OP2_UNDEF_CV(op2, BP_VAR_R);
@ -52903,6 +52959,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CASE_SPEC_TMPVAR_CV_HANDLER(ZE
SAVE_OPLINE();
if ((IS_TMP_VAR|IS_VAR) == IS_CV && UNEXPECTED(Z_TYPE_P(op1) == IS_UNDEF)) {
op1 = GET_OP1_UNDEF_CV(op1, BP_VAR_R);
} else if (((IS_TMP_VAR|IS_VAR) & (IS_VAR|IS_CV)) && UNEXPECTED(Z_ISREF_P(op1))) {
/* Don't keep lock on reference, lock the value instead */
if (UNEXPECTED(Z_REFCOUNT_P(op1) == 1)) {
ZVAL_UNREF(op1);
} else {
Z_DELREF_P(op1);
ZVAL_COPY(op1, Z_REFVAL_P(op1));
}
}
if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_P(op2) == IS_UNDEF)) {
op2 = GET_OP2_UNDEF_CV(op2, BP_VAR_R);
@ -54045,6 +54109,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CASE_SPEC_TMPVAR_TMPVAR_HANDLE
SAVE_OPLINE();
if ((IS_TMP_VAR|IS_VAR) == IS_CV && UNEXPECTED(Z_TYPE_P(op1) == IS_UNDEF)) {
op1 = GET_OP1_UNDEF_CV(op1, BP_VAR_R);
} else if (((IS_TMP_VAR|IS_VAR) & (IS_VAR|IS_CV)) && UNEXPECTED(Z_ISREF_P(op1))) {
/* Don't keep lock on reference, lock the value instead */
if (UNEXPECTED(Z_REFCOUNT_P(op1) == 1)) {
ZVAL_UNREF(op1);
} else {
Z_DELREF_P(op1);
ZVAL_COPY(op1, Z_REFVAL_P(op1));
}
}
if ((IS_TMP_VAR|IS_VAR) == IS_CV && UNEXPECTED(Z_TYPE_P(op2) == IS_UNDEF)) {
op2 = GET_OP2_UNDEF_CV(op2, BP_VAR_R);