Added concept of interned strings. All strings constants known at compile time are allocated in a single copy and never changed.

This commit is contained in:
Dmitry Stogov 2010-04-20 11:07:05 +00:00
parent dd5c478be6
commit 41b6410418

View file

@ -1508,6 +1508,7 @@ void php_request_shutdown_for_exec(void *dummy)
/* used to close fd's in the 3..255 range here, but it's problematic /* used to close fd's in the 3..255 range here, but it's problematic
*/ */
shutdown_memory_manager(1, 1 TSRMLS_CC); shutdown_memory_manager(1, 1 TSRMLS_CC);
CG(interned_strings_restore)(TSRMLS_C);
} }
/* }}} */ /* }}} */
@ -1550,6 +1551,8 @@ void php_request_shutdown_for_hook(void *dummy)
shutdown_memory_manager(CG(unclean_shutdown), 0 TSRMLS_CC); shutdown_memory_manager(CG(unclean_shutdown), 0 TSRMLS_CC);
} zend_end_try(); } zend_end_try();
CG(interned_strings_restore)(TSRMLS_C);
zend_try { zend_try {
zend_unset_timeout(TSRMLS_C); zend_unset_timeout(TSRMLS_C);
} zend_end_try(); } zend_end_try();
@ -1648,6 +1651,7 @@ void php_request_shutdown(void *dummy)
zend_try { zend_try {
shutdown_memory_manager(CG(unclean_shutdown) || !report_memleaks, 0 TSRMLS_CC); shutdown_memory_manager(CG(unclean_shutdown) || !report_memleaks, 0 TSRMLS_CC);
} zend_end_try(); } zend_end_try();
CG(interned_strings_restore)(TSRMLS_C);
/* 12. Reset max_execution_time */ /* 12. Reset max_execution_time */
zend_try { zend_try {
@ -2103,6 +2107,7 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
module_startup = 0; module_startup = 0;
shutdown_memory_manager(1, 0 TSRMLS_CC); shutdown_memory_manager(1, 0 TSRMLS_CC);
CG(interned_strings_snapshot)(TSRMLS_C);
/* we're done */ /* we're done */
return SUCCESS; return SUCCESS;