diff options
| author | Dmitry Stogov <dmitry@zend.com> | 2016-05-13 01:40:15 +0300 |
|---|---|---|
| committer | Dmitry Stogov <dmitry@zend.com> | 2016-05-13 01:40:15 +0300 |
| commit | ccf18da450881bee09e966c0a7fa4d67840d9e38 (patch) | |
| tree | 8fec76394fc2c631c0b5cddf28d48816dbd18d97 /Zend/zend_compile.c | |
| parent | b5bdb40cb576fa5b4d769580376ae34881c93574 (diff) | |
| download | php-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_compile.c')
| -rw-r--r-- | Zend/zend_compile.c | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index b4cb05f616..c534088b58 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -3489,24 +3489,6 @@ int zend_compile_func_cuf(znode *result, zend_ast_list *args, zend_string *lcnam } /* }}} */ -static void zend_compile_assert_side_effects(zend_ast *ast) /* {{{ */ -{ - int i; - int children = zend_ast_is_list(ast) ? zend_ast_get_list(ast)->children : zend_ast_get_num_children(ast); - - for (i = 0; i < children; i++) { - zend_ast *child = (zend_ast_is_list(ast) ? zend_ast_get_list(ast)->child : ast->child)[i]; - if (child) { - if (child->kind == ZEND_AST_YIELD) { - zend_mark_function_as_generator(); - } else if (ast->kind >= ZEND_AST_IS_LIST_SHIFT) { - zend_compile_assert_side_effects(child); - } - } - } -} -/* }}} */ - static int zend_compile_assert(znode *result, zend_ast_list *args, zend_string *name, zend_function *fbc) /* {{{ */ { if (EG(assertions) >= 0) { @@ -3549,8 +3531,6 @@ static int zend_compile_assert(znode *result, zend_ast_list *args, zend_string * } result->op_type = IS_CONST; ZVAL_TRUE(&result->u.constant); - - zend_compile_assert_side_effects((zend_ast *) args); } return SUCCESS; @@ -5411,6 +5391,10 @@ void zend_compile_func_decl(znode *result, zend_ast *ast) /* {{{ */ } zend_compile_params(params_ast, return_type_ast); + if (CG(active_op_array)->fn_flags & ZEND_ACC_GENERATOR) { + zend_mark_function_as_generator(); + zend_emit_op(NULL, ZEND_GENERATOR_CREATE, NULL, NULL); + } if (uses_ast) { zend_compile_closure_uses(uses_ast); } |
