Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
GHC
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
4,269
Issues
4,269
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
413
Merge Requests
413
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Glasgow Haskell Compiler
GHC
Commits
30f7137d
Commit
30f7137d
authored
Dec 10, 2020
by
Ben Gamari
🐢
Committed by
Marge Bot
Jan 07, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rts: Zero shrunk array slop in vanilla RTS
But only when profiling or DEBUG are enabled. Fixes
#17572
.
parent
fb81f2ed
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
5 deletions
+16
-5
includes/Cmm.h
includes/Cmm.h
+5
-1
rts/sm/Storage.c
rts/sm/Storage.c
+9
-4
utils/deriveConstants/Main.hs
utils/deriveConstants/Main.hs
+2
-0
No files found.
includes/Cmm.h
View file @
30f7137d
...
...
@@ -630,7 +630,11 @@
#else
#define OVERWRITING_CLOSURE_SIZE(c, size)
/* nothing */
#define OVERWRITING_CLOSURE(c)
/* nothing */
#define OVERWRITING_CLOSURE_MUTABLE(c, off)
/* nothing */
/* This is used to zero slop after shrunk arrays. It is important that we do
* this whenever profiling is enabled as described in Note [slop on the heap]
* in Storage.c. */
#define OVERWRITING_CLOSURE_MUTABLE(c, off) \
if (TO_W_(RtsFlags_ProfFlags_doHeapProfile(RtsFlags)) != 0) { foreign "C" overwritingMutableClosureOfs(c "ptr", off); }
#endif
// Memory barriers.
...
...
rts/sm/Storage.c
View file @
30f7137d
...
...
@@ -953,14 +953,19 @@ accountAllocation(Capability *cap, W_ n)
* profiler, see Note [skipping slop in the heap profiler].
*
* In general we zero:
*
* - Pinned object alignment slop, see MEMSET_SLOP_W in allocatePinned.
* - Large object alignment slop, see MEMSET_SLOP_W in allocatePinned.
* This is necessary even in the vanilla RTS since the user may trigger a heap
* census via +RTS -hT even when not linking against the profiled RTS.
*
* Only when profiling we zero:
* - Shrunk array slop, see OVERWRITING_CLOSURE_MUTABLE.
*
* Note that this is necessary even in the vanilla (e.g. non-profiling) RTS
* since the user may trigger a heap census via +RTS -hT, which can be used
* even when not linking against the profiled RTS. Failing to zero slop
* due to array shrinking has resulted in a few nasty bugs (#17572, #9666).
* However, since array shrink may result in large amounts of slop (unlike
* alignment), we take care to only zero such slop when heap profiling or DEBUG
* are enabled.
*
* When performing LDV profiling or using a (single threaded) debug RTS we zero
* slop even when overwriting immutable closures, see Note [zeroing slop when
* overwriting closures].
...
...
utils/deriveConstants/Main.hs
View file @
30f7137d
...
...
@@ -561,6 +561,8 @@ wanteds os = concat
,
structField
C
"StgCompactNFDataBlock"
"owner"
,
structField
C
"StgCompactNFDataBlock"
"next"
,
structField_
C
"RtsFlags_ProfFlags_doHeapProfile"
"RTS_FLAGS"
"ProfFlags.doHeapProfile"
,
structField_
C
"RtsFlags_ProfFlags_showCCSOnException"
"RTS_FLAGS"
"ProfFlags.showCCSOnException"
,
structField_
C
"RtsFlags_DebugFlags_apply"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment