summaryrefslogtreecommitdiff
path: root/Zend/zend_compile.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2014-12-12 09:01:42 +0300
committerDmitry Stogov <dmitry@zend.com>2014-12-12 09:01:42 +0300
commit9ea35a37b9425fc0dc392a754dac7e53791f5521 (patch)
tree5b7a2e6b6dc1e49be998d815738dfad6ce36be7c /Zend/zend_compile.c
parent2ea5f7aea4fe0ab7fe7f931040aebb52d3112999 (diff)
downloadphp-git-9ea35a37b9425fc0dc392a754dac7e53791f5521.tar.gz
Make ZEND_INIT_FCALL keep predcalculted size of necessary stack space in opline->op1.num to avoid its recalculation on each execution.
Diffstat (limited to 'Zend/zend_compile.c')
-rw-r--r--Zend/zend_compile.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 086c7d0db1..44ee16a574 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -2509,6 +2509,10 @@ void zend_compile_call_common(znode *result, zend_ast *args_ast, zend_function *
opline = &CG(active_op_array)->opcodes[opnum_init];
opline->extended_value = arg_count;
+ if (opline->opcode == ZEND_INIT_FCALL) {
+ opline->op1.num = zend_vm_calc_used_stack(arg_count, fbc);
+ }
+
call_flags = (opline->opcode == ZEND_NEW ? ZEND_CALL_CTOR : 0);
opline = zend_emit_op(result, ZEND_DO_FCALL, NULL, NULL TSRMLS_CC);
opline->op1.num = call_flags;
@@ -2662,7 +2666,7 @@ static int zend_try_compile_ct_bound_init_user_func(zend_ast *name_ast, uint32_t
opline = zend_emit_op(NULL, ZEND_INIT_FCALL, NULL, NULL TSRMLS_CC);
opline->extended_value = num_args;
-
+ opline->op1.num = zend_vm_calc_used_stack(num_args, fbc);
opline->op2_type = IS_CONST;
LITERAL_STR(opline->op2, lcname);
zend_alloc_cache_slot(opline->op2.constant TSRMLS_CC);