summaryrefslogtreecommitdiff
path: root/Zend/zend_execute.h
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2016-04-05 20:09:14 +0300
committerDmitry Stogov <dmitry@zend.com>2016-04-05 20:09:14 +0300
commita186ac0e47023f5b16daf25bd37750138d78ab94 (patch)
tree2d31d9651e52e460e58bb846abd7fd9b65b12059 /Zend/zend_execute.h
parenta5e21665ee001e54d827e703ec6f0a3c7053be85 (diff)
downloadphp-git-a186ac0e47023f5b16daf25bd37750138d78ab94.tar.gz
IS_CONST operands don't have to be separated. Use reference-counting instead of duplication.
- with opcache all IS_CONST operands are not refcounted (scalars, interned strings or immutable arrays) - without opcache IS_CONST operands are not shared between processes or threads and may use common reference counters
Diffstat (limited to 'Zend/zend_execute.h')
-rw-r--r--Zend/zend_execute.h14
1 files changed, 2 insertions, 12 deletions
diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h
index 5a344a63ce..738895e73c 100644
--- a/Zend/zend_execute.h
+++ b/Zend/zend_execute.h
@@ -84,12 +84,7 @@ static zend_always_inline zval* zend_assign_to_variable(zval *variable_ptr, zval
garbage = Z_COUNTED_P(variable_ptr);
if (--GC_REFCOUNT(garbage) == 0) {
ZVAL_COPY_VALUE(variable_ptr, value);
- if (value_type == IS_CONST) {
- /* IS_CONST can't be IS_OBJECT, IS_RESOURCE or IS_REFERENCE */
- if (UNEXPECTED(Z_OPT_COPYABLE_P(variable_ptr))) {
- zval_copy_ctor_func(variable_ptr);
- }
- } else if (value_type == IS_CV) {
+ if (value_type & (IS_CONST|IS_CV)) {
if (UNEXPECTED(Z_OPT_REFCOUNTED_P(variable_ptr))) {
Z_ADDREF_P(variable_ptr);
}
@@ -113,12 +108,7 @@ static zend_always_inline zval* zend_assign_to_variable(zval *variable_ptr, zval
} while (0);
ZVAL_COPY_VALUE(variable_ptr, value);
- if (value_type == IS_CONST) {
- /* IS_CONST can't be IS_OBJECT, IS_RESOURCE or IS_REFERENCE */
- if (UNEXPECTED(Z_OPT_COPYABLE_P(variable_ptr))) {
- zval_copy_ctor_func(variable_ptr);
- }
- } else if (value_type == IS_CV) {
+ if (value_type & (IS_CONST|IS_CV)) {
if (UNEXPECTED(Z_OPT_REFCOUNTED_P(variable_ptr))) {
Z_ADDREF_P(variable_ptr);
}