Skip to content

Commit

Permalink
Fix how nursery GCs are triggered (#727)
Browse files Browse the repository at this point in the history
Closes #723.
  • Loading branch information
k-sareen authored Jan 5, 2023
1 parent 06237f1 commit 850b4d7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/api-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- uses: actions-rs/toolchain@v1
with:
# We need nightly for cargo-public-api to get the API output.
toolchain: nightly
toolchain: nightly-2023-01-04
profile: minimal
# It is not necessary to use nightly as default (which is used to install cargo-public-api and compile our code).
# However, our current toolchain is 1.59.0, and cargo-public-api requires 1.60 at least. To make it simple,
Expand All @@ -32,6 +32,6 @@ jobs:

# Install cargo-public-api
- name: Install cargo-public-api
run: cargo install cargo-public-api
run: cargo install cargo-public-api --version 0.26.0
- name: API Diff
run: cargo public-api --diff-git-checkouts origin/${GITHUB_BASE_REF} ${{ github.event.pull_request.head.sha }} --deny=all
run: cargo public-api diff origin/${GITHUB_BASE_REF}..${{ github.event.pull_request.head.sha }} --deny=all
9 changes: 7 additions & 2 deletions src/plan/generational/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ impl<VM: VMBinding> Gen<VM> {
pub fn requires_full_heap_collection<P: Plan>(&self, plan: &P) -> bool {
// Allow the same 'true' block for if-else.
// The conditions are complex, and it is easier to read if we put them to separate if blocks.
#[allow(clippy::if_same_then_else)]
#[allow(clippy::if_same_then_else, clippy::needless_bool)]
let is_full_heap = if crate::plan::generational::FULL_NURSERY_GC {
// For barrier overhead measurements, we always do full gc in nursery collections.
true
Expand All @@ -175,7 +175,12 @@ impl<VM: VMBinding> Gen<VM> {
} else if self.virtual_memory_exhausted(plan) {
true
} else {
plan.get_total_pages() <= plan.get_reserved_pages()
// We use an Appel-style nursery. The default GC (even for a "heap-full" collection)
// for generational GCs should be a nursery GC. A full-heap GC should only happen if
// there is not enough memory available for allocating into the nursery (i.e. the
// available pages in the nursery are less than the minimum nursery pages), if the
// virtual memory has been exhausted, or if it is an emergency GC.
false
};

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

0 comments on commit 850b4d7

Please sign in to comment.