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
Container 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
Fumiaki Kinoshita
GHC
Commits
f2d27c1a
Commit
f2d27c1a
authored
6 years ago
by
Simon Marlow
Browse files
Options
Downloads
Patches
Plain Diff
Comments and refactoring only
Addressing review comments on D4637
parent
0c7db226
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
compiler/cmm/Cmm.hs
+12
-0
12 additions, 0 deletions
compiler/cmm/Cmm.hs
compiler/cmm/CmmBuildInfoTables.hs
+18
-12
18 additions, 12 deletions
compiler/cmm/CmmBuildInfoTables.hs
compiler/codeGen/StgCmmClosure.hs
+1
-1
1 addition, 1 deletion
compiler/codeGen/StgCmmClosure.hs
with
31 additions
and
13 deletions
compiler/cmm/Cmm.hs
+
12
−
0
View file @
f2d27c1a
...
...
@@ -143,6 +143,18 @@ data CmmInfoTable
cit_clo
::
Maybe
(
Id
,
CostCentreStack
)
-- Just (id,ccs) <=> build a static closure later
-- Nothing <=> don't build a static closure
--
-- Static closures for FUNs and THUNKs are *not* generated by
-- the code generator, because we might want to add SRT
-- entries to them later (for FUNs at least; THUNKs are
-- treated the same for consistency). See Note [SRTs] in
-- CmmBuildInfoTables, in particular the [FUN] optimisation.
--
-- This is strictly speaking not a part of the info table that
-- will be finally generated, but it's the only convenient
-- place to convey this information from the code generator to
-- where we build the static closures in
-- CmmBuildInfoTables.doSRTs.
}
data
ProfilingInfo
...
...
This diff is collapsed.
Click to expand it.
compiler/cmm/CmmBuildInfoTables.hs
+
18
−
12
View file @
f2d27c1a
...
...
@@ -463,15 +463,16 @@ getCAFs (CmmProc top_info topLbl _ g)
-- | Get the list of blocks that correspond to the entry points for
-- FUN_STATIC closures. These are the blocks for which if we have an
-- SRT we can merge it with the static closure. [FUN]
getStaticFuns
::
CmmDecl
->
[(
BlockId
,
CLabel
)]
getStaticFuns
(
CmmData
_
_
)
=
[]
getStaticFuns
(
CmmProc
top_info
_
_
g
)
|
Just
info
<-
mapLookup
(
g_entry
g
)
(
info_tbls
top_info
)
getStaticFuns
::
[
CmmDecl
]
->
[(
BlockId
,
CLabel
)]
getStaticFuns
decls
=
[
(
g_entry
g
,
lbl
)
|
CmmProc
top_info
_
_
g
<-
decls
,
Just
info
<-
[
mapLookup
(
g_entry
g
)
(
info_tbls
top_info
)]
,
Just
(
id
,
_
)
<-
[
cit_clo
info
]
,
let
rep
=
cit_rep
info
,
Just
(
id
,
_
)
<-
cit_clo
info
,
isStaticRep
rep
&&
isFunRep
rep
,
let
lbl
=
mkLocalClosureLabel
(
idName
id
)
(
idCafInfo
id
)
,
isStaticRep
rep
&&
isFunRep
rep
=
[(
g_entry
g
,
lbl
)]
|
otherwise
=
[]
]
-- | Put the labelled blocks that we will be annotating with SRTs into
...
...
@@ -527,7 +528,7 @@ doSRTs
->
[(
CAFEnv
,
[
CmmDecl
])]
->
IO
(
ModuleSRTInfo
,
[
CmmDecl
])
doSRTs
dflags
topSRT
tops
=
do
doSRTs
dflags
moduleSRTInfo
tops
=
do
us
<-
mkSplitUniqSupply
'u'
-- Ignore the original grouping of decls, and combine all the
...
...
@@ -535,7 +536,7 @@ doSRTs dflags topSRT tops = do
let
(
cafEnvs
,
declss
)
=
unzip
tops
cafEnv
=
mapUnions
cafEnvs
decls
=
concat
declss
staticFuns
=
mapFromList
(
concatMap
getStaticFuns
decls
)
staticFuns
=
mapFromList
(
getStaticFuns
decls
)
-- Put the decls in dependency order. Why? So that we can implement
-- [Shortcut] and [Filter]. If we need to refer to an SRT that has
...
...
@@ -547,9 +548,14 @@ doSRTs dflags topSRT tops = do
-- On each strongly-connected group of decls, construct the SRT
-- closures and the SRT fields for info tables.
let
((
result
,
_srtMap
),
topSRT'
)
=
let
result
::
[
(
[
CmmDecl
]
-- generated SRTs
,
[(
Label
,
CLabel
)]
-- SRT fields for info tables
,
[(
Label
,
[
SRTEntry
])]
-- SRTs to attach to static functions
)
]
((
result
,
_srtMap
),
moduleSRTInfo'
)
=
initUs_
us
$
flip
runStateT
topSRT
$
flip
runStateT
moduleSRTInfo
$
flip
runStateT
Map
.
empty
$
mapM
(
doSCC
dflags
staticFuns
)
sccs
...
...
@@ -561,7 +567,7 @@ doSRTs dflags topSRT tops = do
funSRTMap
=
mapFromList
(
concat
funSRTs
)
decls'
=
concatMap
(
updInfoSRTs
dflags
srtFieldMap
funSRTMap
)
decls
return
(
topSRT
'
,
concat
declss
++
decls'
)
return
(
moduleSRTInfo
'
,
concat
declss
++
decls'
)
-- | Build the SRT for a strongly-connected component of blocks
...
...
This diff is collapsed.
Click to expand it.
compiler/codeGen/StgCmmClosure.hs
+
1
−
1
View file @
f2d27c1a
...
...
@@ -1045,7 +1045,7 @@ mkDataConInfoTable dflags data_con is_static ptr_wds nonptr_wds
,
cit_rep
=
sm_rep
,
cit_prof
=
prof
,
cit_srt
=
Nothing
,
cit_clo
=
Nothing
}
,
cit_clo
=
Nothing
}
where
name
=
dataConName
data_con
info_lbl
=
mkConInfoTableLabel
name
NoCafRefs
...
...
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