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,264
Issues
4,264
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
419
Merge Requests
419
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
bd78c94a
Commit
bd78c94a
authored
Mar 18, 2009
by
Simon Marlow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes to "Retract Hp *before* checking for HpLim==0"
parent
8b18faef
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
2 deletions
+19
-2
compiler/codeGen/CgForeignCall.hs
compiler/codeGen/CgForeignCall.hs
+7
-2
rts/HeapStackCheck.cmm
rts/HeapStackCheck.cmm
+12
-0
No files found.
compiler/codeGen/CgForeignCall.hs
View file @
bd78c94a
...
...
@@ -212,7 +212,11 @@ emitLoadThreadState = do
bWord
),
-- SpLim = tso->stack + RESERVED_STACK_WORDS;
CmmAssign
spLim
(
cmmOffsetW
(
cmmOffset
(
CmmReg
(
CmmLocal
tso
))
tso_STACK
)
rESERVED_STACK_WORDS
)
rESERVED_STACK_WORDS
),
-- HpAlloc = 0;
-- HpAlloc is assumed to be set to non-zero only by a failed
-- a heap check, see HeapStackCheck.cmm:GC_GENERIC
CmmAssign
hpAlloc
(
CmmLit
zeroCLit
)
]
emitOpenNursery
-- and load the current cost centre stack from the TSO when profiling:
...
...
@@ -267,13 +271,14 @@ stgHp = CmmReg hp
stgCurrentTSO
=
CmmReg
currentTSO
stgCurrentNursery
=
CmmReg
currentNursery
sp
,
spLim
,
hp
,
hpLim
,
currentTSO
,
currentNursery
::
CmmReg
sp
,
spLim
,
hp
,
hpLim
,
currentTSO
,
currentNursery
,
hpAlloc
::
CmmReg
sp
=
CmmGlobal
Sp
spLim
=
CmmGlobal
SpLim
hp
=
CmmGlobal
Hp
hpLim
=
CmmGlobal
HpLim
currentTSO
=
CmmGlobal
CurrentTSO
currentNursery
=
CmmGlobal
CurrentNursery
hpAlloc
=
CmmGlobal
HpAlloc
-- -----------------------------------------------------------------------------
-- For certain types passed to foreign calls, we adjust the actual
...
...
rts/HeapStackCheck.cmm
View file @
bd78c94a
...
...
@@ -26,6 +26,17 @@ import LeaveCriticalSection;
* - If HpLim==0, indicating that we should context-switch, we yield
* to the scheduler (return ThreadYielding).
*
* Note that we must leave no slop in the heap (this is a requirement
* for LDV profiling, at least), so if we just had a heap-check
* failure, then we must retract Hp by HpAlloc. How do we know
* whether there was a heap-check failure? HpLim might be zero, and
* yet we got here as a result of a stack-check failure. Hence, we
* require that HpAlloc is only non-zero if there was a heap-check
* failure, otherwise it is zero, so we can always safely subtract
* HpAlloc from Hp.
*
* Hence, HpAlloc is zeroed in LOAD_THREAD_STATE().
*
* - If the context_switch flag is set (the backup plan if setting HpLim
* to 0 didn't trigger a context switch), we yield to the scheduler
* (return ThreadYielding).
...
...
@@ -70,6 +81,7 @@ import LeaveCriticalSection;
} \
if (HpAlloc <= BLOCK_SIZE \
&& bdescr_link(CurrentNursery) != NULL) { \
HpAlloc = 0; \
CLOSE_NURSERY(); \
CurrentNursery = bdescr_link(CurrentNursery); \
OPEN_NURSERY(); \
...
...
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