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

MMC marks roots in parallel during the pause, not while stopping

Following the analysis in
https://wingolog.org/archives/2024/09/06/on-taking-advantage-of-ragged-stops,
we simplify MMC by traversing roots only during the pause.  This lets us
use gc_tracer parallel root-tracing.
This commit is contained in:
Andy Wingo 2024-09-09 15:02:12 +02:00
parent 8604ad6beb
commit 9f437485ec
6 changed files with 312 additions and 492 deletions

View file

@ -2,6 +2,7 @@
#define ROOT_H
#include "gc-edge.h"
#include "extents.h"
struct gc_ephemeron;
struct gc_heap;
@ -11,8 +12,12 @@ enum gc_root_kind {
GC_ROOT_KIND_NONE,
GC_ROOT_KIND_HEAP,
GC_ROOT_KIND_MUTATOR,
GC_ROOT_KIND_CONSERVATIVE_EDGES,
GC_ROOT_KIND_CONSERVATIVE_POSSIBLY_INTERIOR_EDGES,
GC_ROOT_KIND_RESOLVED_EPHEMERONS,
GC_ROOT_KIND_EDGE,
GC_ROOT_KIND_REMEMBERED_OBJECT,
GC_ROOT_KIND_REMEMBERED_SLAB,
};
struct gc_root {
@ -21,22 +26,38 @@ struct gc_root {
struct gc_heap *heap;
struct gc_mutator *mutator;
struct gc_ephemeron *resolved_ephemerons;
struct extent_range range;
struct gc_edge edge;
struct gc_ref ref;
size_t idx;
};
};
static inline struct gc_root gc_root_heap(struct gc_heap* heap) {
static inline struct gc_root
gc_root_heap(struct gc_heap* heap) {
struct gc_root ret = { GC_ROOT_KIND_HEAP };
ret.heap = heap;
return ret;
}
static inline struct gc_root gc_root_mutator(struct gc_mutator* mutator) {
static inline struct gc_root
gc_root_mutator(struct gc_mutator* mutator) {
struct gc_root ret = { GC_ROOT_KIND_MUTATOR };
ret.mutator = mutator;
return ret;
}
static inline struct gc_root
gc_root_conservative_edges(uintptr_t lo_addr, uintptr_t hi_addr,
int possibly_interior) {
enum gc_root_kind kind = possibly_interior
? GC_ROOT_KIND_CONSERVATIVE_POSSIBLY_INTERIOR_EDGES
: GC_ROOT_KIND_CONSERVATIVE_EDGES;
struct gc_root ret = { kind };
ret.range = (struct extent_range) {lo_addr, hi_addr};
return ret;
}
static inline struct gc_root
gc_root_resolved_ephemerons(struct gc_ephemeron* resolved) {
struct gc_root ret = { GC_ROOT_KIND_RESOLVED_EPHEMERONS };
@ -51,4 +72,18 @@ gc_root_edge(struct gc_edge edge) {
return ret;
}
static inline struct gc_root
gc_root_remembered_object(struct gc_ref ref) {
struct gc_root ret = { GC_ROOT_KIND_REMEMBERED_OBJECT };
ret.ref = ref;
return ret;
}
static inline struct gc_root
gc_root_remembered_slab(size_t idx) {
struct gc_root ret = { GC_ROOT_KIND_REMEMBERED_SLAB };
ret.idx = idx;
return ret;
}
#endif // ROOT_H