Skip to content

Commit 4bb37f8

Browse files
authored
Fix get_available_pages() for SemiSpace (#721)
Closes #615.
1 parent 9edb453 commit 4bb37f8

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

src/plan/generational/copying/global.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ impl<VM: VMBinding> Plan for GenCopy<VM> {
143143

144144
/// Return the number of pages available for allocation. Assuming all future allocations goes to nursery.
145145
fn get_available_pages(&self) -> usize {
146-
// super.get_pages_avail() / 2 to reserve pages for copying
146+
// super.get_available_pages() / 2 to reserve pages for copying
147147
(self
148148
.get_total_pages()
149149
.saturating_sub(self.get_reserved_pages()))

src/plan/generational/immix/global.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,9 @@ impl<VM: VMBinding> Plan for GenImmix<VM> {
183183
self.gen.get_used_pages() + self.immix.reserved_pages()
184184
}
185185

186-
/// Return the number of pages avilable for allocation. Assuming all future allocations goes to nursery.
186+
/// Return the number of pages available for allocation. Assuming all future allocations goes to nursery.
187187
fn get_available_pages(&self) -> usize {
188-
// super.get_pages_avail() / 2 to reserve pages for copying
188+
// super.get_available_pages() / 2 to reserve pages for copying
189189
(self
190190
.get_total_pages()
191191
.saturating_sub(self.get_reserved_pages()))

src/plan/semispace/global.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,13 @@ impl<VM: VMBinding> Plan for SemiSpace<VM> {
118118
self.tospace().reserved_pages() + self.common.get_used_pages()
119119
}
120120

121+
fn get_available_pages(&self) -> usize {
122+
(self
123+
.get_total_pages()
124+
.saturating_sub(self.get_reserved_pages()))
125+
>> 1
126+
}
127+
121128
fn base(&self) -> &BasePlan<VM> {
122129
&self.common.base
123130
}

0 commit comments

Comments
 (0)