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
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
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
Alex D
GHC
Commits
ee56dc56
Commit
ee56dc56
authored
Mar 03, 2015
by
Simon Peyton Jones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tidy up and improve comments about one-shot info
(Triggered by investigating Trac #10102 etc.)
parent
e673b840
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
11 additions
and
12 deletions
+11
-12
compiler/basicTypes/BasicTypes.hs
compiler/basicTypes/BasicTypes.hs
+1
-1
compiler/basicTypes/Demand.hs
compiler/basicTypes/Demand.hs
+2
-3
compiler/basicTypes/MkId.hs
compiler/basicTypes/MkId.hs
+5
-4
compiler/coreSyn/CoreTidy.hs
compiler/coreSyn/CoreTidy.hs
+1
-2
compiler/iface/IfaceType.hs
compiler/iface/IfaceType.hs
+2
-2
No files found.
compiler/basicTypes/BasicTypes.hs
View file @
ee56dc56
...
...
@@ -163,7 +163,7 @@ type Alignment = Int -- align to next N-byte boundary (N must be a power of 2).
data
OneShotInfo
=
NoOneShotInfo
-- ^ No information
|
ProbOneShot
-- ^ The lambda is probably applied at most once
-- See Note [Computing one-shot info, and ProbOneShot] in
OccurAnl
-- See Note [Computing one-shot info, and ProbOneShot] in
Demand
|
OneShotLam
-- ^ The lambda is applied at most once.
deriving
(
Eq
)
...
...
compiler/basicTypes/Demand.hs
View file @
ee56dc56
...
...
@@ -1618,9 +1618,8 @@ argOneShots one_shot_info (JD { absd = usg })
go
(
UCall
Many
u
)
=
NoOneShotInfo
:
go
u
go
_
=
[]
{-
Note [Computing one-shot info, and ProbOneShot]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
{- Note [Computing one-shot info, and ProbOneShot]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Consider a call
f (\pqr. e1) (\xyz. e2) e3
where f has usage signature
...
...
compiler/basicTypes/MkId.hs
View file @
ee56dc56
...
...
@@ -1250,7 +1250,6 @@ appears un-applied, we'll end up just calling it.
Note [The oneShot function]
~~~~~~~~~~~~~~~~~~~~~~~~~~~
In the context of making left-folds fuse somewhat okish (see ticket #7994
and Note [Left folds via right fold]) it was determined that it would be useful
if library authors could explicitly tell the compiler that a certain lambda is
...
...
@@ -1270,9 +1269,11 @@ after unfolding the definition `oneShot = \f \x[oneshot]. f x` we get
--> \x[oneshot] e[x/y]
which is what we want.
It is only effective if this bits survives as long as possible and makes it into
the interface in unfoldings (See Note [Preserve OneShotInfo]). Also see
https://ghc.haskell.org/trac/ghc/wiki/OneShot.
It is only effective if the one-shot info survives as long as possible; in
particular it must make it into the interface in unfoldings. See Note [Preserve
OneShotInfo] in CoreTidy.
Also see https://ghc.haskell.org/trac/ghc/wiki/OneShot.
Note [magicDictId magic]
...
...
compiler/coreSyn/CoreTidy.hs
View file @
ee56dc56
...
...
@@ -258,12 +258,11 @@ but that seems more indirect and surprising.)
Note [Preserve OneShotInfo]
~~~~~~~~~~~~~~~~~~~~~~~~~~~
We keep the OneShotInfo because we want it to propagate into the interface.
Not all OneShotInfo is determined by a compiler analysis; some is added by a
call of GHC.Exts.oneShot, which is then discarded before the end of the
optimisation pipeline, leaving only the OneShotInfo on the lambda. Hence we
must preserve this info in inlinings.
must preserve this info in inlinings.
See Note [The oneShot function] in MkId.
This applies to lambda binders only, hence it is stored in IfaceLamBndr.
-}
...
...
compiler/iface/IfaceType.hs
View file @
ee56dc56
...
...
@@ -87,8 +87,8 @@ type IfaceIdBndr = (IfLclName, IfaceType)
type
IfaceTvBndr
=
(
IfLclName
,
IfaceKind
)
data
IfaceOneShot
--
see Note [Preserve OneShotInfo]
=
IfaceNoOneShot
data
IfaceOneShot
--
See Note [Preserve OneShotInfo] in CoreTicy
=
IfaceNoOneShot
-- and Note [The oneShot function] in MkId
|
IfaceOneShot
type
IfaceLamBndr
...
...
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