com php-src: Improved conditions order: Zend/zend.h Zend/zend_compile.c

From: Date: Tue, 10 Jun 2014 22:46:50 +0000
Subject: com php-src: Improved conditions order: Zend/zend.h Zend/zend_compile.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-78817@lists.php.net to get a copy of this message
Commit: 592c8a0426d070d4ff9031695d238452248fa6c3 Author: Dmitry Stogov <dmitry@zend.com> Wed, 11 Jun 2014 02:46:50 +0400 Parents: 3c69140a9065b66259c3f114ce4528b3ec784816 Branches: phpng Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=592c8a0426d070d4ff9031695d238452248fa6c3 Log: Improved conditions order Changed paths: M Zend/zend.h M Zend/zend_compile.c Diff: diff --git a/Zend/zend.h b/Zend/zend.h index c346c02..ea2c8f7 100644 --- a/Zend/zend.h +++ b/Zend/zend.h @@ -379,7 +379,7 @@ void zend_error_noreturn(int type, const char *format, ...) __attribute__ ((nore #include "zend_string.h" static zend_always_inline zend_uint zval_refcount_p(zval* pz) { - ZEND_ASSERT(Z_REFCOUNTED_P(pz)); + ZEND_ASSERT(Z_REFCOUNTED_P(pz) || Z_IMMUTABLE_P(pz)); return GC_REFCOUNT(Z_COUNTED_P(pz)); } @@ -734,10 +734,10 @@ END_EXTERN_C() #define SEPARATE_ARRAY(zv) do { \ zval *_zv = (zv); \ - if (Z_IMMUTABLE_P(_zv)) { \ - zval_copy_ctor_func(_zv); \ - } else if (Z_REFCOUNT_P(_zv) > 1) { \ - Z_DELREF_P(_zv); \ + if (Z_REFCOUNT_P(_zv) > 1) { \ + if (!Z_IMMUTABLE_P(_zv)) { \ + Z_DELREF_P(_zv); \ + } \ zval_copy_ctor_func(_zv); \ } \ } while (0) @@ -746,10 +746,10 @@ END_EXTERN_C() zval *_zv = (zv); \ if (Z_COPYABLE_P(_zv) || \ Z_IMMUTABLE_P(_zv)) { \ - if (Z_IMMUTABLE_P(_zv)) { \ - zval_copy_ctor_func(_zv); \ - } else if (Z_REFCOUNT_P(_zv) > 1) { \ - Z_DELREF_P(_zv); \ + if (Z_REFCOUNT_P(_zv) > 1) { \ + if (!Z_IMMUTABLE_P(_zv)) { \ + Z_DELREF_P(_zv); \ + } \ zval_copy_ctor_func(_zv); \ } \ } \ @@ -759,15 +759,16 @@ END_EXTERN_C() zval *_zv = (zv); \ if (Z_REFCOUNTED_P(_zv) || \ Z_IMMUTABLE_P(_zv)) { \ - if (Z_IMMUTABLE_P(_zv)) { \ - zval_copy_ctor_func(_zv); \ - } else if (Z_REFCOUNT_P(_zv) > 1) { \ - if (Z_ISREF_P(_zv)) { \ + if (Z_REFCOUNT_P(_zv) > 1) { \ + if (Z_COPYABLE_P(_zv) || \ + Z_IMMUTABLE_P(_zv)) { \ + if (!Z_IMMUTABLE_P(_zv)) { \ + Z_DELREF_P(_zv); \ + } \ + zval_copy_ctor_func(_zv); \ + } else if (Z_ISREF_P(_zv)) { \ Z_DELREF_P(_zv); \ ZVAL_DUP(_zv, Z_REFVAL_P(_zv)); \ - } else if (Z_COPYABLE_P(_zv)) { \ - Z_DELREF_P(_zv); \ - zval_copy_ctor_func(_zv); \ } \ } \ } \ @@ -775,15 +776,13 @@ END_EXTERN_C() #define SEPARATE_ZVAL_IF_NOT_REF(zv) do { \ zval *_zv = (zv); \ - if (!Z_ISREF_P(_zv)) { \ - if (Z_COPYABLE_P(_zv) || \ - Z_IMMUTABLE_P(_zv)) { \ - if (Z_IMMUTABLE_P(_zv)) { \ - zval_copy_ctor_func(_zv); \ - } else if (Z_REFCOUNT_P(_zv) > 1) { \ + if (Z_COPYABLE_P(_zv) || \ + Z_IMMUTABLE_P(_zv)) { \ + if (Z_REFCOUNT_P(_zv) > 1) { \ + if (!Z_IMMUTABLE_P(_zv)) { \ Z_DELREF_P(_zv); \ - zval_copy_ctor_func(_zv); \ } \ + zval_copy_ctor_func(_zv); \ } \ } \ } while (0) diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index de45b5a..ada6c87 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -7501,6 +7501,7 @@ ZEND_API void zend_make_immutable_array(zval *zv TSRMLS_DC) /* {{{ */ } Z_TYPE_FLAGS_P(zv) = IS_TYPE_IMMUTABLE; + GC_REFCOUNT(Z_COUNTED_P(zv)) = 2; Z_ARRVAL_P(zv)->u.flags &= ~HASH_FLAG_APPLY_PROTECTION; /* store as an anonymous constant */

« previous php.cvs (#78817) next »