mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Switch back from "request" interned strings storage to "permanent" in MSHUTDOWN
This commit is contained in:
parent
3f6693c5e0
commit
f2b91b31e4
4 changed files with 24 additions and 16 deletions
|
@ -38,6 +38,7 @@ static HashTable interned_strings_permanent;
|
|||
static zend_new_interned_string_func_t interned_string_request_handler = zend_new_interned_string_request;
|
||||
static zend_string_init_interned_func_t interned_string_init_request_handler = zend_string_init_interned_request;
|
||||
static zend_string_copy_storage_func_t interned_string_copy_storage = NULL;
|
||||
static zend_string_copy_storage_func_t interned_string_restore_storage = NULL;
|
||||
|
||||
ZEND_API zend_string *zend_empty_string = NULL;
|
||||
ZEND_API zend_string *zend_one_char_string[256];
|
||||
|
@ -254,18 +255,27 @@ ZEND_API void zend_interned_strings_set_request_storage_handlers(zend_new_intern
|
|||
interned_string_init_request_handler = init_handler;
|
||||
}
|
||||
|
||||
ZEND_API void zend_interned_strings_set_permanent_storage_copy_handler(zend_string_copy_storage_func_t handler)
|
||||
ZEND_API void zend_interned_strings_set_permanent_storage_copy_handlers(zend_string_copy_storage_func_t copy_handler, zend_string_copy_storage_func_t restore_handler)
|
||||
{
|
||||
interned_string_copy_storage = handler;
|
||||
interned_string_copy_storage = copy_handler;
|
||||
interned_string_restore_storage = restore_handler;
|
||||
}
|
||||
|
||||
ZEND_API void zend_interned_strings_switch_storage(void)
|
||||
ZEND_API void zend_interned_strings_switch_storage(zend_bool request)
|
||||
{
|
||||
if (interned_string_copy_storage) {
|
||||
interned_string_copy_storage();
|
||||
if (request) {
|
||||
if (interned_string_copy_storage) {
|
||||
interned_string_copy_storage();
|
||||
}
|
||||
zend_new_interned_string = interned_string_request_handler;
|
||||
zend_string_init_interned = interned_string_init_request_handler;
|
||||
} else {
|
||||
zend_new_interned_string = zend_new_interned_string_permanent;
|
||||
zend_string_init_interned = zend_string_init_interned_permanent;
|
||||
if (interned_string_restore_storage) {
|
||||
interned_string_restore_storage();
|
||||
}
|
||||
}
|
||||
zend_new_interned_string = interned_string_request_handler;
|
||||
zend_string_init_interned = interned_string_init_request_handler;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -39,8 +39,8 @@ ZEND_API void zend_interned_strings_activate(void);
|
|||
ZEND_API void zend_interned_strings_deactivate(void);
|
||||
ZEND_API zend_string *zend_interned_string_find_permanent(zend_string *str);
|
||||
ZEND_API void zend_interned_strings_set_request_storage_handlers(zend_new_interned_string_func_t handler, zend_string_init_interned_func_t init_handler);
|
||||
ZEND_API void zend_interned_strings_set_permanent_storage_copy_handler(zend_string_copy_storage_func_t handler);
|
||||
ZEND_API void zend_interned_strings_switch_storage(void);
|
||||
ZEND_API void zend_interned_strings_set_permanent_storage_copy_handlers(zend_string_copy_storage_func_t copy_handler, zend_string_copy_storage_func_t restore_handler);
|
||||
ZEND_API void zend_interned_strings_switch_storage(zend_bool request);
|
||||
|
||||
ZEND_API extern zend_string *zend_empty_string;
|
||||
ZEND_API extern zend_string *zend_one_char_string[256];
|
||||
|
|
|
@ -2467,7 +2467,7 @@ static int zend_accel_init_shm(void)
|
|||
ZCSG(interned_strings_end) = ZCSG(interned_strings_start) + (ZCG(accel_directives).interned_strings_buffer * 1024 * 1024);
|
||||
ZCSG(interned_strings_top) = ZCSG(interned_strings_start);
|
||||
ZCSG(interned_strings_saved_top) = NULL;
|
||||
zend_interned_strings_set_permanent_storage_copy_handler(accel_use_shm_interned_strings);
|
||||
zend_interned_strings_set_permanent_storage_copy_handlers(accel_use_shm_interned_strings, accel_use_permanent_interned_strings);
|
||||
}
|
||||
|
||||
zend_interned_strings_set_request_storage_handlers(accel_new_interned_string_for_php, accel_init_interned_string_for_php);
|
||||
|
@ -2737,7 +2737,7 @@ static int accel_post_startup(void)
|
|||
zend_shared_alloc_lock();
|
||||
accel_shared_globals = (zend_accel_shared_globals *) ZSMMG(app_shared_globals);
|
||||
if (ZCG(accel_directives).interned_strings_buffer) {
|
||||
zend_interned_strings_set_permanent_storage_copy_handler(accel_use_shm_interned_strings);
|
||||
zend_interned_strings_set_permanent_storage_copy_handlers(accel_use_shm_interned_strings, accel_use_permanent_interned_strings);
|
||||
}
|
||||
zend_interned_strings_set_request_storage_handlers(accel_new_interned_string_for_php, accel_init_interned_string_for_php);
|
||||
zend_shared_alloc_unlock();
|
||||
|
@ -2863,10 +2863,6 @@ void accel_shutdown(void)
|
|||
file_cache_only = ZCG(accel_directives).file_cache_only;
|
||||
#endif
|
||||
|
||||
if (!file_cache_only && ZCG(accel_directives).interned_strings_buffer) {
|
||||
accel_use_permanent_interned_strings();
|
||||
}
|
||||
|
||||
accel_reset_pcre_cache();
|
||||
|
||||
accel_free_ts_resources();
|
||||
|
|
|
@ -2280,7 +2280,7 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
|
|||
shutdown_memory_manager(1, 0);
|
||||
virtual_cwd_activate();
|
||||
|
||||
zend_interned_strings_switch_storage();
|
||||
zend_interned_strings_switch_storage(1);
|
||||
|
||||
/* we're done */
|
||||
return retval;
|
||||
|
@ -2313,6 +2313,8 @@ void php_module_shutdown(void)
|
|||
return;
|
||||
}
|
||||
|
||||
zend_interned_strings_switch_storage(0);
|
||||
|
||||
#ifdef ZTS
|
||||
ts_free_worker_threads();
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue