[commit: ghc] master: Comments about ru_auto (62d1888)
git at git.haskell.org
git at git.haskell.org
Thu Feb 11 10:59:17 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/62d1888ff45bd817409be2c3eacdc86cfef4bed8/ghc
>---------------------------------------------------------------
commit 62d1888ff45bd817409be2c3eacdc86cfef4bed8
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date: Thu Feb 11 11:00:24 2016 +0000
Comments about ru_auto
...following a question from Conal
>---------------------------------------------------------------
62d1888ff45bd817409be2c3eacdc86cfef4bed8
compiler/coreSyn/CoreSyn.hs | 13 +++++++------
compiler/main/TidyPgm.hs | 16 +++++++++-------
2 files changed, 16 insertions(+), 13 deletions(-)
diff --git a/compiler/coreSyn/CoreSyn.hs b/compiler/coreSyn/CoreSyn.hs
index c725dc3..f06097a 100644
--- a/compiler/coreSyn/CoreSyn.hs
+++ b/compiler/coreSyn/CoreSyn.hs
@@ -864,15 +864,16 @@ data CoreRule
-- See Note [OccInfo in unfoldings and rules]
-- Locality
- ru_auto :: Bool, -- ^ @True@ <=> this rule is auto-generated
- -- @False@ <=> generated at the users behest
- -- Main effect: reporting of orphan-hood
+ ru_auto :: Bool, -- ^ @True@ <=> this rule is auto-generated
+ -- (notably by Specialise or SpecConstr)
+ -- @False@ <=> generated at the users behest
+ -- See Note [Trimming auto-rules] in TidyPgm
+ -- for the sole purpose of this field.
- ru_origin :: !Module, -- ^ 'Module' the rule was defined in, used
+ ru_origin :: !Module, -- ^ 'Module' the rule was defined in, used
-- to test if we should see an orphan rule.
- ru_orphan :: !IsOrphan,
- -- ^ Whether or not the rule is an orphan.
+ ru_orphan :: !IsOrphan, -- ^ Whether or not the rule is an orphan.
ru_local :: Bool -- ^ @True@ iff the fn at the head of the rule is
-- defined in the same module as the rule
diff --git a/compiler/main/TidyPgm.hs b/compiler/main/TidyPgm.hs
index c524bdf..63f4c26 100644
--- a/compiler/main/TidyPgm.hs
+++ b/compiler/main/TidyPgm.hs
@@ -887,9 +887,13 @@ reference to f_spec except from the RULE.
Now that RULE *might* be useful to an importing module, but that is
purely speculative, and meanwhile the code is taking up space and
-codegen time. So is seeems better to drop the binding for f_spec if
-the auto-generated rule is the *only* reason that it is being kept
-alive.
+codegen time. I found that binary sizes jumped by 6-10% when I
+started to specialise INLINE functions (again, Note [Inline
+specialisations] in Specialise).
+
+So it seeems better to drop the binding for f_spec, and the rule
+itself, if the auto-generated rule is the *only* reason that it is
+being kept alive.
(The RULE still might have been useful in the past; that is, it was
the right thing to have generated it in the first place. See Note
@@ -902,12 +906,10 @@ So findExternalRules does this:
* Remove all auto rules that mention bindings that have been removed
(this is done by filtering by keep_rule)
-So if a binding is kept alive for some *other* reason (e.g. f_spec is
+NB: if a binding is kept alive for some *other* reason (e.g. f_spec is
called in the final code), we keep the rule too.
-I found that binary sizes jumped by 6-10% when I started to specialise
-INLINE functions (again, Note [Inline specialisations] in Specialise).
-Adding trimAutoRules removed all this bloat.
+This stuff is the only reason for the ru_auto field in a Rule.
-}
findExternalRules :: Bool -- Omit pragmas
More information about the ghc-commits
mailing list