/* clean before putting into the cache, since clean
could call dtors, which could use cached hash */
zend_symtable_clean(symbol_table);
- *(++EG(symtable_cache_ptr)) = symbol_table;
+ *(EG(symtable_cache_ptr)++) = symbol_table;
}
}
/* }}} */
original_sigsegv_handler = signal(SIGSEGV, zend_handle_sigsegv);
#endif
- EG(symtable_cache_ptr) = EG(symtable_cache) - 1;
- EG(symtable_cache_limit) = EG(symtable_cache) + SYMTABLE_CACHE_SIZE - 1;
+ EG(symtable_cache_ptr) = EG(symtable_cache);
+ EG(symtable_cache_limit) = EG(symtable_cache) + SYMTABLE_CACHE_SIZE;
EG(no_extensions) = 0;
EG(function_table) = CG(function_table);
zend_cleanup_internal_classes();
- while (EG(symtable_cache_ptr)>=EG(symtable_cache)) {
+ while (EG(symtable_cache_ptr) > EG(symtable_cache)) {
+ EG(symtable_cache_ptr)--;
zend_hash_destroy(*EG(symtable_cache_ptr));
FREE_HASHTABLE(*EG(symtable_cache_ptr));
- EG(symtable_cache_ptr)--;
}
zend_hash_destroy(&EG(included_files));
}
ZEND_ADD_CALL_FLAG(ex, ZEND_CALL_HAS_SYMBOL_TABLE);
- if (EG(symtable_cache_ptr) >= EG(symtable_cache)) {
- /*printf("Cache hit! Reusing %x\n", symtable_cache[symtable_cache_ptr]);*/
- symbol_table = ex->symbol_table = *(EG(symtable_cache_ptr)--);
+ if (EG(symtable_cache_ptr) > EG(symtable_cache)) {
+ symbol_table = ex->symbol_table = *(--EG(symtable_cache_ptr));
if (!ex->func->op_array.last_var) {
return symbol_table;
}
/* symbol table cache */
zend_array *symtable_cache[SYMTABLE_CACHE_SIZE];
+ /* Pointer to one past the end of the symtable_cache */
zend_array **symtable_cache_limit;
+ /* Pointer to first unused symtable_cache slot */
zend_array **symtable_cache_ptr;
zend_array symbol_table; /* main symbol table */