From 59d5462a6a69655176d671eaee184a76d5371642 Mon Sep 17 00:00:00 2001 From: Andi Gutmans Date: Tue, 28 Sep 1999 17:37:14 +0000 Subject: [PATCH] - Stop using the locking mechanism and start using refcount. Now we know when we need to free but we still need to support it --- Zend/zend_compile.h | 15 ++++++++++++++- Zend/zend_execute.c | 12 ++++-------- Zend/zend_execute_API.c | 8 -------- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index 23fd4936de..d26adba0d6 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -553,12 +553,25 @@ int zendlex(znode *zendlval CLS_DC); #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_LOCKED(z) ((z)->EA.locks>0) +#if 0 #define PZVAL_LOCK(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); } - +#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 */ diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 11b06ae644..542a75c1c5 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -35,14 +35,6 @@ # include #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_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) { switch (type) { case IS_VAR: + /* if (PZVAL_IS_LOCKED(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; zval_copy_ctor(value); } + */ /* break missing intentionally */ case IS_CONST: 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 */ switch (type) { case IS_VAR: + /* if (PZVAL_IS_LOCKED(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; zval_copy_ctor(value); } + */ /* break missing intentionally */ case IS_CONST: if (PZVAL_IS_REF(value)) { diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 01d8128a9a..9b6f1d04db 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -32,14 +32,6 @@ #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); -- 2.50.1