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];
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;
}
/*
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];
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);
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();
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();
shutdown_memory_manager(1, 0);
virtual_cwd_activate();
- zend_interned_strings_switch_storage();
+ zend_interned_strings_switch_storage(1);
/* we're done */
return retval;
return;
}
+ zend_interned_strings_switch_storage(0);
+
#ifdef ZTS
ts_free_worker_threads();
#endif