cvs: ZendEngine2 / zend_execute_API.c
[email protected] ("Dmitry Stogov")
| Newsgroups | php.zend-engine.cvs |
|---|---|
| Message-ID | <cvsdmitry1210093267@cvsserver> |
dmitry Tue May 6 17:01:07 2008 UTC
Modified files:
/ZendEngine2 zend_execute_API.c
Log:
Use lazy symbol table initialization for op_arrays called from internal php functions
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_execute_API.c?r1=1.446&r2=1.447&diff_format=u
Index: ZendEngine2/zend_execute_API.c
diff -u ZendEngine2/zend_execute_API.c:1.446 ZendEngine2/zend_execute_API.c:1.447
--- ZendEngine2/zend_execute_API.c:1.446 Tue May 6 16:02:50 2008
+++ ZendEngine2/zend_execute_API.c Tue May 6 17:01:07 2008
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_execute_API.c,v 1.446 2008/05/06 16:02:50 dmitry Exp $ */
+/* $Id: zend_execute_API.c,v 1.447 2008/05/06 17:01:07 dmitry Exp $ */
#include <stdio.h>
#include <signal.h>
@@ -1194,8 +1194,7 @@
if (fci->symbol_table) {
EG(active_symbol_table) = fci->symbol_table;
} else {
- ALLOC_HASHTABLE(EG(active_symbol_table));
- zend_u_hash_init(EG(active_symbol_table), 0, NULL, ZVAL_PTR_DTOR, 0, UG(unicode));
+ EG(active_symbol_table) = NULL;
}
original_return_value = EG(return_value_ptr_ptr);
@@ -1204,9 +1203,16 @@
EG(active_op_array) = (zend_op_array *) EX(function_state).function;
original_opline_ptr = EG(opline_ptr);
zend_execute(EG(active_op_array) TSRMLS_CC);
- if (!fci->symbol_table) {
- zend_hash_destroy(EG(active_symbol_table));
- FREE_HASHTABLE(EG(active_symbol_table));
+ if (!fci->symbol_table && EG(active_symbol_table)) {
+ if (EG(symtable_cache_ptr)>=EG(symtable_cache_limit)) {
+ zend_hash_destroy(EG(active_symbol_table));
+ FREE_HASHTABLE(EG(active_symbol_table));
+ } else {
+ /* clean before putting into the cache, since clean
+ could call dtors, which could use cached hash */
+ zend_hash_clean(EG(active_symbol_table));
+ *(++EG(symtable_cache_ptr)) = EG(active_symbol_table);
+ }
}
EG(active_symbol_table) = calling_symbol_table;
EG(active_op_array) = original_op_array;