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

whippet: ensure mutators release allocators before start_gc

This commit is contained in:
Andy Wingo 2024-08-24 09:09:23 +02:00
parent 19fdd481d5
commit 7db72e7f80
2 changed files with 7 additions and 6 deletions

View file

@ -247,6 +247,7 @@ add_mutator(struct gc_heap *heap, struct gc_mutator *mut) {
static void
remove_mutator(struct gc_heap *heap, struct gc_mutator *mut) {
nofl_allocator_finish(&mut->allocator, heap_nofl_space(heap));
MUTATOR_EVENT(mut, mutator_removed);
mut->heap = NULL;
heap_lock(heap);
@ -621,7 +622,8 @@ wait_for_mutators_to_stop(struct gc_heap *heap) {
pthread_cond_wait(&heap->collector_cond, &heap->lock);
}
static void trace_mutator_conservative_roots_after_stop(struct gc_heap *heap) {
static void
trace_mutator_conservative_roots_after_stop(struct gc_heap *heap) {
int active_mutators_already_marked = heap_should_mark_while_stopping(heap);
if (!active_mutators_already_marked)
for (struct gc_mutator *mut = atomic_load(&heap->mutator_trace_list);
@ -654,10 +656,8 @@ trace_mutator_roots_after_stop(struct gc_heap *heap) {
}
atomic_store(&heap->mutator_trace_list, NULL);
for (struct gc_mutator *mut = heap->inactive_mutators; mut; mut = mut->next) {
nofl_allocator_finish(&mut->allocator, heap_nofl_space(heap));
for (struct gc_mutator *mut = heap->inactive_mutators; mut; mut = mut->next)
trace_mutator_roots_with_lock(mut);
}
}
static void
@ -1323,6 +1323,7 @@ void gc_finish_for_thread(struct gc_mutator *mut) {
static void deactivate_mutator(struct gc_heap *heap, struct gc_mutator *mut) {
GC_ASSERT(mut->next == NULL);
nofl_allocator_finish(&mut->allocator, heap_nofl_space(heap));
heap_lock(heap);
mut->next = heap->inactive_mutators;
heap->inactive_mutators = mut;