summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZeev Suraski <zeev@php.net>1999-05-20 20:00:59 +0000
committerZeev Suraski <zeev@php.net>1999-05-20 20:00:59 +0000
commit9cb2cf13931ddec5623f3ab1d3e8053ee4666ffd (patch)
treefd32a306281629c245cca5ed7666cc74cb40c465
parent59a539f6ad696a53e4358fdfc36ac4965dcbc989 (diff)
downloadphp-git-9cb2cf13931ddec5623f3ab1d3e8053ee4666ffd.tar.gz
Optimize allocations into uninitialized_zval assignments
-rw-r--r--Zend/zend_compile.h2
-rw-r--r--Zend/zend_execute.c32
2 files changed, 11 insertions, 23 deletions
diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h
index a5c204c5a6..fde66463fc 100644
--- a/Zend/zend_compile.h
+++ b/Zend/zend_compile.h
@@ -139,7 +139,7 @@ typedef union {
} zend_function;
-typedef struct {
+typedef struct _zend_function_state {
HashTable *function_symbol_table;
zend_function *function;
void *reserved[4];
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index 2c6f04120e..37aa6400a5 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -186,12 +186,9 @@ static inline zval **zend_fetch_property_address_inner(HashTable *ht, znode *op2
zend_error(E_NOTICE,"Undefined property: %s", prop_ptr->value.str.val);
/* break missing intentionally */
case BP_VAR_W: {
- zval *new_zval = (zval *) emalloc(sizeof(zval));
+ zval *new_zval = &EG(uninitialized_zval);
- var_uninit(new_zval);
- new_zval->refcount=1;
- new_zval->is_ref=0;
- //zend_hash_update(ht, prop_ptr->value.str.val, prop_ptr->value.str.len+1, &new_zval, sizeof(zval *), (void **) &retval);
+ new_zval->refcount++;
zend_hash_update_ptr(ht, prop_ptr->value.str.val, prop_ptr->value.str.len+1, new_zval, sizeof(zval *), (void **) &retval);
}
break;
@@ -405,11 +402,9 @@ static inline void zend_fetch_var_address(znode *result, znode *op1, znode *op2,
zend_error(E_NOTICE,"Undefined variable: %s", varname->value.str.val);
/* break missing intentionally */
case BP_VAR_W: {
- zval *new_zval = (zval *) emalloc(sizeof(zval));
+ zval *new_zval = &EG(uninitialized_zval);
- var_uninit(new_zval);
- new_zval->refcount=1;
- new_zval->is_ref=0;
+ new_zval->refcount++;
//zend_hash_update(target_symbol_table, varname->value.str.val, varname->value.str.len+1, &new_zval, sizeof(zval *), (void **) &retval);
zend_hash_update_ptr(target_symbol_table, varname->value.str.val, varname->value.str.len+1, new_zval, sizeof(zval *), (void **) &retval);
}
@@ -450,12 +445,9 @@ static inline zval **zend_fetch_dimension_address_inner(HashTable *ht, znode *op
zend_error(E_NOTICE,"Undefined index: %s", dim->value.str.val);
/* break missing intentionally */
case BP_VAR_W: {
- zval *new_zval = (zval *) emalloc(sizeof(zval));
+ zval *new_zval = &EG(uninitialized_zval);
- var_uninit(new_zval);
- new_zval->refcount=1;
- new_zval->is_ref=0;
- //zend_hash_update(ht, dim->value.str.val, dim->value.str.len+1, &new_zval, sizeof(zval *), (void **) &retval);
+ new_zval->refcount++;
zend_hash_update_ptr(ht, dim->value.str.val, dim->value.str.len+1, new_zval, sizeof(zval *), (void **) &retval);
}
break;
@@ -476,11 +468,9 @@ static inline zval **zend_fetch_dimension_address_inner(HashTable *ht, znode *op
zend_error(E_NOTICE,"Undefined offset: %d", dim->value.lval);
/* break missing intentionally */
case BP_VAR_W: {
- zval *new_zval = (zval *) emalloc(sizeof(zval));
+ zval *new_zval = &EG(uninitialized_zval);
- var_uninit(new_zval);
- new_zval->refcount=1;
- new_zval->is_ref=0;
+ new_zval->refcount++;
zend_hash_index_update(ht, dim->value.lval, &new_zval, sizeof(zval *), (void **) &retval);
}
break;
@@ -584,11 +574,9 @@ static inline void zend_fetch_dimension_address(znode *result, znode *op1, znode
zendi_zval_copy_ctor(*container);
}
if (op2->op_type == IS_UNUSED) {
- zval *new_zval = (zval *) emalloc(sizeof(zval));
+ zval *new_zval = &EG(uninitialized_zval);
- var_uninit(new_zval);
- new_zval->refcount = 1;
- new_zval->is_ref = 0;
+ new_zval->refcount++;
zend_hash_next_index_insert_ptr(container->value.ht, new_zval, sizeof(zval *), (void **) retval);
} else {
*retval = zend_fetch_dimension_address_inner(container->value.ht, op2, Ts, type ELS_CC);