summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2020-05-27 22:15:14 +0300
committerDmitry Stogov <dmitry@zend.com>2020-05-27 22:15:14 +0300
commitbd329a6019e28ba1b40ce47eab359fad0819b3ff (patch)
treed3623f7dcc9cf14ba42082d161d1c3a256aa7d9d
parentd2d5738b320ae065334f39874ed5756494537bb7 (diff)
downloadphp-git-bd329a6019e28ba1b40ce47eab359fad0819b3ff.tar.gz
Keep information about SEND_UNPACK/SEND_ARRAY in call_info
-rw-r--r--ext/opcache/Optimizer/sccp.c2
-rw-r--r--ext/opcache/Optimizer/zend_call_graph.c3
-rw-r--r--ext/opcache/Optimizer/zend_call_graph.h3
-rw-r--r--ext/opcache/Optimizer/zend_func_info.c3
4 files changed, 6 insertions, 5 deletions
diff --git a/ext/opcache/Optimizer/sccp.c b/ext/opcache/Optimizer/sccp.c
index 187a69c79f..4d15af9e4f 100644
--- a/ext/opcache/Optimizer/sccp.c
+++ b/ext/opcache/Optimizer/sccp.c
@@ -1841,7 +1841,7 @@ static void sccp_visit_instr(scdf_ctx *scdf, zend_op *opline, zend_ssa_op *ssa_o
}
/* We're only interested in functions with up to three arguments right now */
- if (call->num_args > 3) {
+ if (call->num_args > 3 || call->send_unpack) {
SET_RESULT_BOT(result);
break;
}
diff --git a/ext/opcache/Optimizer/zend_call_graph.c b/ext/opcache/Optimizer/zend_call_graph.c
index 5087527f66..af94b9703a 100644
--- a/ext/opcache/Optimizer/zend_call_graph.c
+++ b/ext/opcache/Optimizer/zend_call_graph.c
@@ -136,9 +136,8 @@ int zend_analyze_calls(zend_arena **arena, zend_script *script, uint32_t build_f
break;
case ZEND_SEND_ARRAY:
case ZEND_SEND_UNPACK:
- /* TODO: set info about var_arg call ??? */
if (call_info) {
- call_info->num_args = -1;
+ call_info->send_unpack = 1;
}
break;
case ZEND_EXIT:
diff --git a/ext/opcache/Optimizer/zend_call_graph.h b/ext/opcache/Optimizer/zend_call_graph.h
index 5012270fe0..f910833aaf 100644
--- a/ext/opcache/Optimizer/zend_call_graph.h
+++ b/ext/opcache/Optimizer/zend_call_graph.h
@@ -40,7 +40,8 @@ struct _zend_call_info {
zend_call_info *next_caller;
zend_call_info *next_callee;
zend_func_info *clone;
- int recursive;
+ zend_bool recursive;
+ zend_bool send_unpack; /* Parameters passed by SEND_UNPACK or SEND_ARRAY */
int num_args;
zend_send_arg_info arg_info[1];
};
diff --git a/ext/opcache/Optimizer/zend_func_info.c b/ext/opcache/Optimizer/zend_func_info.c
index 6d77938025..b08f8af1f4 100644
--- a/ext/opcache/Optimizer/zend_func_info.c
+++ b/ext/opcache/Optimizer/zend_func_info.c
@@ -54,7 +54,8 @@ typedef struct _func_info_t {
static uint32_t zend_range_info(const zend_call_info *call_info, const zend_ssa *ssa)
{
- if (call_info->num_args == 2 || call_info->num_args == 3) {
+ if (!call_info->send_unpack
+ && (call_info->num_args == 2 || call_info->num_args == 3)) {
zend_op_array *op_array = call_info->caller_op_array;
uint32_t t1 = _ssa_op1_info(op_array, ssa, call_info->arg_info[0].opline,
&ssa->ops[call_info->arg_info[0].opline - op_array->opcodes]);