@@ -555,9 +555,11 @@ static zend_always_inline uint32_t zval_gc_info(uint32_t gc_type_info) {
555
555
556
556
/* zval.u1.v.type_flags */
557
557
#define IS_TYPE_REFCOUNTED (1<<0)
558
+ #define IS_TYPE_COLLECTABLE (1<<1)
558
559
559
560
#if 1
560
561
/* This optimized version assumes that we have a single "type_flag" */
562
+ /* IS_TYPE_COLLECTABLE may be used only with IS_TYPE_REFCOUNTED */
561
563
# define Z_TYPE_INFO_REFCOUNTED (t ) (((t) & Z_TYPE_FLAGS_MASK) != 0)
562
564
#else
563
565
# define Z_TYPE_INFO_REFCOUNTED (t ) (((t) & (IS_TYPE_REFCOUNTED << Z_TYPE_FLAGS_SHIFT)) != 0)
@@ -567,8 +569,8 @@ static zend_always_inline uint32_t zval_gc_info(uint32_t gc_type_info) {
567
569
#define IS_INTERNED_STRING_EX IS_STRING
568
570
569
571
#define IS_STRING_EX (IS_STRING | (IS_TYPE_REFCOUNTED << Z_TYPE_FLAGS_SHIFT))
570
- #define IS_ARRAY_EX (IS_ARRAY | (IS_TYPE_REFCOUNTED << Z_TYPE_FLAGS_SHIFT))
571
- #define IS_OBJECT_EX (IS_OBJECT | (IS_TYPE_REFCOUNTED << Z_TYPE_FLAGS_SHIFT))
572
+ #define IS_ARRAY_EX (IS_ARRAY | (IS_TYPE_REFCOUNTED << Z_TYPE_FLAGS_SHIFT) | (IS_TYPE_COLLECTABLE << Z_TYPE_FLAGS_SHIFT) )
573
+ #define IS_OBJECT_EX (IS_OBJECT | (IS_TYPE_REFCOUNTED << Z_TYPE_FLAGS_SHIFT) | (IS_TYPE_COLLECTABLE << Z_TYPE_FLAGS_SHIFT) )
572
574
#define IS_RESOURCE_EX (IS_RESOURCE | (IS_TYPE_REFCOUNTED << Z_TYPE_FLAGS_SHIFT))
573
575
#define IS_REFERENCE_EX (IS_REFERENCE | (IS_TYPE_REFCOUNTED << Z_TYPE_FLAGS_SHIFT))
574
576
@@ -624,12 +626,16 @@ static zend_always_inline uint32_t zval_gc_info(uint32_t gc_type_info) {
624
626
625
627
#if 1
626
628
/* This optimized version assumes that we have a single "type_flag" */
629
+ /* IS_TYPE_COLLECTABLE may be used only with IS_TYPE_REFCOUNTED */
627
630
#define Z_REFCOUNTED (zval ) (Z_TYPE_FLAGS(zval) != 0)
628
631
#else
629
632
#define Z_REFCOUNTED (zval ) ((Z_TYPE_FLAGS(zval) & IS_TYPE_REFCOUNTED) != 0)
630
633
#endif
631
634
#define Z_REFCOUNTED_P (zval_p ) Z_REFCOUNTED(*(zval_p))
632
635
636
+ #define Z_COLLECTABLE (zval ) ((Z_TYPE_FLAGS(zval) & IS_TYPE_COLLECTABLE) != 0)
637
+ #define Z_COLLECTABLE_P (zval_p ) Z_COLLECTABLE(*(zval_p))
638
+
633
639
/* deprecated: (COPYABLE is the same as IS_ARRAY) */
634
640
#define Z_COPYABLE (zval ) (Z_TYPE(zval) == IS_ARRAY)
635
641
#define Z_COPYABLE_P (zval_p ) Z_COPYABLE(*(zval_p))
0 commit comments