Skip to content

Commit 850b4d7

Browse files
authored
Fix how nursery GCs are triggered (#727)
Closes #723.
1 parent 06237f1 commit 850b4d7

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

.github/workflows/api-check.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- uses: actions-rs/toolchain@v1
2323
with:
2424
# We need nightly for cargo-public-api to get the API output.
25-
toolchain: nightly
25+
toolchain: nightly-2023-01-04
2626
profile: minimal
2727
# It is not necessary to use nightly as default (which is used to install cargo-public-api and compile our code).
2828
# However, our current toolchain is 1.59.0, and cargo-public-api requires 1.60 at least. To make it simple,
@@ -32,6 +32,6 @@ jobs:
3232

3333
# Install cargo-public-api
3434
- name: Install cargo-public-api
35-
run: cargo install cargo-public-api
35+
run: cargo install cargo-public-api --version 0.26.0
3636
- name: API Diff
37-
run: cargo public-api --diff-git-checkouts origin/${GITHUB_BASE_REF} ${{ github.event.pull_request.head.sha }} --deny=all
37+
run: cargo public-api diff origin/${GITHUB_BASE_REF}..${{ github.event.pull_request.head.sha }} --deny=all

src/plan/generational/global.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ impl<VM: VMBinding> Gen<VM> {
149149
pub fn requires_full_heap_collection<P: Plan>(&self, plan: &P) -> bool {
150150
// Allow the same 'true' block for if-else.
151151
// The conditions are complex, and it is easier to read if we put them to separate if blocks.
152-
#[allow(clippy::if_same_then_else)]
152+
#[allow(clippy::if_same_then_else, clippy::needless_bool)]
153153
let is_full_heap = if crate::plan::generational::FULL_NURSERY_GC {
154154
// For barrier overhead measurements, we always do full gc in nursery collections.
155155
true
@@ -175,7 +175,12 @@ impl<VM: VMBinding> Gen<VM> {
175175
} else if self.virtual_memory_exhausted(plan) {
176176
true
177177
} else {
178-
plan.get_total_pages() <= plan.get_reserved_pages()
178+
// We use an Appel-style nursery. The default GC (even for a "heap-full" collection)
179+
// for generational GCs should be a nursery GC. A full-heap GC should only happen if
180+
// there is not enough memory available for allocating into the nursery (i.e. the
181+
// available pages in the nursery are less than the minimum nursery pages), if the
182+
// virtual memory has been exhausted, or if it is an emergency GC.
183+
false
179184
};
180185

181186
self.gc_full_heap.store(is_full_heap, Ordering::SeqCst);

0 commit comments

Comments
 (0)