Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
GHC
Commits
ee56dc56
Commit
ee56dc56
authored
Mar 03, 2015
by
Simon Peyton Jones
Browse files
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
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
--
s
ee Note [Preserve OneShotInfo]
=
IfaceNoOneShot
data
IfaceOneShot
--
S
ee Note [Preserve OneShotInfo]
in CoreTicy
=
IfaceNoOneShot
-- and Note [The oneShot function] in MkId
|
IfaceOneShot
type
IfaceLamBndr
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment