com php-src: Add an option to not generate INIT_FCALL ops for user functions too: Zend/zend_compile.c Zend/zend_compile.h
| From: | Bob Weinand | Date: | Tue, 21 Jul 2015 14:39:49 +0000 |
| Subject: | com php-src: Add an option to not generate INIT_FCALL ops for user functions too: Zend/zend_compile.c Zend/zend_compile.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-88102@lists.php.net to get a copy of this message | ||
Commit: 81a2c43d5ef3dd0ed87c995f327274fb2e183687
Author: Bob Weinand <bobwei9@hotmail.com> Tue, 21 Jul 2015 16:39:22 +0200
Parents: d1a026997a4b6702ab53b756398afed518676321
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=81a2c43d5ef3dd0ed87c995f327274fb2e183687
Log:
Add an option to not generate INIT_FCALL ops for user functions too
Changed paths:
M Zend/zend_compile..c
M Zend/zend_compile.h
Diff:
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index f63c9f3..73bb387 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 a5e5dde..59ae7c9 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