Skip to content

Commit 16c4c06

Browse files
committed
Make empty_fcall_info and empty_fcall_info_cache macros
See #18273, a constant may cause unnecessary cache misses. Closes GH-18326
1 parent 3b87093 commit 16c4c06

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

Diff for: Zend/zend_API.h

+8-3
Original file line numberDiff line numberDiff line change
@@ -690,8 +690,13 @@ ZEND_API zend_result _call_user_function_impl(zval *object, zval *function_name,
690690
#define call_user_function_named(function_table, object, function_name, retval_ptr, param_count, params, named_params) \
691691
_call_user_function_impl(object, function_name, retval_ptr, param_count, params, named_params)
692692

693-
ZEND_API extern const zend_fcall_info empty_fcall_info;
694-
ZEND_API extern const zend_fcall_info_cache empty_fcall_info_cache;
693+
#ifndef __cplusplus
694+
# define empty_fcall_info (zend_fcall_info) {0}
695+
# define empty_fcall_info_cache (zend_fcall_info_cache) {0}
696+
#else
697+
# define empty_fcall_info zend_fcall_info {0}
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);

Diff for: Zend/zend_execute_API.c

-4
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,6 @@ ZEND_API void (*zend_execute_ex)(zend_execute_data *execute_data);
5353
ZEND_API void (*zend_execute_internal)(zend_execute_data *execute_data, zval *return_value);
5454
ZEND_API zend_class_entry *(*zend_autoload)(zend_string *name, zend_string *lc_name);
5555

56-
/* true globals */
57-
ZEND_API const zend_fcall_info empty_fcall_info = {0};
58-
ZEND_API const zend_fcall_info_cache empty_fcall_info_cache = {0};
59-
6056
#ifdef ZEND_WIN32
6157
ZEND_TLS HANDLE tq_timer = NULL;
6258
#endif

0 commit comments

Comments
 (0)