From: Bob Weinand Date: Tue, 21 Jul 2015 14:39:22 +0000 (+0200) Subject: Add an option to not generate INIT_FCALL ops for user functions too X-Git-Tag: php-7.0.0beta3~5^2~116 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=81a2c43d5ef3dd0ed87c995f327274fb2e183687;p=php Add an option to not generate INIT_FCALL ops for user functions too --- diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index f63c9f3700..73bb387c1e 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -2949,8 +2949,9 @@ static int zend_try_compile_ct_bound_init_user_func(zend_ast *name_ast, uint32_t lcname = zend_string_tolower(name); fbc = zend_hash_find_ptr(CG(function_table), lcname); - if (!fbc || (fbc->type == ZEND_INTERNAL_FUNCTION && - (CG(compiler_options) & ZEND_COMPILE_IGNORE_INTERNAL_FUNCTIONS)) + if (!fbc + || (fbc->type == ZEND_INTERNAL_FUNCTION && (CG(compiler_options) & ZEND_COMPILE_IGNORE_INTERNAL_FUNCTIONS)) + || (fbc->type == ZEND_USER_FUNCTION && (CG(compiler_options) & ZEND_COMPILE_IGNORE_USER_FUNCTIONS)) ) { zend_string_release(lcname); return FAILURE; @@ -3168,8 +3169,9 @@ void zend_compile_call(znode *result, zend_ast *ast, uint32_t type) /* {{{ */ lcname = zend_string_tolower(Z_STR_P(name)); fbc = zend_hash_find_ptr(CG(function_table), lcname); - if (!fbc || (fbc->type == ZEND_INTERNAL_FUNCTION && - (CG(compiler_options) & ZEND_COMPILE_IGNORE_INTERNAL_FUNCTIONS)) + if (!fbc + || (fbc->type == ZEND_INTERNAL_FUNCTION && (CG(compiler_options) & ZEND_COMPILE_IGNORE_INTERNAL_FUNCTIONS)) + || (fbc->type == ZEND_USER_FUNCTION && (CG(compiler_options) & ZEND_COMPILE_IGNORE_USER_FUNCTIONS)) ) { zend_string_release(lcname); zend_compile_dynamic_call(result, &name_node, args_ast); diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index a5e5ddece5..59ae7c92c1 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -978,31 +978,34 @@ END_EXTERN_C() * to change the default compiler behavior */ /* generate extended debug information */ -#define ZEND_COMPILE_EXTENDED_INFO (1<<0) +#define ZEND_COMPILE_EXTENDED_INFO (1<<0) /* call op_array handler of extendions */ #define ZEND_COMPILE_HANDLE_OP_ARRAY (1<<1) /* generate ZEND_INIT_FCALL_BY_NAME for internal functions instead of ZEND_INIT_FCALL */ -#define ZEND_COMPILE_IGNORE_INTERNAL_FUNCTIONS (1<<2) +#define ZEND_COMPILE_IGNORE_INTERNAL_FUNCTIONS (1<<2) /* don't perform early binding for classes inherited form internal ones; * in namespaces assume that internal class that doesn't exist at compile-time * may apper in run-time */ -#define ZEND_COMPILE_IGNORE_INTERNAL_CLASSES (1<<3) +#define ZEND_COMPILE_IGNORE_INTERNAL_CLASSES (1<<3) /* generate ZEND_DECLARE_INHERITED_CLASS_DELAYED opcode to delay early binding */ -#define ZEND_COMPILE_DELAYED_BINDING (1<<4) +#define ZEND_COMPILE_DELAYED_BINDING (1<<4) /* disable constant substitution at compile-time */ -#define ZEND_COMPILE_NO_CONSTANT_SUBSTITUTION (1<<5) +#define ZEND_COMPILE_NO_CONSTANT_SUBSTITUTION (1<<5) /* disable usage of builtin instruction for strlen() */ -#define ZEND_COMPILE_NO_BUILTIN_STRLEN (1<<6) +#define ZEND_COMPILE_NO_BUILTIN_STRLEN (1<<6) /* disable substitution of persistent constants at compile-time */ #define ZEND_COMPILE_NO_PERSISTENT_CONSTANT_SUBSTITUTION (1<<7) +/* generate ZEND_INIT_FCALL_BY_NAME for userland functions instead of ZEND_INIT_FCALL */ +#define ZEND_COMPILE_IGNORE_USER_FUNCTIONS (1<<8) + /* The default value for CG(compiler_options) */ #define ZEND_COMPILE_DEFAULT ZEND_COMPILE_HANDLE_OP_ARRAY