-
Notifications
You must be signed in to change notification settings - Fork 78
Use boolean allocation options #1400
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
base: master
Are you sure you want to change the base?
Conversation
We remove OnAllocationFail and add three boolean fields to AllocationOptions.
59ff447
to
fa47af7
Compare
After this PR, the decision tree becomes: (assuming this is a mutator thread, and GC is already initialized)
The control flow is more linear than before, with three steps, each using one boolean option. By combining the three options, we can replicate the behaviors of the previous
We can make a new combination to poll (scheduling GC in the background) and overcommit at the same time, and postpone blocking for GC to the next safepoint. This can be useful for VMs where allocation never happens at safepoints.
But I wonder whether we can remove the |
We discussed in today's meeting. We should either
I am in favor for removing The only thing it may affect may be NoGC. NoGC panics immediately in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than #1400 (comment), this PR looks good to me.
@@ -1,6 +1,8 @@ | |||
// GITHUB-CI: MMTK_PLAN=NoGC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this test only for NoGC?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, it doesn't have to. The test is about the behavior of allocation after exceeding the heap size, and it is not about the GC. So it doesn't really matter which plan it is. But I changed it to "all" just in case any plan triggers GC differently (mainly ConcurrentImmix).
Now polling cannot be disabled. It will always poll.
I removed |
We remove
OnAllocationFail
and add two boolean fields toAllocationOptions
:allow_overcommit
: whether we allow overcommitat_safepoint
: whether this allocation is at a safepointNow
Space::acquire
always polls before trying to get new pages. Particularly, whenallow_overcommit == true
, polling and over-committing will happen in one allocation attempt. If we also setat_safepoint == false
, the current mutator will be able to allocate normally in this allocation, but block for GC at the nearest safepoint. This is useful for certain VMs.