Zero overhead tracing garbage collection for rust, by abusing the borrow checker.
- Easy to use, since
Copyand coerces to a reference.
- Absolutely zero overhead when modifying pointers, since
- Implementation agnostic API
- Unsafe code has complete freedom to manipulate garbage collected pointers, and it doesn't need to understand the distinction
- Uses rust's lifetime system to ensure all roots are known at explicit safepoints, without any runtime overhead.
- Collection can only happen with an explicit
safepointcall and has no overhead between these calls,
- API supports moving objects (allowing copying/generational GCs)
Implements a GcCell to allow mutating values inside garbage collected objects.
The prelude for
Indicate its safe to begin a garbage collection (like safepoint!) and then "freeze" the specified context.
Indicate it's safe to begin a garbage collection, while keeping the specified root alive.
Invoke the closure with a temporary GcContext, then perform a safepoint afterwards.
Unfreeze the context, allowing it to be used again
Unsafely assume that the generic implementation of [GcBrand] is valid, if and only if it's valid for the generic lifetime and type parameters.
A wrapper type that assumes its contents don't need to be traced
A garbage collected pointer to a value.
Uniquely identifies the collector in case there are multiple collectors.
Changes all references to garbage
collected objects to match
The context of garbage collection, which can be frozen at a safepoint.
Safely trigger a write barrier before writing to a garbage collected value.
A owned handle which points to a garbage collected object.
A system which supports creating handles to Gc references.
Indicates that a type can be safely allocated by a garbage collector.
A simple interface to allocating from a GcContext.
A garbage collector implementation.
Visits garbage collected objects
Marker types for types that don't need to be traced
Indicates that a type can be traced by a garbage collector.
A type that can be safely traced/relocated without having to use a mutable reference