-
Notifications
You must be signed in to change notification settings - Fork 69
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
Add alloc_no_gc #1218
base: master
Are you sure you want to change the base?
Add alloc_no_gc #1218
Conversation
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.
I changed parts of the doc comments of alloc
, alloc_no_gc
, alloc_slow
and alloc_slow_no_gc
. Particularly, I rewrote the comment of alloc
to make it more ordered.
I changed the documentation based on the suggestions. |
src/memory_manager.rs
Outdated
/// normally without panicking or throwing exceptions, this function will return zero. | ||
/// | ||
/// This function in most cases returns a valid memory address. | ||
/// This function may return a zero address iif 1. MMTk attempts at least one GC, |
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.
/// This function may return a zero address iif 1. MMTk attempts at least one GC, | |
/// This function may return a zero address if 1. MMTk attempts at least one GC, |
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.
Actually this paragraph should be removed.
large object. Minor fixes for comments
Co-authored-by: Kunshan Wang <wks1986@gmail.com>
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.
LGTM
I’m awaiting feedback from @JunmingZhao42 and Ben before merging this PR, as they requested this feature. |
Co-authored-by: Ben Gamari <ben@smart-cactus.org>
This PR adds allocation functions that are not GC safe points. On failed allocation, they will not attempt a GC and will just return a null address.
Our current
alloc
functions assume they are GC safe points and will trigger GCs internally. A runtime may have different assumptions. We see GHC hasallocateMightFail
(https://gitlab.haskell.org/ghc/ghc/-/blob/90746a591919fc51a0ec9dec58d8f1c8397040e3/rts/sm/Storage.c?page=2#L1089). Also Julia assumes perm alloc will not trigger a GC (mmtk/mmtk-julia#172).Having a variant of
alloc
that is not GC safepoints could be generally useful.