#define PZVAL_IS_REF(z) ((z)->is_ref)
#define PZVAL_LOCK(z) ((z)->refcount++)
-#define PZVAL_UNLOCK(z) ((z)->refcount--)
+#define PZVAL_UNLOCK(z) { ((z)->refcount--); \
+ if (!(z)->refcount) { \
+ EG(garbage)[EG(garbage_ptr)++] = (z); \
+ if (EG(garbage_ptr) == 4) { \
+ zval_dtor(EG(garbage)[0]); \
+ efree(EG(garbage)[0]); \
+ zval_dtor(EG(garbage)[1]); \
+ efree(EG(garbage)[1]); \
+ EG(garbage)[0] = EG(garbage)[2]; \
+ EG(garbage)[1] = EG(garbage)[3]; \
+ EG(garbage_ptr) -= 2; \
+ } \
+ } \
+ }
+
#define SELECTIVE_PZVAL_LOCK(pzv, pzn) if (!((pzn)->u.EA.type & EXT_TYPE_UNUSED)) { PZVAL_LOCK(pzv); }
#endif /* _COMPILE_H */
EG(opline_ptr) = &opline;
EG(active_op_array) = op_array;
EG(return_value)=original_return_value;
- EG(destroying_function_symbol_table) = 1;
if (EG(symtable_cache_ptr)>=EG(symtable_cache_limit)) {
zend_hash_destroy(function_state.function_symbol_table);
efree(function_state.function_symbol_table);
*(++EG(symtable_cache_ptr)) = function_state.function_symbol_table;
zend_hash_clean(*EG(symtable_cache_ptr));
}
- EG(destroying_function_symbol_table) = 0;
EG(active_symbol_table) = calling_symbol_table;
} else { /* ZEND_OVERLOADED_FUNCTION */
call_overloaded_function(opline->extended_value, &Ts[opline->result.u.var].tmp_var, &EG(regular_list), &EG(persistent_list) ELS_CC);
EG(error_zval).refcount = 1;
EG(error_zval).is_ref=0;
EG(error_zval_ptr)=&EG(error_zval);
- EG(destroying_function_symbol_table) = 0;
zend_ptr_stack_init(&EG(arg_types_stack));
zend_stack_init(&EG(overloaded_objects_stack));
/* destroys stack frame, therefore makes core dumps worthless */
zend_llist_apply(&zend_extensions, (void (*)(void *)) zend_extension_activator);
EG(opline_ptr) = NULL;
+ EG(garbage_ptr) = 0;
}
#if ZEND_DEBUG
signal(SIGSEGV, original_sigsegv_handler);
#endif
+ while (EG(garbage_ptr)--) {
+ zval_dtor(EG(garbage)[EG(garbage_ptr)]);
+ efree(EG(garbage)[EG(garbage_ptr)]);
+ }
}
HashTable *zend_constants; /* constants table */
long precision;
- zend_bool destroying_function_symbol_table;
/* for extended information support */
zend_bool no_extensions;
int (*unary_op)(zval *result, zval *op1);
int (*binary_op)(zval *result, zval *op1, zval *op2);
+ zval *garbage[4];
+ int garbage_ptr;
+
void *reserved[ZEND_MAX_RESERVED_RESOURCES];
#if SUPPORT_INTERACTIVE
int interactive;