]> granicus.if.org Git - php/commitdiff
Optimize allocations into uninitialized_zval assignments
authorZeev Suraski <zeev@php.net>
Thu, 20 May 1999 20:00:59 +0000 (20:00 +0000)
committerZeev Suraski <zeev@php.net>
Thu, 20 May 1999 20:00:59 +0000 (20:00 +0000)
Zend/zend_compile.h
Zend/zend_execute.c

index a5c204c5a6d3b62c25f3ee9ea079bfb3b3cbae8b..fde66463fcf1aee8e7f882789b47cc227dc7426f 100644 (file)
@@ -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];
index 2c6f04120e47ca27c5ee2efdfabb2a3d9a6dccef..37aa6400a5938142eab82e288e8802962defcfcc 100644 (file)
@@ -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);