summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-03-17 14:53:13 +0100
committerNikita Popov <nikita.ppv@gmail.com>2020-03-17 14:54:11 +0100
commit023039fbfc055779447ebda3c90299731a10c5ea (patch)
treea1babf4bb98f4d6424c203f208426874c0dd69a8
parent66d8d0c7d7f77b608cc0b1198d6216dcde916d95 (diff)
downloadphp-git-023039fbfc055779447ebda3c90299731a10c5ea.tar.gz
Remove object auto-vivification leftovers in type-inference
undef/null/false no longer get promoted to object in PHP 8. In fact, we may drop the SSA var defs outside RC inference mode now.
-rw-r--r--ext/opcache/Optimizer/zend_inference.c22
1 files changed, 2 insertions, 20 deletions
diff --git a/ext/opcache/Optimizer/zend_inference.c b/ext/opcache/Optimizer/zend_inference.c
index 8db27f86e6..8c80c29e25 100644
--- a/ext/opcache/Optimizer/zend_inference.c
+++ b/ext/opcache/Optimizer/zend_inference.c
@@ -2525,14 +2525,8 @@ static zend_always_inline int _zend_update_type_info(
}
} else if (opline->opcode == ZEND_ASSIGN_OBJ_OP) {
if (opline->op1_type == IS_CV) {
- if (!(orig & MAY_BE_REF)) {
- if (orig & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE)) {
- orig &= ~(MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE);
- orig |= MAY_BE_OBJECT | MAY_BE_RC1 | MAY_BE_RCN;
- }
- if (orig & MAY_BE_OBJECT) {
- orig |= (MAY_BE_RC1|MAY_BE_RCN);
- }
+ if (orig & MAY_BE_OBJECT) {
+ orig |= (MAY_BE_RC1|MAY_BE_RCN);
}
UPDATE_SSA_TYPE(orig, ssa_op->op1_def);
COPY_SSA_OBJ_TYPE(ssa_op->op1_use, ssa_op->op1_def);
@@ -2741,10 +2735,6 @@ static zend_always_inline int _zend_update_type_info(
case ZEND_ASSIGN_OBJ:
if (opline->op1_type == IS_CV) {
tmp = t1;
- if (t1 & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE)) {
- tmp &= ~(MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE);
- tmp |= MAY_BE_OBJECT | MAY_BE_RC1 | MAY_BE_RCN;
- }
if (tmp & MAY_BE_OBJECT) {
tmp |= MAY_BE_RC1 | MAY_BE_RCN;
}
@@ -2791,10 +2781,6 @@ static zend_always_inline int _zend_update_type_info(
case ZEND_POST_DEC_OBJ:
if (opline->op1_type == IS_CV) {
tmp = t1;
- if (t1 & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE)) {
- tmp &= ~(MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE);
- tmp |= MAY_BE_OBJECT | MAY_BE_RC1 | MAY_BE_RCN;
- }
if (tmp & MAY_BE_OBJECT) {
tmp |= MAY_BE_RC1 | MAY_BE_RCN;
}
@@ -2870,10 +2856,6 @@ static zend_always_inline int _zend_update_type_info(
case ZEND_ASSIGN_OBJ_REF:
if (opline->op1_type == IS_CV) {
tmp = t1;
- if (t1 & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE)) {
- tmp &= ~(MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE);
- tmp |= MAY_BE_OBJECT | MAY_BE_RC1 | MAY_BE_RCN;
- }
if (tmp & MAY_BE_OBJECT) {
tmp |= MAY_BE_RC1 | MAY_BE_RCN;
}