summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Zend/zend-parser.y4
-rw-r--r--Zend/zend_compile.h17
-rw-r--r--Zend/zend_execute.c12
-rw-r--r--Zend/zend_execute_API.c5
4 files changed, 14 insertions, 24 deletions
diff --git a/Zend/zend-parser.y b/Zend/zend-parser.y
index 461216d793..a930bdfab0 100644
--- a/Zend/zend-parser.y
+++ b/Zend/zend-parser.y
@@ -616,14 +616,14 @@ ref_list:
;
object_property:
- object_dim_list { znode tmp_znode; do_pop_object(&tmp_znode CLS_CC); do_fetch_property(&$$, &tmp_znode, &$1 CLS_CC);}
+ object_dim_list { $$ = $1; }
| cvar_without_objects { do_end_variable_parse(BP_VAR_R, 0 CLS_CC); } { znode tmp_znode; do_pop_object(&tmp_znode CLS_CC); do_fetch_property(&$$, &tmp_znode, &$1 CLS_CC);}
;
object_dim_list:
object_dim_list '[' dim_offset ']' { fetch_array_dim(&$$, &$1, &$3 CLS_CC); }
| object_dim_list '{' expr '}' { fetch_string_offset(&$$, &$1, &$3 CLS_CC); }
- | variable_name
+ | variable_name { znode tmp_znode; do_pop_object(&tmp_znode CLS_CC); do_fetch_property(&$$, &tmp_znode, &$1 CLS_CC);}
;
variable_name:
diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h
index 5d0253560a..5e7f675297 100644
--- a/Zend/zend_compile.h
+++ b/Zend/zend_compile.h
@@ -582,13 +582,17 @@ int zendlex(znode *zendlval CLS_DC);
#define PZVAL_LOCK(z) ((z)->refcount++)
#define PZVAL_UNLOCK(z) { ((z)->refcount--); \
- if (!(z)->refcount && !EG(suspend_garbage)) { \
+ if (!(z)->refcount) { \
+ (z)->refcount = 1; \
+ (z)->is_ref = 0; \
EG(garbage)[EG(garbage_ptr)++] = (z); \
if (EG(garbage_ptr) == 4) { \
- zval_dtor(EG(garbage)[0]); \
- FREE_ZVAL(EG(garbage)[0]); \
- zval_dtor(EG(garbage)[1]); \
- FREE_ZVAL(EG(garbage)[1]); \
+ if (EG(garbage)[0]->refcount==1) { \
+ zval_ptr_dtor(&EG(garbage)[0]); \
+ } \
+ if (EG(garbage)[1]->refcount==1) { \
+ zval_ptr_dtor(&EG(garbage)[1]); \
+ } \
EG(garbage)[0] = EG(garbage)[2]; \
EG(garbage)[1] = EG(garbage)[3]; \
EG(garbage_ptr) -= 2; \
@@ -596,9 +600,6 @@ int zendlex(znode *zendlval CLS_DC);
} \
}
-#define SUSPEND_GARBAGE() (EG(suspend_garbage)=1)
-#define RESUME_GARBAGE() (EG(suspend_garbage)=0)
-
#define SELECTIVE_PZVAL_LOCK(pzv, pzn) if (!((pzn)->u.EA.type & EXT_TYPE_UNUSED)) { PZVAL_LOCK(pzv); }
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index f6d7ddb1e0..61b64d46de 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -1273,18 +1273,14 @@ binary_assign_op_addr: {
NEXT_OPCODE();
case ZEND_ASSIGN: {
zval *value;
- SUSPEND_GARBAGE();
value = get_zval_ptr(&opline->op2, Ts, &EG(free_op2), BP_VAR_R);
- RESUME_GARBAGE();
zend_assign_to_variable(&opline->result, &opline->op1, &opline->op2, value, (EG(free_op2)?IS_TMP_VAR:opline->op2.op_type), Ts ELS_CC);
/* zend_assign_to_variable() always takes care of op2, never free it! */
}
NEXT_OPCODE();
case ZEND_ASSIGN_REF:
- SUSPEND_GARBAGE();
zend_assign_to_variable_reference(&opline->result, get_zval_ptr_ptr(&opline->op1, Ts, BP_VAR_W), get_zval_ptr_ptr(&opline->op2, Ts, BP_VAR_W), Ts ELS_CC);
- RESUME_GARBAGE();
NEXT_OPCODE();
case ZEND_JMP:
#if DEBUG_ZEND>=2
@@ -1616,7 +1612,6 @@ do_fcall_common:
zval *retval_ptr;
zval **retval_ptr_ptr;
- SUSPEND_GARBAGE();
if ((EG(active_op_array)->return_reference == ZEND_RETURN_REF) &&
(opline->op1.op_type != IS_CONST) &&
(opline->op1.op_type != IS_TMP_VAR)) {
@@ -1650,7 +1645,6 @@ do_fcall_common:
(*EG(return_value_ptr_ptr))->is_ref = 0;
}
}
- RESUME_GARBAGE();
#if SUPPORT_INTERACTIVE
op_array->last_executed_op_number = opline-op_array->opcodes;
#endif
@@ -1679,9 +1673,7 @@ do_fcall_common:
}
{
zval *varptr;
- SUSPEND_GARBAGE();
varptr = get_zval_ptr(&opline->op1, Ts, &EG(free_op1), BP_VAR_R);
- RESUME_GARBAGE();
if (varptr == &EG(uninitialized_zval)) {
ALLOC_ZVAL(varptr);
@@ -1705,9 +1697,7 @@ send_by_ref:
case ZEND_SEND_REF: {
zval **varptr_ptr;
zval *varptr;
- SUSPEND_GARBAGE();
varptr_ptr = get_zval_ptr_ptr(&opline->op1, Ts, BP_VAR_W);
- RESUME_GARBAGE();
varptr = *varptr_ptr;
@@ -1898,14 +1888,12 @@ send_by_ref:
zval *expr_ptr, **expr_ptr_ptr = NULL;
zval *offset=get_zval_ptr(&opline->op2, Ts, &EG(free_op2), BP_VAR_R);
- SUSPEND_GARBAGE();
if (opline->extended_value) {
expr_ptr_ptr=get_zval_ptr_ptr(&opline->op1, Ts, BP_VAR_R);
expr_ptr = *expr_ptr_ptr;
} else {
expr_ptr=get_zval_ptr(&opline->op1, Ts, &EG(free_op1), BP_VAR_R);
}
- RESUME_GARBAGE();
if (opline->opcode==ZEND_INIT_ARRAY) {
array_init(array_ptr);
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index b7c59ef64f..62b4cee1f6 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -146,8 +146,9 @@ void shutdown_executor(ELS_D)
signal(SIGSEGV, original_sigsegv_handler);
#endif
while (EG(garbage_ptr)--) {
- zval_dtor(EG(garbage)[EG(garbage_ptr)]);
- FREE_ZVAL(EG(garbage)[EG(garbage_ptr)]);
+ if (EG(garbage)[EG(garbage_ptr)]->refcount==1) {
+ zval_ptr_dtor(&EG(garbage)[EG(garbage_ptr)]);
+ }
}
zend_hash_destroy(&EG(imported_files));