Skip to content

Commit

Permalink
Merge commit '7835ebce97a6e6132d2bc7bdbef115f3f47cc6c2' into Ractor-L…
Browse files Browse the repository at this point in the history
…ocal-GC-version-2
  • Loading branch information
rm155 committed Nov 28, 2023
2 parents 5cc74a1 + 7835ebc commit 189b042
Showing 1 changed file with 23 additions and 8 deletions.
31 changes: 23 additions & 8 deletions gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -11210,19 +11210,26 @@ gc_set_flags_start(rb_objspace_t *objspace, unsigned int reason, unsigned int *d
objspace->flags.immediate_sweep = !!(reason & GPR_FLAG_IMMEDIATE_SWEEP);

objspace->flags.during_global_gc = !!(reason & GPR_FLAG_GLOBAL);

/* Explicitly enable compaction (GC.compact) */
if (*do_full_mark && ruby_enable_autocompact) {
objspace->flags.during_compacting = TRUE;
}
else {
objspace->flags.during_compacting = !!(reason & GPR_FLAG_COMPACT);
}
}

static void
gc_set_flags_finish(rb_objspace_t *objspace, unsigned int reason, unsigned int *do_full_mark, unsigned int *immediate_mark)
{
if (!heap_allocated_pages) return FALSE; /* heap is not ready */
if (!(reason & GPR_FLAG_METHOD) && !ready_to_gc(objspace)) return TRUE; /* GC is not allowed */

GC_ASSERT(gc_mode(objspace) == gc_mode_none);
GC_ASSERT(!is_lazy_sweeping(objspace));
GC_ASSERT(!is_incremental_marking(objspace));

unsigned int lock_lev;
gc_enter(objspace, gc_enter_event_start, &lock_lev);

#if RGENGC_CHECK_MODE >= 2
gc_verify_internal_consistency(objspace);
#endif

>>>>>>> 7835ebce97a6e6132d2bc7bdbef115f3f47cc6c2
if (ruby_gc_stressful) {
int flag = FIXNUM_P(ruby_gc_stress_mode) ? FIX2INT(ruby_gc_stress_mode) : 0;

Expand Down Expand Up @@ -11256,6 +11263,14 @@ gc_set_flags_finish(rb_objspace_t *objspace, unsigned int reason, unsigned int *
objspace->flags.during_incremental_marking = *do_full_mark;
}

/* Explicitly enable compaction (GC.compact) */
if (do_full_mark && ruby_enable_autocompact) {
objspace->flags.during_compacting = TRUE;
}
else {
objspace->flags.during_compacting = !!(reason & GPR_FLAG_COMPACT);
}

if (!GC_ENABLE_LAZY_SWEEP || objspace->flags.dont_incremental) {
objspace->flags.immediate_sweep = TRUE;
}
Expand Down

0 comments on commit 189b042

Please sign in to comment.