mirror of
https://github.com/php/php-src.git
synced 2025-01-26 13:44:22 +08:00
A cheaper way to reset type flags.
This commit is contained in:
parent
60fb58799f
commit
5c77bac9a7
@ -3624,7 +3624,7 @@ static inline zend_string *zval_make_interned_string(zval *zv) /* {{{ */
|
||||
ZEND_ASSERT(Z_TYPE_P(zv) == IS_STRING);
|
||||
Z_STR_P(zv) = zend_new_interned_string(Z_STR_P(zv));
|
||||
if (ZSTR_IS_INTERNED(Z_STR_P(zv))) {
|
||||
Z_TYPE_FLAGS_P(zv) &= ~ (IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE);
|
||||
Z_TYPE_FLAGS_P(zv) = 0;
|
||||
}
|
||||
return Z_STR_P(zv);
|
||||
}
|
||||
|
@ -441,7 +441,7 @@ static inline zend_string *zval_make_interned_string(zval *zv) /* {{{ */
|
||||
ZEND_ASSERT(Z_TYPE_P(zv) == IS_STRING);
|
||||
Z_STR_P(zv) = zend_new_interned_string(Z_STR_P(zv));
|
||||
if (ZSTR_IS_INTERNED(Z_STR_P(zv))) {
|
||||
Z_TYPE_FLAGS_P(zv) &= ~ (IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE);
|
||||
Z_TYPE_FLAGS_P(zv) = 0;
|
||||
}
|
||||
return Z_STR_P(zv);
|
||||
}
|
||||
|
@ -283,7 +283,7 @@ static void zend_persist_zval(zval *z)
|
||||
switch (Z_TYPE_P(z)) {
|
||||
case IS_STRING:
|
||||
zend_accel_store_interned_string(Z_STR_P(z));
|
||||
Z_TYPE_FLAGS_P(z) &= ~ (IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE);
|
||||
Z_TYPE_FLAGS_P(z) = 0;
|
||||
break;
|
||||
case IS_ARRAY:
|
||||
new_ptr = zend_shared_alloc_get_xlat_entry(Z_ARR_P(z));
|
||||
@ -319,12 +319,12 @@ static void zend_persist_zval(zval *z)
|
||||
new_ptr = zend_shared_alloc_get_xlat_entry(Z_AST_P(z));
|
||||
if (new_ptr) {
|
||||
Z_AST_P(z) = new_ptr;
|
||||
Z_TYPE_FLAGS_P(z) &= ~ (IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE);
|
||||
Z_TYPE_FLAGS_P(z) = 0;
|
||||
} else {
|
||||
zend_ast_ref *old_ref = Z_AST_P(z);
|
||||
Z_ARR_P(z) = zend_accel_memdup(Z_AST_P(z), sizeof(zend_ast_ref));
|
||||
zend_persist_ast(GC_AST(old_ref));
|
||||
Z_TYPE_FLAGS_P(z) &= ~ (IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE);
|
||||
Z_TYPE_FLAGS_P(z) = 0;
|
||||
GC_SET_REFCOUNT(Z_COUNTED_P(z), 2);
|
||||
efree(old_ref);
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ static void zend_persist_zval_calc(zval *z)
|
||||
case IS_STRING:
|
||||
ADD_INTERNED_STRING(Z_STR_P(z), 0);
|
||||
if (ZSTR_IS_INTERNED(Z_STR_P(z))) {
|
||||
Z_TYPE_FLAGS_P(z) &= ~ (IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE);
|
||||
Z_TYPE_FLAGS_P(z) = 0;
|
||||
}
|
||||
break;
|
||||
case IS_ARRAY:
|
||||
|
@ -330,7 +330,7 @@ static void php_browscap_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callb
|
||||
new_value = zend_new_interned_string(zend_string_copy(new_value));
|
||||
if (ZSTR_IS_INTERNED(new_value)) {
|
||||
if (new_value == Z_STR_P(arg2)) {
|
||||
Z_TYPE_FLAGS_P(arg2) &= ~(IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE);
|
||||
Z_TYPE_FLAGS_P(arg2) = 0;
|
||||
}
|
||||
} else {
|
||||
zend_string_release(new_value);
|
||||
@ -361,7 +361,7 @@ static void php_browscap_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callb
|
||||
new_key = zend_new_interned_string(zend_string_copy(new_key));
|
||||
if (ZSTR_IS_INTERNED(new_key)) {
|
||||
if (new_key == Z_STR_P(arg1)) {
|
||||
Z_TYPE_FLAGS_P(arg1) &= ~(IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE);
|
||||
Z_TYPE_FLAGS_P(arg1) = 0;
|
||||
}
|
||||
} else {
|
||||
zend_string_release(new_key);
|
||||
@ -389,7 +389,7 @@ static void php_browscap_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callb
|
||||
if (persistent) {
|
||||
pattern = zend_new_interned_string(zend_string_copy(pattern));
|
||||
if (ZSTR_IS_INTERNED(pattern)) {
|
||||
Z_TYPE_FLAGS_P(arg1) &= ~(IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE);
|
||||
Z_TYPE_FLAGS_P(arg1) = 0;
|
||||
} else {
|
||||
zend_string_release(pattern);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user