com php-src: Add type inference support for RECV_VARIADIC: ext/opcache/Optimizer/zend_inference.c
| From: | Nikita Popov | Date: | Thu, 30 Jul 2020 15:14:34 +0000 |
| Subject: | com php-src: Add type inference support for RECV_VARIADIC: ext/opcache/Optimizer/zend_inference.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-112463@lists.php.net to get a copy of this message | ||
Commit: 9dacc8525170664790c72967329dbc4d22a4e6f0
Author: Nikita Popov <nikita.ppv@gmail.com> Thu, 30 Jul 2020 17:14:34 +0200
Parents: 104b7addc4bf3cc3662bc02e1ae34334df013e18
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=9dacc8525170664790c72967329dbc4d22a4e6f0
Log:
Add type inference support for RECV_VARIADIC
Changed paths:
M ext/opcache/Optimizer/zend_inference.c
Diff:
diff --git a/ext/opcache/Optimizer/zend_inference.c b/ext/opcache/Optimizer/zend_inference.c
index 669c88cc7a..1ca381d968 100644
--- a/ext/opcache/Optimizer/zend_inference.c
+++ b/ext/opcache/Optimizer/zend_inference.c
@@ -2996,6 +2996,7 @@ static zend_always_inline int _zend_update_type_info(
break;
case ZEND_RECV:
case ZEND_RECV_INIT:
+ case ZEND_RECV_VARIADIC:
{
/* Typehinting */
zend_arg_info *arg_info = &op_array->arg_info[opline->op1.num-1];
@@ -3006,6 +3007,14 @@ static zend_always_inline int _zend_update_type_info(
tmp |= MAY_BE_REF;
}
+ if (opline->opcode == ZEND_RECV_VARIADIC) {
+ uint32_t elem_type = tmp & MAY_BE_REF
+ ? MAY_BE_ARRAY_OF_ANY|MAY_BE_ARRAY_OF_REF
+ : (tmp & MAY_BE_ANY) << MAY_BE_ARRAY_SHIFT;
+ tmp = MAY_BE_RC1|MAY_BE_RCN|MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_ANY|elem_type;
+ ce = NULL;
+ }
+
UPDATE_SSA_TYPE(tmp, ssa_op->result_def);
if (ce) {
UPDATE_SSA_OBJ_TYPE(ce, 1, ssa_op->result_def);