Skip to content

Commit 6d0691a

Browse files
committed
test
1 parent 64fb530 commit 6d0691a

File tree

3 files changed

+21
-26
lines changed

3 files changed

+21
-26
lines changed

Zend/zend_API.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1607,7 +1607,7 @@ static zend_always_inline void _object_properties_init(zend_object *object, zend
16071607
if (class_type->default_properties_count) {
16081608
zval *src = CE_DEFAULT_PROPERTIES_TABLE(class_type);
16091609
zval *dst = object->properties_table;
1610-
1610+
#if 0
16111611
if (false && !(class_type->ce_flags & ZEND_ACC_HAS_RC_PROPS)) {//TODO: disabled; also actually this may replace the internal class thing?
16121612
// printf("fast path %s\n", class_type->name->val);
16131613
memcpy(dst, src, sizeof(zval) * class_type->default_properties_count);
@@ -1639,6 +1639,24 @@ static zend_always_inline void _object_properties_init(zend_object *object, zend
16391639
} while (src != end);
16401640
}
16411641
}
1642+
#endif
1643+
if (UNEXPECTED(class_type->ce_flags & ZEND_ACC_HAS_RC_PROPS)) {
1644+
// do {
1645+
// ZVAL_COPY_OR_DUP_PROP(dst, src);
1646+
// src++;
1647+
// dst++;
1648+
// } while (src != end);
1649+
// TODO: assertion?
1650+
/* zend_declare_typed_property() disallows refcounted default property values in internal classes */
1651+
memcpy(dst, src, sizeof(zval) * class_type->default_properties_count);
1652+
} else {
1653+
zval *end = src + class_type->default_properties_count;
1654+
do {
1655+
ZVAL_COPY_PROP(dst, src);
1656+
src++;
1657+
dst++;
1658+
} while (src != end);
1659+
}
16421660
}
16431661
}
16441662
/* }}} */

Zend/zend_operators.c

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2372,28 +2372,6 @@ static int hash_zval_identical_function(zval *z1, zval *z2) /* {{{ */
23722372
}
23732373
/* }}} */
23742374

2375-
ZEND_API bool ZEND_FASTCALL zend_is_identical2(const zval *op1, const zval *op2)
2376-
{
2377-
switch (Z_TYPE_P(op1)) {
2378-
case IS_LONG:
2379-
return (Z_LVAL_P(op1) == Z_LVAL_P(op2));
2380-
case IS_RESOURCE:
2381-
return (Z_RES_P(op1) == Z_RES_P(op2));
2382-
case IS_DOUBLE:
2383-
return (Z_DVAL_P(op1) == Z_DVAL_P(op2));
2384-
case IS_STRING:
2385-
return zend_string_equals(Z_STR_P(op1), Z_STR_P(op2));
2386-
case IS_ARRAY:
2387-
return (Z_ARRVAL_P(op1) == Z_ARRVAL_P(op2) ||
2388-
zend_hash_compare(Z_ARRVAL_P(op1), Z_ARRVAL_P(op2), (compare_func_t) hash_zval_identical_function, 1) == 0);
2389-
case IS_OBJECT:
2390-
return (Z_OBJ_P(op1) == Z_OBJ_P(op2));
2391-
default:
2392-
return 0;
2393-
}
2394-
}
2395-
2396-
// TODO: use zend_is_identical2 ?
23972375
ZEND_API bool ZEND_FASTCALL zend_is_identical(const zval *op1, const zval *op2) /* {{{ */
23982376
{
23992377
if (Z_TYPE_P(op1) != Z_TYPE_P(op2)) {

Zend/zend_operators.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ ZEND_API zend_result ZEND_FASTCALL shift_right_function(zval *result, zval *op1,
5656
ZEND_API zend_result ZEND_FASTCALL concat_function(zval *result, zval *op1, zval *op2);
5757

5858
ZEND_API bool ZEND_FASTCALL zend_is_identical(const zval *op1, const zval *op2);
59-
ZEND_API bool ZEND_FASTCALL zend_is_identical2(const zval *op1, const zval *op2);
6059

6160
ZEND_API zend_result ZEND_FASTCALL is_equal_function(zval *result, zval *op1, zval *op2);
6261
ZEND_API zend_result ZEND_FASTCALL is_identical_function(zval *result, zval *op1, zval *op2);
@@ -857,7 +856,7 @@ static zend_always_inline bool fast_is_identical_function(zval *op1, zval *op2)
857856
} else if (Z_TYPE_P(op1) <= IS_TRUE) {
858857
return 1;
859858
}
860-
return zend_is_identical2(op1, op2);
859+
return zend_is_identical(op1, op2);
861860
}
862861

863862
static zend_always_inline bool fast_is_not_identical_function(zval *op1, zval *op2)
@@ -867,7 +866,7 @@ static zend_always_inline bool fast_is_not_identical_function(zval *op1, zval *o
867866
} else if (Z_TYPE_P(op1) <= IS_TRUE) {
868867
return 0;
869868
}
870-
return !zend_is_identical2(op1, op2);
869+
return !zend_is_identical(op1, op2);
871870
}
872871

873872
/* buf points to the END of the buffer */

0 commit comments

Comments
 (0)