Set compaction after major GC has been determined
do_full_mark can change in gc_start, so we want to set auto-compaction only after do_full_mark has been properly set.
This commit is contained in:
parent
ca4755b59a
commit
7835ebce97
16
gc.c
16
gc.c
@ -9409,14 +9409,6 @@ gc_start(rb_objspace_t *objspace, unsigned int reason)
|
||||
/* reason may be clobbered, later, so keep set immediate_sweep here */
|
||||
objspace->flags.immediate_sweep = !!(reason & GPR_FLAG_IMMEDIATE_SWEEP);
|
||||
|
||||
/* 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 (!heap_allocated_pages) return FALSE; /* heap is not ready */
|
||||
if (!(reason & GPR_FLAG_METHOD) && !ready_to_gc(objspace)) return TRUE; /* GC is not allowed */
|
||||
|
||||
@ -9464,6 +9456,14 @@ gc_start(rb_objspace_t *objspace, unsigned int reason)
|
||||
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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user