Skip to content

Conversation

wks
Copy link
Collaborator

@wks wks commented Oct 9, 2025

We remove OnAllocationFail and add three boolean fields to AllocationOptions:

  • allow_polling: whether this allocation attempt allows polling and trigger GC
  • at_safepoint: whether this allocation is at a safepoint, allowing it to block for GC when GC is triggered
  • allow_overcommit: whether we allow overcommit

This will allow new combinations that cannot be expressed by the previous OnAllocationFail type. Particularly, it allows both polling and over-committing to happen in one allocation attempt. If this allocation is also not at a safepoint, this combination will allow the current mutator to allocate normally in this allocation, but block for GC at the nearest safepoint.

Note: This PR implements the idea proposed in #1382 (comment). I created a new PR because the resulting commit will be radically different from #1382.

TODO:

This PR supersedes the following PRs:

wks added 6 commits September 1, 2025 15:01
This is useful if the VM cannot trigger GC at most of its allocation
sites.  If allocation over-commits while still triggering GC, the GC
thread can pause the mutators at the nearest safepoints.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant