1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-11 22:31:12 +02:00

Factor out tracer interface to own file

This commit is contained in:
Andy Wingo 2024-07-08 14:38:15 +02:00
parent 82afee8693
commit b4543ad641
3 changed files with 70 additions and 35 deletions

View file

@ -12,6 +12,7 @@
#include "local-worklist.h"
#include "shared-worklist.h"
#include "spin.h"
#include "tracer.h"
enum trace_worker_state {
TRACE_WORKER_STOPPED,
@ -49,9 +50,6 @@ struct local_tracer {
struct local_worklist local;
};
struct context;
static inline struct tracer* heap_tracer(struct gc_heap *heap);
static int
trace_worker_init(struct trace_worker *worker, struct gc_heap *heap,
struct tracer *tracer, size_t id) {
@ -147,15 +145,6 @@ tracer_maybe_unpark_workers(struct tracer *tracer) {
tracer_unpark_all_workers(tracer);
}
static inline void tracer_visit(struct gc_edge edge, struct gc_heap *heap,
void *trace_data) GC_ALWAYS_INLINE;
static inline void tracer_enqueue(struct gc_ref ref, struct gc_heap *heap,
void *trace_data) GC_ALWAYS_INLINE;
static inline void trace_one(struct gc_ref ref, struct gc_heap *heap,
void *trace_data) GC_ALWAYS_INLINE;
static inline int trace_edge(struct gc_heap *heap,
struct gc_edge edge) GC_ALWAYS_INLINE;
static inline void
tracer_share(struct local_tracer *trace) {
DEBUG("tracer #%zu: sharing\n", trace->worker->id);
@ -177,12 +166,6 @@ tracer_enqueue(struct gc_ref ref, struct gc_heap *heap, void *trace_data) {
local_worklist_push(&trace->local, ref);
}
static inline void
tracer_visit(struct gc_edge edge, struct gc_heap *heap, void *trace_data) {
if (trace_edge(heap, edge))
tracer_enqueue(gc_edge_ref(edge), heap, trace_data);
}
static struct gc_ref
tracer_steal_from_worker(struct tracer *tracer, size_t id) {
ASSERT(id < tracer->worker_count);