Open qinsoon opened 3 weeks ago
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 has allocateMightFail (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 (https://github.com/mmtk/mmtk-julia/issues/172). Having a variant of alloc that is not GC safepoints could be generally useful.
alloc
allocateMightFail
I changed the documentation based on the suggestions.
I’m awaiting feedback from @JunmingZhao42 and Ben before merging this PR, as they requested this feature.
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 (https://github.com/mmtk/mmtk-julia/issues/172). Having a variant ofalloc
that is not GC safepoints could be generally useful.