Skip to content

Commit 9256a47

Browse files
committed
Test overhead of tracking the flag
1 parent b8e9d79 commit 9256a47

File tree

1 file changed

+15
-31
lines changed

1 file changed

+15
-31
lines changed

Zend/zend_API.c

Lines changed: 15 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1607,39 +1607,22 @@ 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-
#if 0
1611-
if (false && !(class_type->ce_flags & ZEND_ACC_HAS_RC_PROPS)) {//TODO: disabled; also actually this may replace the internal class thing?
1612-
// printf("fast path %s\n", class_type->name->val);
1613-
memcpy(dst, src, sizeof(zval) * class_type->default_properties_count);
1614-
// zval *end = src + class_type->default_properties_count;
1615-
// do {
1616-
// ZVAL_COPY_VALUE_PROP(dst, src);
1617-
// src++;
1618-
// dst++;
1619-
// } while (src != end);
1610+
#if 1
1611+
zval *end = src + class_type->default_properties_count;
1612+
if (UNEXPECTED(class_type->type == ZEND_INTERNAL_CLASS)) {
1613+
do {
1614+
ZVAL_COPY_OR_DUP_PROP(dst, src);
1615+
src++;
1616+
dst++;
1617+
} while (src != end);
16201618
} else {
1621-
// printf("slow path %s\n", class_type->name->val);
1622-
// zval *end = src + class_type->default_properties_count;
1623-
1624-
if (UNEXPECTED(class_type->type == ZEND_INTERNAL_CLASS)) {
1625-
// do {
1626-
// ZVAL_COPY_OR_DUP_PROP(dst, src);
1627-
// src++;
1628-
// dst++;
1629-
// } while (src != end);
1630-
// TODO: assertion?
1631-
/* zend_declare_typed_property() disallows refcounted default property values in internal classes */
1632-
memcpy(dst, src, sizeof(zval) * class_type->default_properties_count);
1633-
} else {
1634-
zval *end = src + class_type->default_properties_count;
1635-
do {
1636-
ZVAL_COPY_PROP(dst, src);
1637-
src++;
1638-
dst++;
1639-
} while (src != end);
1640-
}
1619+
do {
1620+
ZVAL_COPY_PROP(dst, src);
1621+
src++;
1622+
dst++;
1623+
} while (src != end);
16411624
}
1642-
#endif
1625+
#else
16431626
if (EXPECTED(class_type->ce_flags & ZEND_ACC_HAS_RC_PROPS)) {
16441627
zval *end = src + class_type->default_properties_count;
16451628
do {
@@ -1652,6 +1635,7 @@ static zend_always_inline void _object_properties_init(zend_object *object, zend
16521635
/* zend_declare_typed_property() disallows refcounted default property values in internal classes */
16531636
memcpy(dst, src, sizeof(zval) * class_type->default_properties_count);
16541637
}
1638+
#endif
16551639
}
16561640
}
16571641
/* }}} */

0 commit comments

Comments
 (0)