summaryrefslogtreecommitdiff
path: root/Zend
diff options
context:
space:
mode:
authorMarcus Boerger <helly@php.net>2004-08-23 20:57:40 +0000
committerMarcus Boerger <helly@php.net>2004-08-23 20:57:40 +0000
commitb7a8297bc1a76330daa6b7d1727cbfbffbe89a5b (patch)
tree2f01024a53e25cc0b04e94d1773dfe376ad95fca /Zend
parent88b9c69cb2d9c079e82b922c7c3bccfaef1827c9 (diff)
downloadphp-git-b7a8297bc1a76330daa6b7d1727cbfbffbe89a5b.tar.gz
- Boost up __autoload() calls by caching the lookup
Diffstat (limited to 'Zend')
-rw-r--r--Zend/zend_execute_API.c21
-rw-r--r--Zend/zend_globals.h1
2 files changed, 21 insertions, 1 deletions
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index 8073b58b93..f3864cfca6 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -138,6 +138,7 @@ void init_executor(TSRMLS_D)
EG(in_execution) = 0;
EG(in_autoload) = NULL;
+ EG(autoload_func) = NULL;
zend_ptr_stack_init(&EG(argument_stack));
zend_ptr_stack_push(&EG(argument_stack), (void *) NULL);
@@ -878,6 +879,8 @@ ZEND_API int zend_lookup_class(char *name, int name_length, zend_class_entry ***
char *lc_name;
zval *exception;
char dummy = 1;
+ zend_fcall_info fcall_info;
+ zend_fcall_info_cache fcall_cache;
lc_name = do_alloca(name_length + 1);
zend_str_tolower_copy(lc_name, name, name_length);
@@ -911,10 +914,26 @@ ZEND_API int zend_lookup_class(char *name, int name_length, zend_class_entry ***
ZVAL_STRINGL(class_name_ptr, name, name_length, 0);
args[0] = &class_name_ptr;
+
+ fcall_info.size = sizeof(fcall_info);
+ fcall_info.function_table = EG(function_table);
+ fcall_info.function_name = &autoload_function;
+ fcall_info.symbol_table = NULL;
+ fcall_info.retval_ptr_ptr = &retval_ptr;
+ fcall_info.param_count = 1;
+ fcall_info.params = args;
+ fcall_info.object_pp = NULL;
+ fcall_info.no_separation = 1;
+
+ fcall_cache.initialized = EG(autoload_func) ? 1 : 0;
+ fcall_cache.function_handler = EG(autoload_func);
+ fcall_cache.calling_scope = NULL;
+ fcall_cache.object_pp = NULL;
exception = EG(exception);
EG(exception) = NULL;
- retval = call_user_function_ex(EG(function_table), NULL, &autoload_function, &retval_ptr, 1, args, 0, NULL TSRMLS_CC);
+ retval = zend_call_function(&fcall_info, &fcall_cache TSRMLS_CC);
+ EG(autoload_func) = fcall_cache.function_handler;
zend_hash_del(EG(in_autoload), lc_name, name_length+1);
diff --git a/Zend/zend_globals.h b/Zend/zend_globals.h
index d8b6db6496..b005c2a6c0 100644
--- a/Zend/zend_globals.h
+++ b/Zend/zend_globals.h
@@ -192,6 +192,7 @@ struct _zend_executor_globals {
zend_bool in_execution;
HashTable *in_autoload;
+ zend_function *autoload_func;
zend_bool bailout_set;
zend_bool full_tables_cleanup;
zend_bool ze1_compatibility_mode;