Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
GHC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alexander Kaznacheev
GHC
Commits
6d24076b
Commit
6d24076b
authored
11 years ago
by
Jan Stolarek
Browse files
Options
Downloads
Patches
Plain Diff
Document solution to #8275
parent
adb9964e
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
compiler/codeGen/StgCmmBind.hs
+13
-2
13 additions, 2 deletions
compiler/codeGen/StgCmmBind.hs
with
13 additions
and
2 deletions
compiler/codeGen/StgCmmBind.hs
+
13
−
2
View file @
6d24076b
...
...
@@ -493,7 +493,7 @@ closureCodeBody top_lvl bndr cl_info cc args arity body fv_details
tickyEnterFun
cl_info
;
enterCostCentreFun
cc
(
CmmMachOp
(
mo_wordSub
dflags
)
[
CmmReg
(
CmmLocal
node
)
--
not nodeReg, see #8275
[
CmmReg
(
CmmLocal
node
)
--
See [NodeReg clobbered with loopification]
,
mkIntExpr
dflags
(
funTag
dflags
cl_info
)
])
;
fv_bindings
<-
mapM
bind_fv
fv_details
-- Load free vars out of closure *after*
...
...
@@ -504,6 +504,18 @@ closureCodeBody top_lvl bndr cl_info cc args arity body fv_details
}
-- Note [NodeReg clobbered with loopification]
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
-- Previously we used to pass nodeReg (aka R1) here. With profiling, upon
-- entering a closure, enterFunCCS was called with R1 passed to it. But since R1
-- may get clobbered inside the body of a closure, and since a self-recursive
-- tail call does not restore R1, a subsequent call to enterFunCCS received a
-- possibly bogus value from R1. The solution is to not pass nodeReg (aka R1) to
-- enterFunCCS. Instead, we pass node, the callee-saved temporary that stores
-- the original value of R1. This way R1 may get modified but loopification will
-- not care.
-- A function closure pointer may be tagged, so we
-- must take it into account when accessing the free variables.
bind_fv
::
(
NonVoid
Id
,
VirtualHpOffset
)
->
FCode
(
LocalReg
,
WordOff
)
...
...
@@ -780,4 +792,3 @@ closureDescription dflags mod_name name
else
pprModule
mod_name
<>
char
'.'
<>
ppr
name
)
<>
char
'>'
)
-- showSDocDump, because we want to see the unique on the Name.
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment