]> granicus.if.org Git - php/commitdiff
Add an option to not generate INIT_FCALL ops for user functions too
authorBob Weinand <bobwei9@hotmail.com>
Tue, 21 Jul 2015 14:39:22 +0000 (16:39 +0200)
committerBob Weinand <bobwei9@hotmail.com>
Tue, 21 Jul 2015 14:39:49 +0000 (16:39 +0200)
Zend/zend_compile.c
Zend/zend_compile.h

index f63c9f3700748186ae5d96234e994597ad0ec07e..73bb387c1eab391ed37208eedc5ced81dd4867dd 100644 (file)
@@ -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);
index a5e5ddece5862dd9783bba9e2c9a018e919e0e50..59ae7c92c1e933c8ed57561e3989da65206dcafe 100644 (file)
@@ -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