com php-src: Eliminated check for assignment to itself: Zend/zend_execute.h
| From: | Dmitry Stogov | Date: | Tue, 09 Apr 2019 12:37:19 +0000 |
| Subject: | com php-src: Eliminated check for assignment to itself: Zend/zend_execute.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-105596@lists.php.net to get a copy of this message | ||
Commit: ec5d4c79d28fa9e12a213e24b491c5e21673e5d7
Author: Dmitry Stogov <dmitry@zend.com> Tue, 9 Apr 2019 15:37:19 +0300
Parents: 5fdee9394f5481459316c0e46a9ad8e25cab6134
Branches: PHP-7.4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=ec5d4c79d28fa9e12a213e24b491c5e21673e5d7
Log:
Eliminated check for assignment to itself
Changed paths:
M Zend/zend_execute.h
Diff:
diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h
index deb299a..effeec6 100644
--- a/Zend/zend_execute.h
+++ b/Zend/zend_execute.h
@@ -121,39 +121,32 @@ static zend_always_inline zval* zend_assign_to_variable(zval *variable_ptr,
zval
Z_OBJ_HANDLER_P(variable_ptr, set)(variable_ptr, value);
return variable_ptr;
}
- if (ZEND_CONST_COND(value_type & (IS_VAR|IS_CV), 1) && variable_ptr == value) {
- if (value_type == IS_VAR && ref) {
- ZEND_ASSERT(GC_REFCOUNT(ref) > 1);
- GC_DELREF(ref);
+ garbage = Z_COUNTED_P(variable_ptr);
+ ZVAL_COPY_VALUE(variable_ptr, value);
+ if (ZEND_CONST_COND(value_type == IS_CONST, 0)) {
+ if (UNEXPECTED(Z_OPT_REFCOUNTED_P(variable_ptr))) {
+ Z_ADDREF_P(variable_ptr);
+ }
+ } else if (value_type & (IS_CONST|IS_CV)) {
+ if (Z_OPT_REFCOUNTED_P(variable_ptr)) {
+ Z_ADDREF_P(variable_ptr);
+ }
+ } else if (ZEND_CONST_COND(value_type == IS_VAR, 1) && UNEXPECTED(ref)) {
+ if (UNEXPECTED(GC_DELREF(ref) == 0)) {
+ efree_size(ref, sizeof(zend_reference));
+ } else if (Z_OPT_REFCOUNTED_P(variable_ptr)) {
+ Z_ADDREF_P(variable_ptr);
}
- return variable_ptr;
}
- garbage = Z_COUNTED_P(variable_ptr);
if (GC_DELREF(garbage) == 0) {
- ZVAL_COPY_VALUE(variable_ptr, value);
- if (ZEND_CONST_COND(value_type == IS_CONST, 0)) {
- if (UNEXPECTED(Z_OPT_REFCOUNTED_P(variable_ptr))) {
- Z_ADDREF_P(variable_ptr);
- }
- } else if (value_type & (IS_CONST|IS_CV)) {
- if (Z_OPT_REFCOUNTED_P(variable_ptr)) {
- Z_ADDREF_P(variable_ptr);
- }
- } else if (ZEND_CONST_COND(value_type == IS_VAR, 1) && UNEXPECTED(ref)) {
- if (UNEXPECTED(GC_DELREF(ref) == 0)) {
- efree_size(ref, sizeof(zend_reference));
- } else if (Z_OPT_REFCOUNTED_P(variable_ptr)) {
- Z_ADDREF_P(variable_ptr);
- }
- }
rc_dtor_func(garbage);
- return variable_ptr;
} else { /* we need to split */
/* optimized version of GC_ZVAL_CHECK_POSSIBLE_ROOT(variable_ptr) */
if (UNEXPECTED(GC_MAY_LEAK(garbage))) {
gc_possible_root(garbage);
}
}
+ return variable_ptr;
}
} while (0);