com php-src: Fixed referencecounter inference rules: ext/opcache/Optimizer/zend_func_info.c ext/opcache/Opti mizer/zend_inference.c
| From: | Anatol Belski | Date: | Thu, 13 Oct 2016 23:24:23 +0000 |
| Subject: | com php-src: Fixed referencecounter inference rules: ext/opcache/Optimizer/zend_func_info.c ext/opcache/Opti mizer/zend_inference.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-95074@lists.php.net to get a copy of this message | ||
Commit: 233992409bae1b467e5ba2af3319dc291e2bf03e
Author: Dmitry Stogov <dmitry@zend.com> Tue, 11 Oct 2016 01:58:30 +0300
Committer: Anatol Belski <ab@php.net> Fri, 14 Oct 2016 01:24:23 +0200
Parents: 5a2dd84314605b98e374ddb427ce0535c334eb3f
Branches: PHP-7.1
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=233992409bae1b467e5ba2af3319dc291e2bf03e
Log:
Fixed referencecounter inference rules
(cherry picked from commit fae7d6b9bbb3eaf053fb9eb43bc5ceabb34c87f7)
Changed paths:
M ext/opcache/Optimizer/zend_func_info.c
M ext/opcache/Optimizer/zend_inference.c
Diff:
diff --git a/ext/opcache/Optimizer/zend_func_info.c b/ext/opcache/Optimizer/zend_func_info.c
index 46153bc..528f0d6 100644
--- a/ext/opcache/Optimizer/zend_func_info.c
+++ b/ext/opcache/Optimizer/zend_func_info.c
@@ -358,8 +358,8 @@ static const func_info_t func_infos[] = {
F1("strip_tags", MAY_BE_NULL | MAY_BE_STRING),
F0("similar_text", MAY_BE_NULL | MAY_BE_LONG),
F1("explode", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY |
MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
- F1("implode", MAY_BE_NULL | MAY_BE_STRING),
- F1("join", MAY_BE_NULL | MAY_BE_STRING),
+ FN("implode", MAY_BE_NULL | MAY_BE_STRING),
+ FN("join", MAY_BE_NULL | MAY_BE_STRING),
FN("setlocale", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
F1("localeconv", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING
| MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY),
#if HAVE_NL_LANGINFO
diff --git a/ext/opcache/Optimizer/zend_inference.c b/ext/opcache/Optimizer/zend_inference.c
index fdff328..d6724d3 100644
--- a/ext/opcache/Optimizer/zend_inference.c
+++ b/ext/opcache/Optimizer/zend_inference.c
@@ -2506,6 +2506,10 @@ static void zend_update_type_info(const zend_op_array *op_array,
(opline->extended_value == IS_ARRAY ||
opline->extended_value == IS_OBJECT)) {
tmp |= MAY_BE_RCN;
+ } else if ((t1 & MAY_BE_STRING) &&
+ (opline->op1_type == IS_CV) &&
+ opline->extended_value == IS_STRING) {
+ tmp |= MAY_BE_RCN;
}
UPDATE_SSA_TYPE(tmp, ssa_ops[i].op1_def);
COPY_SSA_OBJ_TYPE(ssa_ops[i].op1_use, ssa_ops[i].op1_def);
@@ -2521,6 +2525,10 @@ static void zend_update_type_info(const zend_op_array *op_array,
} else if ((opline->extended_value == IS_ARRAY ||
opline->extended_value == IS_OBJECT) &&
(tmp & (MAY_BE_ARRAY|MAY_BE_OBJECT))) {
+ tmp |= MAY_BE_RC1 | MAY_BE_RCN;
+ } else if (opline->extended_value == IS_STRING &&
+ (t1 & MAY_BE_STRING) &&
+ (opline->op1_type == IS_CV)) {
tmp |= MAY_BE_RC1 | MAY_BE_RCN;
} else {
tmp |= MAY_BE_RC1;