1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-27 21:40:34 +02:00

Get handles out of collectors

This commit is contained in:
Andy Wingo 2022-08-16 11:53:32 +02:00
parent 607585e7f0
commit 9e8940e59f
10 changed files with 149 additions and 57 deletions

View file

@ -23,6 +23,31 @@ static inline void gc_trace_object(void *object,
}
}
struct handle;
struct gc_heap_roots { struct handle *roots; };
struct gc_mutator_roots { struct handle *roots; };
static inline void visit_roots(struct handle *roots,
void (*trace_edge)(struct gc_edge edge,
void *trace_data),
void *trace_data);
static inline void gc_trace_mutator_roots(struct gc_mutator_roots *roots,
void (*trace_edge)(struct gc_edge edge,
void *trace_data),
void *trace_data) {
if (roots)
visit_roots(roots->roots, trace_edge, trace_data);
}
static inline void gc_trace_heap_roots(struct gc_heap_roots *roots,
void (*trace_edge)(struct gc_edge edge,
void *trace_data),
void *trace_data) {
if (roots)
visit_roots(roots->roots, trace_edge, trace_data);
}
static inline uintptr_t gc_object_forwarded_nonatomic(void *object) {
uintptr_t tag = *tag_word(object);
return (tag & gcobj_not_forwarded_bit) ? 0 : tag;