diff options
author | Michalis Pardalos <m.pardalos@gmail.com> | 2020-07-21 19:50:52 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-07-27 20:09:44 -0400 |
commit | 47680cb76b068508fd16d052e0a3bed12e38ea5f (patch) | |
tree | d063d3bc6f1e8eeaff3ab7c1a14718514720a05c /rts | |
parent | 6da73bbf97cca8bd64d70a26298e7f7ddad2ce52 (diff) | |
download | haskell-47680cb76b068508fd16d052e0a3bed12e38ea5f.tar.gz |
Use allocate, not ALLOC_PRIM_P for unpackClosure#
ALLOC_PRIM_P fails for large closures, by directly using allocate
we can handle closures which are larger than the block size.
Fixes #12492
Diffstat (limited to 'rts')
-rw-r--r-- | rts/PrimOps.cmm | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/rts/PrimOps.cmm b/rts/PrimOps.cmm index a920fd333b..a13dae6774 100644 --- a/rts/PrimOps.cmm +++ b/rts/PrimOps.cmm @@ -2360,6 +2360,7 @@ stg_mkApUpd0zh ( P_ bco ) stg_unpackClosurezh ( P_ closure ) { W_ info, ptrs, nptrs, p, ptrs_arr, dat_arr; + MAYBE_GC_P(stg_unpackClosurezh, closure); info = %GET_STD_INFO(UNTAG(closure)); prim_read_barrier; @@ -2375,12 +2376,13 @@ stg_unpackClosurezh ( P_ closure ) (len) = foreign "C" heap_view_closureSize(clos "ptr"); W_ ptrs_arr_sz, ptrs_arr_cards, dat_arr_sz; - dat_arr_sz = SIZEOF_StgArrBytes + WDS(len); - - ALLOC_PRIM_P (dat_arr_sz, stg_unpackClosurezh, closure); - - dat_arr = Hp - dat_arr_sz + WDS(1); + dat_arr_sz = SIZEOF_StgArrBytes + WDS(len); + ("ptr" dat_arr) = ccall allocateMightFail(MyCapability() "ptr", BYTES_TO_WDS(dat_arr_sz)); + if (dat_arr == NULL) (likely: False) { + jump stg_raisezh(base_GHCziIOziException_heapOverflow_closure); + } + TICK_ALLOC_PRIM(SIZEOF_StgArrBytes, WDS(len), 0); SET_HDR(dat_arr, stg_ARR_WORDS_info, CCCS); StgArrBytes_bytes(dat_arr) = WDS(len); |