Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix get_available_pages() for SemiSpace #721

Merged
merged 2 commits into from
Dec 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/plan/generational/copying/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ impl<VM: VMBinding> Plan for GenCopy<VM> {

/// Return the number of pages available for allocation. Assuming all future allocations goes to nursery.
fn get_available_pages(&self) -> usize {
// super.get_pages_avail() / 2 to reserve pages for copying
// super.get_available_pages() / 2 to reserve pages for copying
(self
.get_total_pages()
.saturating_sub(self.get_reserved_pages()))
Expand Down
4 changes: 2 additions & 2 deletions src/plan/generational/immix/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,9 @@ impl<VM: VMBinding> Plan for GenImmix<VM> {
self.gen.get_used_pages() + self.immix.reserved_pages()
}

/// Return the number of pages avilable for allocation. Assuming all future allocations goes to nursery.
/// Return the number of pages available for allocation. Assuming all future allocations goes to nursery.
fn get_available_pages(&self) -> usize {
// super.get_pages_avail() / 2 to reserve pages for copying
// super.get_available_pages() / 2 to reserve pages for copying
(self
.get_total_pages()
.saturating_sub(self.get_reserved_pages()))
Expand Down
7 changes: 7 additions & 0 deletions src/plan/semispace/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,13 @@ impl<VM: VMBinding> Plan for SemiSpace<VM> {
self.tospace().reserved_pages() + self.common.get_used_pages()
}

fn get_available_pages(&self) -> usize {
(self
.get_total_pages()
.saturating_sub(self.get_reserved_pages()))
>> 1
}

fn base(&self) -> &BasePlan<VM> {
&self.common.base
}
Expand Down