summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorDaniel Gröber <dxld@darkboxed.org>2020-03-17 07:15:38 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-04-14 23:31:01 -0400
commit41230e2601703df0233860be3f7d53f3a01bdbe5 (patch)
tree195ff7429279efb4af74f6c9dfa2ef8cdbb772fe /includes
parent7b41f21bbfa9e266ba6654b08c3f9fec549c8bca (diff)
downloadhaskell-41230e2601703df0233860be3f7d53f3a01bdbe5.tar.gz
Zero out pinned block alignment slop when profiling
The heap profiler currently cannot traverse pinned blocks because of alignment slop. This used to just be a minor annoyance as the whole block is accounted into a special cost center rather than the respective object's CCS, cf. #7275. However for the new root profiler we would like to be able to visit _every_ closure on the heap. We need to do this so we can get rid of the current 'flip' bit hack in the heap traversal code. Since info pointers are always non-zero we can in principle skip all the slop in the profiler if we can rely on it being zeroed. This assumption caused problems in the past though, commit a586b33f8e ("rts: Correct handling of LARGE ARR_WORDS in LDV profiler"), part of !1118, tried to use the same trick for BF_LARGE objects but neglected to take into account that shrink*Array# functions don't ensure that slop is zeroed when not compiling with profiling. Later, commit 0c114c6599 ("Handle large ARR_WORDS in heap census (fix as we will only be assuming slop is zeroed when profiling is on. This commit also reduces the ammount of slop we introduce in the first place by calculating the needed alignment before doing the allocation for small objects where we know the next available address. For large objects we don't know how much alignment we'll have to do yet since those details are hidden behind the allocateMightFail function so there we continue to allocate the maximum additional words we'll need to do the alignment. So we don't have to duplicate all this logic in the cmm code we pull it into the RTS allocatePinned function instead. Metric Decrease: T7257 haddock.Cabal haddock.base
Diffstat (limited to 'includes')
-rw-r--r--includes/rts/storage/GC.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/includes/rts/storage/GC.h b/includes/rts/storage/GC.h
index 7931433019..9f4a0dde07 100644
--- a/includes/rts/storage/GC.h
+++ b/includes/rts/storage/GC.h
@@ -170,10 +170,13 @@ extern generation * oldest_gen;
Allocates memory from the nursery in
the current Capability.
- StgPtr allocatePinned(Capability *cap, W_ n)
+ StgPtr allocatePinned(Capability *cap, W_ n, W_ alignment, W_ align_off)
Allocates a chunk of contiguous store
n words long, which is at a fixed
- address (won't be moved by GC).
+ address (won't be moved by GC). The
+ word at the byte offset 'align_off'
+ will be aligned to 'alignment', which
+ must be a power of two.
Returns a pointer to the first word.
Always succeeds.
@@ -191,7 +194,7 @@ extern generation * oldest_gen;
StgPtr allocate ( Capability *cap, W_ n );
StgPtr allocateMightFail ( Capability *cap, W_ n );
-StgPtr allocatePinned ( Capability *cap, W_ n );
+StgPtr allocatePinned ( Capability *cap, W_ n, W_ alignment, W_ align_off);
/* memory allocator for executable memory */
typedef void* AdjustorWritable;