Skip to content

Commit 530d80c

Browse files
committed
Fix
1 parent 836cac5 commit 530d80c

File tree

4 files changed

+18
-12
lines changed

4 files changed

+18
-12
lines changed

Cargo.toml

+5
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,11 @@ object_pinning = []
152152
# Disable any object copying in Immix. This makes Immix a non-moving policy.
153153
immix_non_moving = []
154154

155+
# Disable any object copying in nursery GC for Sticky Immix while allowing other kinds of copying.
156+
# `immix_non_moving` disables all kinds of copying in Immix, so this feature is not needed
157+
# if `immix_non_moving` is in use.
158+
sticky_immix_non_moving_nursery = []
159+
155160
# Turn on stress copying for Immix. This is a debug feature to test copying for Immix plans.
156161
immix_stress_copying = []
157162
# Reduce block size for ImmixSpace. This mitigates fragmentation when defrag is disabled.

src/plan/sticky/immix/global.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ impl<VM: VMBinding> crate::plan::generational::global::GenerationalPlanExt<VM> f
262262
self.immix
263263
.immix_space
264264
.trace_object_without_moving(queue, object)
265-
} else if self.immix.immix_space.is_nursery_copy_enabled() {
265+
} else if self.immix.immix_space.prefer_copy_on_nursery_gc() {
266266
let ret = self.immix.immix_space.trace_object_with_opportunistic_copy(
267267
queue,
268268
object,

src/policy/immix/defrag.rs

+8-5
Original file line numberDiff line numberDiff line change
@@ -63,20 +63,23 @@ impl Defrag {
6363
}
6464

6565
/// Determine whether the current GC should do defragmentation.
66+
#[allow(clippy::too_many_arguments)]
6667
pub fn decide_whether_to_defrag(
6768
&self,
69+
defrag_enabled: bool,
6870
emergency_collection: bool,
6971
collect_whole_heap: bool,
7072
collection_attempts: usize,
7173
user_triggered: bool,
7274
exhausted_reusable_space: bool,
7375
full_heap_system_gc: bool,
7476
) {
75-
let in_defrag = emergency_collection
76-
|| (collection_attempts > 1)
77-
|| !exhausted_reusable_space
78-
|| super::STRESS_DEFRAG
79-
|| (collect_whole_heap && user_triggered && full_heap_system_gc);
77+
let in_defrag = defrag_enabled
78+
&& (emergency_collection
79+
|| (collection_attempts > 1)
80+
|| !exhausted_reusable_space
81+
|| super::STRESS_DEFRAG
82+
|| (collect_whole_heap && user_triggered && full_heap_system_gc));
8083
info!("Defrag: {}", in_defrag);
8184
probe!(mmtk, immix_defrag, in_defrag);
8285
self.in_defrag_collection

src/policy/immix/immixspace.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ impl<VM: VMBinding> SFT for ImmixSpace<VM> {
124124
VM::VMObjectModel::LOCAL_PINNING_BIT_SPEC.is_object_pinned::<VM>(object)
125125
}
126126
fn is_movable(&self) -> bool {
127-
!self.is_defrag_enabled() && !self.is_nursery_copy_enabled()
127+
!self.space_args.never_move_objects
128128
}
129129

130130
#[cfg(feature = "sanity")]
@@ -369,10 +369,8 @@ impl<VM: VMBinding> ImmixSpace<VM> {
369369
user_triggered_collection: bool,
370370
full_heap_system_gc: bool,
371371
) -> bool {
372-
if !self.is_defrag_enabled() {
373-
return false;
374-
}
375372
self.defrag.decide_whether_to_defrag(
373+
self.is_defrag_enabled(),
376374
emergency_collection,
377375
collect_whole_heap,
378376
collection_attempts,
@@ -856,7 +854,7 @@ impl<VM: VMBinding> ImmixSpace<VM> {
856854
}
857855

858856
pub(crate) fn is_nursery_copy_enabled(&self) -> bool {
859-
!self.space_args.never_move_objects
857+
!self.space_args.never_move_objects && !cfg!(feature = "sticky_immix_non_moving_nursery")
860858
}
861859

862860
pub(crate) fn is_defrag_enabled(&self) -> bool {
@@ -896,7 +894,7 @@ impl<VM: VMBinding> GCWork<VM> for PrepareBlockState<VM> {
896894
continue;
897895
}
898896
// Check if this block needs to be defragmented.
899-
let is_defrag_source = if self.space.space_args.never_move_objects {
897+
let is_defrag_source = if !self.space.is_defrag_enabled() {
900898
// Do not set any block as defrag source if defrag is disabled.
901899
false
902900
} else if super::DEFRAG_EVERY_BLOCK {

0 commit comments

Comments
 (0)