From 9313cd899e24aa67b82ade9a24e58aabc0a2edd3 Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Thu, 18 Aug 2022 15:17:31 +0200 Subject: [PATCH] Don't enforce 64 hit counter on Windows There is no particular need to have a 64bit hit counter on Windows. Closes GH-9367. --- ext/opcache/ZendAccelerator.c | 3 ++- ext/opcache/ZendAccelerator.h | 6 +----- ext/opcache/zend_accelerator_module.c | 2 +- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index b7ec3a1a0b2..570e6a248b8 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -2192,10 +2192,11 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type) #else #if ZEND_ENABLE_ZVAL_LONG64 InterlockedIncrement64(&ZCSG(hits)); + InterlockedIncrement64(&persistent_script->dynamic_members.hits); #else InterlockedIncrement(&ZCSG(hits)); + InterlockedIncrement(&persistent_script->dynamic_members.hits); #endif - InterlockedIncrement64(&persistent_script->dynamic_members.hits); #endif /* see bug #15471 (old BTS) */ diff --git a/ext/opcache/ZendAccelerator.h b/ext/opcache/ZendAccelerator.h index bc7236fbdb3..bc92854c355 100644 --- a/ext/opcache/ZendAccelerator.h +++ b/ext/opcache/ZendAccelerator.h @@ -137,11 +137,7 @@ typedef struct _zend_persistent_script { */ struct zend_persistent_script_dynamic_members { time_t last_used; -#ifdef ZEND_WIN32 - LONGLONG hits; -#else - zend_ulong hits; -#endif + zend_ulong hits; unsigned int memory_consumption; unsigned int checksum; time_t revalidate; diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c index 2271920b302..6a5eb2b69b3 100644 --- a/ext/opcache/zend_accelerator_module.c +++ b/ext/opcache/zend_accelerator_module.c @@ -545,7 +545,7 @@ static int accelerator_get_scripts(zval *return_value) array_init(&persistent_script_report); add_assoc_str(&persistent_script_report, "full_path", zend_string_dup(script->script.filename, 0)); - add_assoc_long(&persistent_script_report, "hits", (zend_long)script->dynamic_members.hits); + add_assoc_long(&persistent_script_report, "hits", script->dynamic_members.hits); add_assoc_long(&persistent_script_report, "memory_consumption", script->dynamic_members.memory_consumption); ta = localtime(&script->dynamic_members.last_used); str = asctime(ta);