From d12679a64dc30d0a505a98c33d1549dc617ab92d Mon Sep 17 00:00:00 2001 From: Andi Gutmans Date: Tue, 22 Oct 2002 19:31:53 +0000 Subject: [PATCH] - Improve overall engine performance --- Zend/zend_compile.h | 2 +- Zend/zend_execute.c | 17 ++++++----------- Zend/zend_globals.h | 2 +- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index 50fb1a78bb..b919cd23b3 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -32,7 +32,7 @@ #define DEBUG_ZEND 0 #define FREE_PNODE(znode) zval_dtor(&znode->u.constant); -#define FREE_OP(Ts, op, should_free) if (should_free) zval_dtor(&Ts[(op)->u.var].tmp_var); +#define FREE_OP(Ts, op, should_free) if (should_free) zval_dtor(should_free); #define SET_UNUSED(op) (op).op_type = IS_UNUSED diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 9a969b5a07..a55d21e561 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -68,7 +68,7 @@ static void zend_extension_fcall_end_handler(zend_extension *extension, zend_op_ #define RETURN_VALUE_USED(opline) (!((opline)->result.u.EA.type & EXT_TYPE_UNUSED)) -static inline zval *_get_zval_ptr(znode *node, temp_variable *Ts, int *should_free TSRMLS_DC) +static inline zval *_get_zval_ptr(znode *node, temp_variable *Ts, zval **should_free TSRMLS_DC) { switch(node->op_type) { case IS_CONST: @@ -76,8 +76,7 @@ static inline zval *_get_zval_ptr(znode *node, temp_variable *Ts, int *should_fr return &node->u.constant; break; case IS_TMP_VAR: - *should_free = 1; - return &Ts[node->u.var].tmp_var; + return *should_free = &Ts[node->u.var].tmp_var; break; case IS_VAR: if (Ts[node->u.var].var.ptr) { @@ -85,7 +84,7 @@ static inline zval *_get_zval_ptr(znode *node, temp_variable *Ts, int *should_fr *should_free = 0; return Ts[node->u.var].var.ptr; } else { - *should_free = 1; + *should_free = &Ts[node->u.var].tmp_var; switch (Ts[node->u.var].EA.type) { case IS_STRING_OFFSET: { @@ -114,10 +113,6 @@ static inline zval *_get_zval_ptr(znode *node, temp_variable *Ts, int *should_fr } } break; - case IS_UNUSED: - *should_free = 0; - return NULL; - break; EMPTY_SWITCH_DEFAULT_CASE() } return NULL; @@ -278,7 +273,7 @@ static inline zval **get_obj_zval_ptr_ptr(znode *op, temp_variable *Ts, int type return get_zval_ptr_ptr(op, Ts, type); } -static inline zval *get_obj_zval_ptr(znode *op, temp_variable *Ts, int *freeop, int type TSRMLS_DC) +static inline zval *get_obj_zval_ptr(znode *op, temp_variable *Ts, zval **freeop, int type TSRMLS_DC) { if(op->op_type == IS_UNUSED) { if(EG(This)) { @@ -663,7 +658,7 @@ static inline HashTable *zend_get_target_symbol_table(zend_op *opline, temp_vari static void zend_fetch_var_address(zend_op *opline, temp_variable *Ts, int type TSRMLS_DC) { - int free_op1; + zval *free_op1; zval *varname = get_zval_ptr(&opline->op1, Ts, &free_op1, BP_VAR_R); zval **retval; zval tmp_varname; @@ -910,7 +905,7 @@ static void zend_fetch_dimension_address(znode *result, znode *op1, znode *op2, static void zend_fetch_dimension_address_from_tmp_var(znode *result, znode *op1, znode *op2, temp_variable *Ts TSRMLS_DC) { - int free_op1; + zval *free_op1; zval *container = get_zval_ptr(op1, Ts, &free_op1, BP_VAR_R); if (container->type != IS_ARRAY) { diff --git a/Zend/zend_globals.h b/Zend/zend_globals.h index 9ca3aa24e5..8e1fc29a3a 100644 --- a/Zend/zend_globals.h +++ b/Zend/zend_globals.h @@ -186,7 +186,7 @@ struct _zend_executor_globals { HashTable persistent_list; zend_ptr_stack argument_stack; - int free_op1, free_op2; + zval *free_op1, *free_op2; int (*unary_op)(zval *result, zval *op1); int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC); -- 2.50.1