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

@ -74,6 +74,10 @@
#if 0
/* FIXME: For the moment, the bodies of thread objects are traced
conservatively; only bdw, heap-conservative-mmc, and
heap-conservative-parallel-mmc are supported. */
static void
scm_trace_dynstack (scm_t_dynstack *dynstack,
void (*trace_edge) (struct gc_edge edge,
@ -110,6 +114,7 @@ scm_trace_thread (struct scm_thread *thread,
trace_edge (gc_edge (&thread->join_lock), heap, trace_data);
trace_edge (gc_edge (&thread->join_results), heap, trace_data);
}
#endif
/* Guile-level thread objects are themselves GC-allocated. A thread
object has two states: active and finished. A thread is active if it
@ -125,16 +130,20 @@ scm_trace_thread (struct scm_thread *thread,
precise, threads need to be traced during root identification.
*/
void
scm_trace_thread_mutator_roots (struct scm_thread *thread,
void (*trace_edge) (struct gc_edge edge,
struct gc_heap *heap,
void *trace_data),
struct gc_heap *heap, void *trace_data)
scm_trace_thread_roots (struct scm_thread *thread,
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_vm (&thread->vm, trace_edge, heap, trace_data);
/* FIXME: Call instead via gc_trace_object. */
scm_trace_thread (thread, trace_edge, heap, trace_data);
trace_pinned (gc_ref_from_heap_object (thread), heap, trace_data);
scm_trace_vm_roots (&thread->vm, trace_pinned, trace_ambiguous, heap,
trace_data);
}