diff --git a/Zend/zend_types.h b/Zend/zend_types.h index eeb53d5feef..0372a523f6d 100644 --- a/Zend/zend_types.h +++ b/Zend/zend_types.h @@ -638,6 +638,26 @@ static zend_always_inline uint8_t zval_get_type(const zval* pz) { #define GC_TRY_ADDREF(p) zend_gc_try_addref(&(p)->gc) #define GC_TRY_DELREF(p) zend_gc_try_delref(&(p)->gc) +#define GC_DTOR(p) \ + do { \ + zend_refcounted_h *_p = &(p)->gc; \ + if (zend_gc_delref(_p) == 0) { \ + rc_dtor_func((zend_refcounted *)_p); \ + } else { \ + gc_check_possible_root((zend_refcounted *)_p); \ + } \ + } while (0) + +#define GC_DTOR_NO_REF(p) \ + do { \ + zend_refcounted_h *_p = &(p)->gc; \ + if (zend_gc_delref(_p) == 0) { \ + rc_dtor_func((zend_refcounted *)_p); \ + } else { \ + gc_check_possible_root_no_ref((zend_refcounted *)_p); \ + } \ + } while (0) + #define GC_TYPE_MASK 0x0000000f #define GC_FLAGS_MASK 0x000003f0 #define GC_INFO_MASK 0xfffffc00