com php-src: Use ZEND_ASSUME() to perform the fol lowing check only on "slow" path.: Zend/zen d_operators.h

From: Date: Thu, 06 Jun 2019 11:22:10 +0000
Subject: com php-src: Use ZEND_ASSUME() to perform the fol lowing check only on "slow" path.: Zend/zen d_operators.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-106591@lists.php.net to get a copy of this message
Commit: 741468d145dced618456ad4c4877571083eac3b2 Author: Dmitry Stogov <dmitry@zend.com> Thu, 6 Jun 2019 14:22:10 +0300 Parents: be74ca497680ef544af1f650fe4717a3e0d0af67 Branches: PHP-7.4 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=741468d145dced618456ad4c4877571083eac3b2 Log: Use ZEND_ASSUME() to perform the following check only on "slow" path. Changed paths: M Zend/zend_operators.h Diff: diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h index 45c8305..b126e96 100644 --- a/Zend/zend_operators.h +++ b/Zend/zend_operators.h @@ -287,7 +287,9 @@ static zend_always_inline void zend_tmp_string_release(zend_string *tmp) { /* Like zval_get_string, but returns NULL if the conversion fails with an exception. */ static zend_always_inline zend_string *zval_try_get_string(zval *op) { if (EXPECTED(Z_TYPE_P(op) == IS_STRING)) { - return zend_string_copy(Z_STR_P(op)); + zend_string *ret = zend_string_copy(Z_STR_P(op)); + ZEND_ASSUME(ret != NULL); + return ret; } else { return zval_try_get_string_func(op); } @@ -296,8 +298,10 @@ static zend_always_inline zend_string *zval_try_get_string(zval *op) { /* Like zval_get_tmp_string, but returns NULL if the conversion fails with an exception. */ static zend_always_inline zend_string *zval_try_get_tmp_string(zval *op, zend_string **tmp) { if (EXPECTED(Z_TYPE_P(op) == IS_STRING)) { + zend_string *ret = Z_STR_P(op); *tmp = NULL; - return Z_STR_P(op); + ZEND_ASSUME(ret != NULL); + return ret; } else { return *tmp = zval_try_get_string_func(op); }

« previous php.cvs (#106591) next »