1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-14 01:30:19 +02:00

Move back to marking objects instead of edges

This commit is contained in:
Andy Wingo 2022-03-10 11:12:45 +01:00
parent 45405efe56
commit cfa7ea31ae

View file

@ -32,7 +32,7 @@ mark_queue_alloc(size_t size) {
static int static int
mark_queue_init(struct mark_queue *q) { mark_queue_init(struct mark_queue *q) {
q->size = getpagesize(); q->size = getpagesize() / sizeof(uintptr_t);
q->read = 0; q->read = 0;
q->write = 0; q->write = 0;
q->buf = mark_queue_alloc(q->size); q->buf = mark_queue_alloc(q->size);
@ -49,6 +49,8 @@ mark_queue_put(struct mark_queue *q, size_t idx, uintptr_t x) {
q->buf[idx & (q->size - 1)] = x; q->buf[idx & (q->size - 1)] = x;
} }
static int mark_queue_grow(struct mark_queue *q) __attribute__((noinline));
static int static int
mark_queue_grow(struct mark_queue *q) { mark_queue_grow(struct mark_queue *q) {
uintptr_t old_size = q->size; uintptr_t old_size = q->size;
@ -134,11 +136,9 @@ static inline int mark_object(struct gcobj *obj) __attribute__((always_inline));
static inline void static inline void
marker_visit(struct context *cx, void **loc) { marker_visit(struct context *cx, void **loc) {
struct gcobj *obj = *loc; struct gcobj *obj = *loc;
if (obj) { if (obj && mark_object(obj))
__builtin_prefetch(obj);
mark_queue_push(&context_marker(cx)->queue, obj); mark_queue_push(&context_marker(cx)->queue, obj);
} }
}
static inline void static inline void
marker_visit_root(struct context *cx, void **loc) { marker_visit_root(struct context *cx, void **loc) {
marker_visit(cx, loc); marker_visit(cx, loc);
@ -148,7 +148,6 @@ marker_trace(struct context *cx,
void (*process)(struct context *, struct gcobj *)) { void (*process)(struct context *, struct gcobj *)) {
struct gcobj *obj; struct gcobj *obj;
while ((obj = mark_queue_pop(&context_marker(cx)->queue))) while ((obj = mark_queue_pop(&context_marker(cx)->queue)))
if (mark_object(obj))
process(cx, obj); process(cx, obj);
} }