Skip to content

Commit d15768a

Browse files
committed
Use mark sweep space as the non moving space
1 parent dd84218 commit d15768a

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

src/plan/global.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use crate::plan::tracing::ObjectQueue;
77
use crate::plan::Mutator;
88
use crate::policy::immortalspace::ImmortalSpace;
99
use crate::policy::largeobjectspace::LargeObjectSpace;
10+
use crate::policy::marksweepspace::native_ms::MarkSweepSpace;
1011
use crate::policy::space::{PlanCreateSpaceArgs, Space};
1112
#[cfg(feature = "vm_space")]
1213
use crate::policy::vmspace::VMSpace;
@@ -561,9 +562,8 @@ pub struct CommonPlan<VM: VMBinding> {
561562
pub immortal: ImmortalSpace<VM>,
562563
#[space]
563564
pub los: LargeObjectSpace<VM>,
564-
// TODO: We should use a marksweep space for nonmoving.
565565
#[space]
566-
pub nonmoving: ImmortalSpace<VM>,
566+
pub nonmoving: MarkSweepSpace<VM>,
567567
#[parent]
568568
pub base: BasePlan<VM>,
569569
}
@@ -580,7 +580,7 @@ impl<VM: VMBinding> CommonPlan<VM> {
580580
args.get_space_args("los", true, VMRequest::discontiguous()),
581581
false,
582582
),
583-
nonmoving: ImmortalSpace::new(args.get_space_args(
583+
nonmoving: MarkSweepSpace::new(args.get_space_args(
584584
"nonmoving",
585585
true,
586586
VMRequest::discontiguous(),
@@ -639,7 +639,7 @@ impl<VM: VMBinding> CommonPlan<VM> {
639639
&self.los
640640
}
641641

642-
pub fn get_nonmoving(&self) -> &ImmortalSpace<VM> {
642+
pub fn get_nonmoving(&self) -> &MarkSweepSpace<VM> {
643643
&self.nonmoving
644644
}
645645
}

src/plan/mutator_context.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -423,10 +423,8 @@ pub(crate) fn create_allocator_mapping(
423423
map[AllocationSemantics::Los] = AllocatorSelector::LargeObject(reserved.n_large_object);
424424
reserved.n_large_object += 1;
425425

426-
// TODO: This should be freelist allocator once we use marksweep for nonmoving space.
427-
map[AllocationSemantics::NonMoving] =
428-
AllocatorSelector::BumpPointer(reserved.n_bump_pointer);
429-
reserved.n_bump_pointer += 1;
426+
map[AllocationSemantics::NonMoving] = AllocatorSelector::FreeList(reserved.n_free_list);
427+
reserved.n_free_list += 1;
430428
}
431429

432430
reserved.validate();
@@ -488,12 +486,11 @@ pub(crate) fn create_space_mapping<VM: VMBinding>(
488486
plan.common().get_los(),
489487
));
490488
reserved.n_large_object += 1;
491-
// TODO: This should be freelist allocator once we use marksweep for nonmoving space.
492489
vec.push((
493-
AllocatorSelector::BumpPointer(reserved.n_bump_pointer),
490+
AllocatorSelector::FreeList(reserved.n_free_list),
494491
plan.common().get_nonmoving(),
495492
));
496-
reserved.n_bump_pointer += 1;
493+
reserved.n_free_list += 1;
497494
}
498495

499496
reserved.validate();

src/policy/marksweepspace/native_ms/global.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ impl<VM: VMBinding> MarkSweepSpace<VM> {
236236
}
237237
}
238238

239-
fn trace_object<Q: ObjectQueue>(
239+
pub fn trace_object<Q: ObjectQueue>(
240240
&self,
241241
queue: &mut Q,
242242
object: ObjectReference,

0 commit comments

Comments
 (0)