summaryrefslogtreecommitdiff
path: root/Zend/zend_execute.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2016-05-13 01:40:15 +0300
committerDmitry Stogov <dmitry@zend.com>2016-05-13 01:40:15 +0300
commitccf18da450881bee09e966c0a7fa4d67840d9e38 (patch)
tree8fec76394fc2c631c0b5cddf28d48816dbd18d97 /Zend/zend_execute.c
parentb5bdb40cb576fa5b4d769580376ae34881c93574 (diff)
downloadphp-git-ccf18da450881bee09e966c0a7fa4d67840d9e38.tar.gz
Eliminated checks for (func->op_array.fn_flags & ZEND_ACC_GENERATOR) in fast path of DO_FCALL* handlers.
This slightly improves calls to regular function and method calls in cost of a bit slower generator initialization. Separate call frame for generators, allocated on heap, now created by ZEND_GENERATOR_CREATE instruction.
Diffstat (limited to 'Zend/zend_execute.c')
-rw-r--r--Zend/zend_execute.c44
1 files changed, 0 insertions, 44 deletions
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index 0bc21e57ac..0da6b32ef9 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -2335,50 +2335,6 @@ static zend_always_inline void i_init_execute_data(zend_execute_data *execute_da
}
/* }}} */
-ZEND_API zend_execute_data *zend_create_generator_execute_data(zend_execute_data *call, zend_op_array *op_array, zval *return_value) /* {{{ */
-{
- /*
- * Normally the execute_data is allocated on the VM stack (because it does
- * not actually do any allocation and thus is faster). For generators
- * though this behavior would be suboptimal, because the (rather large)
- * structure would have to be copied back and forth every time execution is
- * suspended or resumed. That's why for generators the execution context
- * is allocated using a separate VM stack frame.
- */
- zend_execute_data *execute_data;
- uint32_t num_args = ZEND_CALL_NUM_ARGS(call);
- uint32_t used_stack = (ZEND_CALL_FRAME_SLOT + num_args + op_array->last_var + op_array->T - MIN(op_array->num_args, num_args)) * sizeof(zval);
-
- execute_data = (zend_execute_data*)emalloc(used_stack);
- ZEND_SET_CALL_INFO(execute_data, Z_TYPE(call->This) == IS_OBJECT, ZEND_CALL_TOP_FUNCTION | ZEND_CALL_ALLOCATED | (ZEND_CALL_INFO(call) & (ZEND_CALL_CLOSURE|ZEND_CALL_RELEASE_THIS)));
- EX(func) = (zend_function*)op_array;
- Z_OBJ(EX(This)) = Z_OBJ(call->This);
- ZEND_CALL_NUM_ARGS(execute_data) = num_args;
- EX(prev_execute_data) = NULL;
-
- /* copy arguments */
- if (num_args > 0) {
- zval *arg_src = ZEND_CALL_ARG(call, 1);
- zval *arg_dst = ZEND_CALL_ARG(execute_data, 1);
- zval *end = arg_src + num_args;
-
- do {
- ZVAL_COPY_VALUE(arg_dst, arg_src);
- arg_src++;
- arg_dst++;
- } while (arg_src != end);
- }
-
- if (UNEXPECTED(!op_array->run_time_cache)) {
- init_func_run_time_cache(op_array);
- }
-
- i_init_func_execute_data(execute_data, op_array, return_value, 1);
-
- return execute_data;
-}
-/* }}} */
-
ZEND_API void zend_init_execute_data(zend_execute_data *execute_data, zend_op_array *op_array, zval *return_value) /* {{{ */
{
EX(prev_execute_data) = EG(current_execute_data);