com php-src: SEPARATE_STRING() micro optimization: Zend/zend_types.h
| From: | Dmitry Stogov | Date: | Thu, 07 Dec 2017 12:01:04 +0000 |
| Subject: | com php-src: SEPARATE_STRING() micro optimization: Zend/zend_types.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-100518@lists.php.net to get a copy of this message | ||
Commit: 7bc76c408face42894c5ce53a1521ee07dc0475e
Author: Dmitry Stogov <dmitry@zend.com> Thu, 7 Dec 2017 15:01:04 +0300
Parents: 2d8f238318dc6a92c414d6b73c062d519fd4aad8
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=7bc76c408face42894c5ce53a1521ee07dc0475e
Log:
SEPARATE_STRING() micro optimization
Changed paths:
M Zend/zend_types.h
Diff:
diff --git a/Zend/zend_types.h b/Zend/zend_types.h
index fcd5da2..6e7a1f3 100644
--- a/Zend/zend_types.h
+++ b/Zend/zend_types.h
@@ -1070,10 +1070,12 @@ static zend_always_inline uint32_t zval_delref_p(zval* pz) {
#define SEPARATE_STRING(zv) do { \
zval *_zv = (zv); \
if (Z_REFCOUNT_P(_zv) > 1) { \
- if (Z_REFCOUNTED_P(_zv)) { \
- Z_DELREF_P(_zv); \
- } \
- zval_copy_ctor_func(_zv); \
+ zend_string *_str = Z_STR_P(_zv); \
+ ZEND_ASSERT(Z_REFCOUNTED_P(_zv)); \
+ ZEND_ASSERT(!ZSTR_IS_INTERNED(_str)); \
+ Z_DELREF_P(_zv); \
+ ZVAL_NEW_STR(_zv, zend_string_init( \
+ ZSTR_VAL(_str), ZSTR_LEN(_str), 0)); \
} \
} while (0)