Skip to content

Commit

Permalink
Use mark sweep space as the non moving space
Browse files Browse the repository at this point in the history
  • Loading branch information
qinsoon committed Mar 26, 2024
1 parent dd84218 commit d15768a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
8 changes: 4 additions & 4 deletions src/plan/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use crate::plan::tracing::ObjectQueue;
use crate::plan::Mutator;
use crate::policy::immortalspace::ImmortalSpace;
use crate::policy::largeobjectspace::LargeObjectSpace;
use crate::policy::marksweepspace::native_ms::MarkSweepSpace;
use crate::policy::space::{PlanCreateSpaceArgs, Space};
#[cfg(feature = "vm_space")]
use crate::policy::vmspace::VMSpace;
Expand Down Expand Up @@ -561,9 +562,8 @@ pub struct CommonPlan<VM: VMBinding> {
pub immortal: ImmortalSpace<VM>,
#[space]
pub los: LargeObjectSpace<VM>,
// TODO: We should use a marksweep space for nonmoving.
#[space]
pub nonmoving: ImmortalSpace<VM>,
pub nonmoving: MarkSweepSpace<VM>,
#[parent]
pub base: BasePlan<VM>,
}
Expand All @@ -580,7 +580,7 @@ impl<VM: VMBinding> CommonPlan<VM> {
args.get_space_args("los", true, VMRequest::discontiguous()),
false,
),
nonmoving: ImmortalSpace::new(args.get_space_args(
nonmoving: MarkSweepSpace::new(args.get_space_args(
"nonmoving",
true,
VMRequest::discontiguous(),
Expand Down Expand Up @@ -639,7 +639,7 @@ impl<VM: VMBinding> CommonPlan<VM> {
&self.los
}

pub fn get_nonmoving(&self) -> &ImmortalSpace<VM> {
pub fn get_nonmoving(&self) -> &MarkSweepSpace<VM> {
&self.nonmoving
}
}
Expand Down
11 changes: 4 additions & 7 deletions src/plan/mutator_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -423,10 +423,8 @@ pub(crate) fn create_allocator_mapping(
map[AllocationSemantics::Los] = AllocatorSelector::LargeObject(reserved.n_large_object);
reserved.n_large_object += 1;

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

reserved.validate();
Expand Down Expand Up @@ -488,12 +486,11 @@ pub(crate) fn create_space_mapping<VM: VMBinding>(
plan.common().get_los(),
));
reserved.n_large_object += 1;
// TODO: This should be freelist allocator once we use marksweep for nonmoving space.
vec.push((
AllocatorSelector::BumpPointer(reserved.n_bump_pointer),
AllocatorSelector::FreeList(reserved.n_free_list),
plan.common().get_nonmoving(),
));
reserved.n_bump_pointer += 1;
reserved.n_free_list += 1;
}

reserved.validate();
Expand Down
2 changes: 1 addition & 1 deletion src/policy/marksweepspace/native_ms/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ impl<VM: VMBinding> MarkSweepSpace<VM> {
}
}

fn trace_object<Q: ObjectQueue>(
pub fn trace_object<Q: ObjectQueue>(
&self,
queue: &mut Q,
object: ObjectReference,
Expand Down

0 comments on commit d15768a

Please sign in to comment.