- Stop using the locking mechanism and start using refcount.

Now we know when we need to free but we still need to support it
This commit is contained in:
Andi Gutmans 1999-09-28 17:37:14 +00:00
parent cf6c92949c
commit 59d5462a6a
3 changed files with 18 additions and 17 deletions

View file

@ -553,12 +553,25 @@ int zendlex(znode *zendlval CLS_DC);
#define ZEND_CTOR_CALL 1<<1 #define ZEND_CTOR_CALL 1<<1
#define AI_USE_PTR(ai) \
if ((ai).ptr_ptr) { \
(ai).ptr = *((ai).ptr_ptr); \
(ai).ptr_ptr = &((ai).ptr); \
} else { \
(ai).ptr = NULL; \
}
#define PZVAL_IS_REF(z) ((z)->EA.is_ref) #define PZVAL_IS_REF(z) ((z)->EA.is_ref)
#define PZVAL_IS_LOCKED(z) ((z)->EA.locks>0) #define PZVAL_IS_LOCKED(z) ((z)->EA.locks>0)
#if 0
#define PZVAL_LOCK(z) (z)->EA.locks++ #define PZVAL_LOCK(z) (z)->EA.locks++
#define PZVAL_UNLOCK(z) (z)->EA.locks-- #define PZVAL_UNLOCK(z) (z)->EA.locks--
#define SELECTIVE_PZVAL_LOCK(pzv, pzn) if (!((pzn)->u.EA.type & EXT_TYPE_UNUSED)) { PZVAL_LOCK(pzv); } #define SELECTIVE_PZVAL_LOCK(pzv, pzn) if (!((pzn)->u.EA.type & EXT_TYPE_UNUSED)) { PZVAL_LOCK(pzv); }
#else
#define PZVAL_LOCK(z) ((z)->refcount++)
#define PZVAL_UNLOCK(z) ((z)->refcount--)
#define SELECTIVE_PZVAL_LOCK(pzv, pzn) if (!((pzn)->u.EA.type & EXT_TYPE_UNUSED)) { PZVAL_LOCK(pzv); }
#endif
#endif /* _COMPILE_H */ #endif /* _COMPILE_H */

View file

@ -35,14 +35,6 @@
# include <alloca.h> # include <alloca.h>
#endif #endif
#define AI_USE_PTR(ai) \
if ((ai).ptr_ptr) { \
(ai).ptr = *((ai).ptr_ptr); \
(ai).ptr_ptr = &((ai).ptr); \
} else { \
(ai).ptr = NULL; \
}
#define get_zval_ptr(node, Ts, should_free, type) _get_zval_ptr(node, Ts, should_free ELS_CC) #define get_zval_ptr(node, Ts, should_free, type) _get_zval_ptr(node, Ts, should_free ELS_CC)
#define get_zval_ptr_ptr(node, Ts, type) _get_zval_ptr_ptr(node, Ts ELS_CC) #define get_zval_ptr_ptr(node, Ts, type) _get_zval_ptr_ptr(node, Ts ELS_CC)
@ -334,6 +326,7 @@ static inline void zend_assign_to_variable(znode *result, znode *op1, znode *op2
if (variable_ptr->refcount==0) { if (variable_ptr->refcount==0) {
switch (type) { switch (type) {
case IS_VAR: case IS_VAR:
/*
if (PZVAL_IS_LOCKED(value)) { if (PZVAL_IS_LOCKED(value)) {
zval *orig_value = value; zval *orig_value = value;
@ -343,6 +336,7 @@ static inline void zend_assign_to_variable(znode *result, znode *op1, znode *op2
value->EA.locks = 0; value->EA.locks = 0;
zval_copy_ctor(value); zval_copy_ctor(value);
} }
*/
/* break missing intentionally */ /* break missing intentionally */
case IS_CONST: case IS_CONST:
if (variable_ptr==value) { if (variable_ptr==value) {
@ -375,6 +369,7 @@ static inline void zend_assign_to_variable(znode *result, znode *op1, znode *op2
} else { /* we need to split */ } else { /* we need to split */
switch (type) { switch (type) {
case IS_VAR: case IS_VAR:
/*
if (PZVAL_IS_LOCKED(value)) { if (PZVAL_IS_LOCKED(value)) {
zval *orig_value = value; zval *orig_value = value;
@ -384,6 +379,7 @@ static inline void zend_assign_to_variable(znode *result, znode *op1, znode *op2
value->EA.locks = 0; value->EA.locks = 0;
zval_copy_ctor(value); zval_copy_ctor(value);
} }
*/
/* break missing intentionally */ /* break missing intentionally */
case IS_CONST: case IS_CONST:
if (PZVAL_IS_REF(value)) { if (PZVAL_IS_REF(value)) {

View file

@ -32,14 +32,6 @@
#include "zend_extensions.h" #include "zend_extensions.h"
#define AI_USE_PTR(ai) \
if ((ai).ptr_ptr) { \
(ai).ptr = *((ai).ptr_ptr); \
(ai).ptr_ptr = &((ai).ptr); \
} else { \
(ai).ptr = NULL; \
}
ZEND_API void (*zend_execute)(zend_op_array *op_array ELS_DC); ZEND_API void (*zend_execute)(zend_op_array *op_array ELS_DC);