com php-src: Cache op_array->run_time_cache in zend _execute_data for faster access: Zend/zend_comp ile.h Zend/zend_execute.c Zend/zend_execute.h Z
end/zend_object_handlers.c

From: Date: Thu, 17 Apr 2014 12:36:04 +0000
Subject: com php-src: Cache op_array->run_time_cache in zend _execute_data for faster access: Zend/zend_comp ile.h Zend/zend_execute.c Zend/zend_execute.h Z
end/zend_object_handlers.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-77355@lists.php.net to get a copy of this message
Commit: 5c02e0fc5f06f80d2e894a193c255b39f3e4edb2 Author: Dmitry Stogov <dmitry@zend.com> Thu, 17 Apr 2014 16:36:04 +0400 Parents: 3cca67f740e1bae4915d59bc430056ecb82fa6ea Branches: phpng Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=5c02e0fc5f06f80d2e894a193c255b39f3e4edb2 Log: Cache op_array->run_time_cache in zend_execute_data for faster access Changed paths: M Zend/zend_compile.h M Zend/zend_execute.c M Zend/zend_execute.h M Zend/zend_object_handlers.c Diff: diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index bf82b0c..0c3f20f 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -368,6 +368,7 @@ typedef struct _call_slot { struct _zend_execute_data { struct _zend_op *opline; + void **run_time_cache; zend_function_state function_state; zend_op_array *op_array; zend_object *object; diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index acc22a8..7302aee 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -1657,6 +1657,7 @@ static zend_always_inline zend_execute_data *i_create_execute_data_from_op_array if (!op_array->run_time_cache && op_array->last_cache_slot) { op_array->run_time_cache = ecalloc(op_array->last_cache_slot, sizeof(void*)); } + EX(run_time_cache) = op_array->run_time_cache; if (EG(active_symbol_table)) { zend_attach_symbol_table(TSRMLS_C); diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h index 747b116..417f3ac 100644 --- a/Zend/zend_execute.h +++ b/Zend/zend_execute.h @@ -346,20 +346,37 @@ void zend_clean_and_cache_symbol_table(zend_array *symbol_table TSRMLS_DC); void zend_free_compiled_variables(zend_execute_data *execute_data TSRMLS_DC); #define CACHED_PTR(num) \ - EG(active_op_array)->run_time_cache[(num)] + EX(run_time_cache)[(num)] #define CACHE_PTR(num, ptr) do { \ - EG(active_op_array)->run_time_cache[(num)] = (ptr); \ + EX(run_time_cache)[(num)] = (ptr); \ } while (0) #define CACHED_POLYMORPHIC_PTR(num, ce) \ - ((EG(active_op_array)->run_time_cache[(num)] == (ce)) ? \ - EG(active_op_array)->run_time_cache[(num) + 1] : \ + ((EX(run_time_cache)[(num)] == (ce)) ? \ + EX(run_time_cache)[(num) + 1] : \ NULL) #define CACHE_POLYMORPHIC_PTR(num, ce, ptr) do { \ - EG(active_op_array)->run_time_cache[(num)] = (ce); \ - EG(active_op_array)->run_time_cache[(num) + 1] = (ptr); \ + EX(run_time_cache)[(num)] = (ce); \ + EX(run_time_cache)[(num) + 1] = (ptr); \ + } while (0) + +#define CACHED_PTR_EX(op_array, num) \ + (op_array)->run_time_cache[(num)] + +#define CACHE_PTR_EX(op_array, num, ptr) do { \ + (op_array)->run_time_cache[(num)] = (ptr); \ + } while (0) + +#define CACHED_POLYMORPHIC_PTR_EX(op_array, num, ce) \ + (((op_array)->run_time_cache[(num)] == (ce)) ? \ + (op_array)->run_time_cache[(num) + 1] : \ + NULL) + +#define CACHE_POLYMORPHIC_PTR_EX(op_array, num, ce, ptr) do { \ + (op_array)->run_time_cache[(num)] = (ce); \ + (op_array)->run_time_cache[(num) + 1] = (ptr); \ } while (0) END_EXTERN_C() diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index beea7bd..47ee60f 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -271,7 +271,7 @@ static zend_always_inline struct _zend_property_info *zend_get_property_info_qui zend_property_info *scope_property_info; zend_bool denied_access = 0; - if (cache_slot != -1 && (property_info = CACHED_POLYMORPHIC_PTR(cache_slot, ce)) != NULL) { + if (cache_slot != -1 && (property_info = CACHED_POLYMORPHIC_PTR_EX(EG(active_op_array), cache_slot, ce)) != NULL) { return property_info; } @@ -303,7 +303,7 @@ static zend_always_inline struct _zend_property_info *zend_get_property_info_qui zend_error(E_STRICT, "Accessing static property %s::$%s as non static", ce->name->val, member->val); } if (cache_slot != -1) { - CACHE_POLYMORPHIC_PTR(cache_slot, ce, property_info); + CACHE_POLYMORPHIC_PTR_EX(EG(active_op_array), cache_slot, ce, property_info); } return property_info; } @@ -319,7 +319,7 @@ static zend_always_inline struct _zend_property_info *zend_get_property_info_qui && (scope_property_info = zend_hash_find_ptr(&EG(scope)->properties_info, member)) != NULL && scope_property_info->flags & ZEND_ACC_PRIVATE) { if (cache_slot != -1) { - CACHE_POLYMORPHIC_PTR(cache_slot, ce, scope_property_info); + CACHE_POLYMORPHIC_PTR_EX(EG(active_op_array), cache_slot, ce, scope_property_info); } return scope_property_info; } else if (property_info) { @@ -332,7 +332,7 @@ static zend_always_inline struct _zend_property_info *zend_get_property_info_qui } else { /* fall through, return property_info... */ if (cache_slot != -1) { - CACHE_POLYMORPHIC_PTR(cache_slot, ce, property_info); + CACHE_POLYMORPHIC_PTR_EX(EG(active_op_array), cache_slot, ce, property_info); } } } else { @@ -1242,7 +1242,7 @@ ZEND_API zval *zend_std_get_static_property(zend_class_entry *ce, zend_string *p zend_property_info *property_info; if (UNEXPECTED(cache_slot == -1) || - (property_info = CACHED_POLYMORPHIC_PTR(cache_slot, ce)) == NULL) { + (property_info = CACHED_POLYMORPHIC_PTR_EX(EG(active_op_array), cache_slot, ce)) == NULL) { if (UNEXPECTED((property_info = zend_hash_find_ptr(&ce->properties_info, property_name)) == NULL)) { if (!silent) { @@ -1268,7 +1268,7 @@ ZEND_API zval *zend_std_get_static_property(zend_class_entry *ce, zend_string *p zend_update_class_constants(ce TSRMLS_CC); if (EXPECTED(cache_slot != -1)) { - CACHE_POLYMORPHIC_PTR(cache_slot, ce, property_info); + CACHE_POLYMORPHIC_PTR_EX(EG(active_op_array), cache_slot, ce, property_info); } }

« previous php.cvs (#77355) next »