Skip to content

Commit c796ce5

Browse files
committed
Re-add GC_DTOR and GC_DTOR_NO_REF
1 parent d5484bf commit c796ce5

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Zend/zend_types.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,26 @@ static zend_always_inline uint8_t zval_get_type(const zval* pz) {
638638
#define GC_TRY_ADDREF(p) zend_gc_try_addref(&(p)->gc)
639639
#define GC_TRY_DELREF(p) zend_gc_try_delref(&(p)->gc)
640640

641+
#define GC_DTOR(p) \
642+
do { \
643+
zend_refcounted_h *_p = &(p)->gc; \
644+
if (zend_gc_delref(_p) == 0) { \
645+
rc_dtor_func((zend_refcounted *)_p); \
646+
} else { \
647+
gc_check_possible_root((zend_refcounted *)_p); \
648+
} \
649+
} while (0)
650+
651+
#define GC_DTOR_NO_REF(p) \
652+
do { \
653+
zend_refcounted_h *_p = &(p)->gc; \
654+
if (zend_gc_delref(_p) == 0) { \
655+
rc_dtor_func((zend_refcounted *)_p); \
656+
} else { \
657+
gc_check_possible_root_no_ref((zend_refcounted *)_p); \
658+
} \
659+
} while (0)
660+
641661
#define GC_TYPE_MASK 0x0000000f
642662
#define GC_FLAGS_MASK 0x000003f0
643663
#define GC_INFO_MASK 0xfffffc00

0 commit comments

Comments
 (0)