1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-08 21:20:19 +02:00

Update for Whippet changes, VM stacks scanned partly-conservatively

* libguile/trace.h (scm_from_ref, scm_to_ref): Helpers moved here;
update all callers.
* libguile/loader.c (scm_trace_loader_roots):
* libguile/threads.c (scm_trace_thread_roots):
* libguile/vm.c (scm_trace_vm_roots): Update for new
pinned-roots prototype.
* libguile/whippet-embedder.h (gc_extern_space_visit): Update for
Whippet API changes.
This commit is contained in:
Andy Wingo 2025-05-21 14:31:23 +02:00
parent fb5a99c752
commit 7b4f4427f8
8 changed files with 143 additions and 131 deletions

View file

@ -63,7 +63,6 @@ gc_is_valid_conservative_ref_displacement (uintptr_t displacement) {
// FIXME: Here add tracing for SCM literals in .go files or .data
// sections, perhaps. For now while we are using BDW-GC we can punt.
static inline int gc_extern_space_visit (struct gc_extern_space *space,
struct gc_edge edge,
struct gc_ref ref) {
#if GC_CONSERVATIVE_TRACE
return 0;
@ -78,6 +77,14 @@ static inline void gc_extern_space_finish_gc (struct gc_extern_space *space,
int is_minor_gc) {
}
static inline SCM scm_from_gc_ref (struct gc_ref ref) {
return SCM_PACK (gc_ref_value (ref));
}
static inline struct gc_ref scm_to_gc_ref (SCM scm) {
return gc_ref (SCM_UNPACK (scm));
}
static inline void gc_trace_object (struct gc_ref ref,
void (*trace_edge) (struct gc_edge edge,
struct gc_heap *heap,
@ -101,8 +108,6 @@ static inline void gc_trace_mutator_roots (struct gc_mutator_roots *roots,
void *trace_data),
struct gc_heap *heap,
void *trace_data) {
trace_edge (gc_edge (&roots->thread), heap, trace_data);
scm_trace_thread_mutator_roots (roots->thread, trace_edge, heap, trace_data);
}
static inline void gc_trace_heap_roots (struct gc_heap_roots *roots,
@ -114,36 +119,34 @@ static inline void gc_trace_heap_roots (struct gc_heap_roots *roots,
}
static inline void
gc_trace_mutator_conservative_roots (struct gc_mutator_roots *roots,
void (*trace_range) (uintptr_t lo,
uintptr_t hi,
int possibly_interior,
struct gc_heap *heap,
void *trace_data),
struct gc_heap *heap,
void *trace_data) {
/* FIXME: thread stack? Currently traced via the precise
gc_trace_mutator_roots. */
gc_trace_mutator_pinned_roots (struct gc_mutator_roots *roots,
void (*trace_pinned) (struct gc_ref ref,
struct gc_heap *heap,
void *trace_data),
void (*trace_ambiguous) (uintptr_t lo,
uintptr_t hi,
int possibly_interior,
struct gc_heap *heap,
void *trace_data),
struct gc_heap *heap,
void *trace_data) {
scm_trace_thread_roots (roots->thread, trace_pinned, trace_ambiguous,
heap, trace_data);
}
static inline void
gc_trace_heap_conservative_roots (struct gc_heap_roots *roots,
void (*trace_range) (uintptr_t lo,
uintptr_t hi,
int possibly_interior,
struct gc_heap *heap,
void *trace_data),
struct gc_heap *heap,
void *trace_data) {
scm_trace_loader_conservative_roots(trace_range, heap, trace_data);
}
static inline SCM scm_from_gc_ref (struct gc_ref ref) {
return SCM_PACK (gc_ref_value (ref));
}
static inline struct gc_ref scm_to_gc_ref (SCM scm) {
return gc_ref (SCM_UNPACK (scm));
gc_trace_heap_pinned_roots (struct gc_heap_roots *roots,
void (*trace_pinned) (struct gc_ref ref,
struct gc_heap *heap,
void *trace_data),
void (*trace_ambiguous) (uintptr_t lo,
uintptr_t hi,
int possibly_interior,
struct gc_heap *heap,
void *trace_data),
struct gc_heap *heap,
void *trace_data) {
scm_trace_loader_roots (trace_ambiguous, heap, trace_data);
}
static inline scm_t_bits* scm_cell_type_loc (SCM scm) {