Expand description
Refcount fast paths — Rust mirrors of lean.h:536–563.
The header encodes the runtime mode in the RC sign:
m_rc > 0— single-threaded: bump or decrement in place.m_rc < 0— multi-threaded: RC is negated;fetch_subis the relaxed atomic decrement, mirroringatomic_fetch_sub_explicit(.., relaxed)inlean.h.m_rc == 0— persistent (compact regions); never refcounted.
Each mirror reaches m_rc through AtomicI32::from_ptr so the actual
load / store / fetch_sub call site sees a safe &AtomicI32.
Functions§
- lean_
dec ⚠ - Decrement
o’s refcount, or no-op for scalar-tagged pointers (lean.h:563). - lean_
dec_ ⚠ref - Decrement
o’s refcount, taking the cold path to free if it reaches zero (lean.h:554–560). - lean_
dec_ ⚠ref_ cold - Cold path for refcount-zero decrement (
lean.h:552). Invoked bylean_dec_refwhen the live count would cross to zero and the object actually needs freeing. - lean_
inc ⚠ - Bump
o’s refcount by one, or no-op for scalar-tagged pointers (lean.h:561). - lean_
inc_ ⚠n - Bump
o’s refcount byn, or no-op for scalar-tagged pointers (lean.h:562). - lean_
inc_ ⚠ref - Bump
o’s refcount by one (lean.h:548–550). - lean_
inc_ ⚠ref_ n - Bump
o’s reference count byn(lean.h:536–546,lean_inc_ref_n). - lean_
mark_ ⚠mt - Mark a heap object — and everything reachable from it — as
multi-threaded (
lean.h:612). - lean_
mark_ ⚠persistent - Mark a heap object as persistent so its refcount is no longer
updated (
lean.h:613).