Skip to content

Commit 3845778

Browse files
committed
More debug fixes
1 parent 316ece5 commit 3845778

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

gc/default/default.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4618,7 +4618,9 @@ move_to_empty_pages(rb_objspace_t *objspace, rb_heap_t *heap, struct heap_page *
46184618
GC_ASSERT(bitmap_is_all_zero(page->wb_unprotected_bits, HEAP_PAGE_BITMAP_LIMIT));
46194619
GC_ASSERT(bitmap_is_all_zero(page->marking_bits, HEAP_PAGE_BITMAP_LIMIT));
46204620
GC_ASSERT(bitmap_is_all_zero(page->remembered_bits, HEAP_PAGE_BITMAP_LIMIT));
4621+
GC_ASSERT(bitmap_is_all_zero(page->deferred_free_bits, HEAP_PAGE_BITMAP_LIMIT));
46214622
GC_ASSERT(bitmap_is_all_zero(page->age_bits, HEAP_PAGE_BITMAP_LIMIT * RVALUE_AGE_BIT_COUNT));
4623+
// NOTE: pinned bits can still be set, but it's okay because they are cleared when compaction starts
46224624

46234625
heap_unlink_page(objspace, heap, page);
46244626

@@ -5014,7 +5016,7 @@ gc_sweep_finish(rb_objspace_t *objspace)
50145016
#if RUBY_DEBUG
50155017
// When calling GC.start, if in the middle of a non-full mark it will be set as full mark in gc_rest() so the numbers
50165018
// will be off.
5017-
if (!objspace->flags.was_compacting && !objspace->sweep_rest) {
5019+
if (!objspace->flags.was_compacting && !objspace->sweep_rest && gc_config_full_mark_val) {
50185020
if (objspace->will_be_swept_slots != objspace->have_swept_slots) {
50195021
fprintf(stderr, "Expecting to free %lu slots, freed %lu slots (major:%d)\n", objspace->will_be_swept_slots, objspace->have_swept_slots, is_full_marking(objspace));
50205022
for (int i = 0; i < HEAP_COUNT; i++) {
@@ -5076,13 +5078,12 @@ gc_sweep_finish(rb_objspace_t *objspace)
50765078
#endif
50775079
}
50785080

5079-
// Dequeue a page swept by the background thread. If `free_in_user_thread` is true, then
5081+
// Dequeue a page swept by the sweep thread. If `free_in_user_thread` is true, then
50805082
// dequeue an unswept page to be swept by the Ruby thread. It can also dequeue an unswept
5081-
// page if otherwise it would have to wait for the background thread. In that case, `dequeued_unswept_page`
5083+
// page if otherwise it would have to wait for the sweep thread. In that case, `dequeued_unswept_page`
50825084
// is set to true.
50835085
//
5084-
// It returns NULL when there are no more pages to sweep for the heap, and also when the incremental
5085-
// step is finished for the heap (1 incremental step = `gc_continue()`).
5086+
// It returns NULL when there are no more pages to sweep for the heap.
50865087
static struct heap_page *
50875088
gc_sweep_dequeue_page(rb_objspace_t *objspace, rb_heap_t *heap, bool free_in_user_thread, bool *dequeued_unswept_page)
50885089
{
@@ -5423,11 +5424,11 @@ gc_sweep_rest(rb_objspace_t *objspace)
54235424
sweep_rest_count++;
54245425
sweep_lock_lock(&objspace->sweep_lock);
54255426
{
5427+
objspace->sweep_rest = true; // reset to false in `gc_sweeping_exit`
54265428
if (background_sweep_done_p(objspace)) {
54275429
psweep_debug(-2, "[gc] gc_sweep_rest: bg done, not requesting\n");
54285430
}
54295431
else {
5430-
objspace->sweep_rest = true; // reset to false in `gc_sweeping_exit`
54315432
if (objspace->use_background_sweep_thread && !objspace->sweep_thread_sweeping && !objspace->sweep_thread_sweep_requested) {
54325433
psweep_debug(-2, "[gc] gc_sweep_rest: request sweep thread\n");
54335434
objspace->sweep_thread_sweep_requested = true;

0 commit comments

Comments
 (0)