Commit 47680cb7 authored by Michalis Pardalos's avatar Michalis Pardalos Committed by Marge Bot

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
parent 6da73bbf
Pipeline #22709 canceled with stages
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment