Skip to content

Commit 53ff812

Browse files
committed
Make empty_fcall_info_cache a macro
See php#18273, a constant may cause unnecessary cache misses.
1 parent 1684c52 commit 53ff812

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

Zend/zend_API.h

+7-2
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,12 @@ ZEND_API zend_result _call_user_function_impl(zval *object, zval *function_name,
691691
_call_user_function_impl(object, function_name, retval_ptr, param_count, params, named_params)
692692

693693
ZEND_API extern const zend_fcall_info empty_fcall_info;
694-
ZEND_API extern const zend_fcall_info_cache empty_fcall_info_cache;
694+
695+
#ifndef __cplusplus
696+
# define empty_fcall_info_cache (zend_fcall_info_cache) {0}
697+
#else
698+
# define empty_fcall_info_cache zend_fcall_info_cache {0}
699+
#endif
695700

696701
/** Build zend_call_info/cache from a zval*
697702
*
@@ -800,7 +805,7 @@ static zend_always_inline void zend_fcc_dtor(zend_fcall_info_cache *fcc)
800805
if (fcc->closure) {
801806
OBJ_RELEASE(fcc->closure);
802807
}
803-
memcpy(fcc, &empty_fcall_info_cache, sizeof(zend_fcall_info_cache));
808+
*fcc = empty_fcall_info_cache;
804809
}
805810

806811
ZEND_API void zend_get_callable_zval_from_fcc(const zend_fcall_info_cache *fcc, zval *callable);

Zend/zend_execute_API.c

-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ ZEND_API zend_class_entry *(*zend_autoload)(zend_string *name, zend_string *lc_n
5555

5656
/* true globals */
5757
ZEND_API const zend_fcall_info empty_fcall_info = {0};
58-
ZEND_API const zend_fcall_info_cache empty_fcall_info_cache = {0};
5958

6059
#ifdef ZEND_WIN32
6160
ZEND_TLS HANDLE tq_timer = NULL;

0 commit comments

Comments
 (0)