Finding out if a binding is externally visible

Joachim Breitner mail at joachim-breitner.de
Mon May 29 15:08:10 UTC 2017


Hi,

Am Montag, den 29.05.2017, 10:40 +0200 schrieb Sebastian Graf:
> Note that at the bottom,
> there are RULEs stating the specialization for `Show Integer`, but
> that the specialized dictionary `$fShowRatio_$s$fShowRatio :: Show
> (Ratio Integer)` isn't otherwise reachable from any exported top-
> level identifier. Same goes for any of the specialized dictionary
> methods.

At least the Occurrence Analyzer keeps things referenced from RULES
alive:

    initial_uds = addManyOccsSet emptyDetails
                            (rulesFreeVars imp_rules `unionVarSet`
                             vectsFreeVars vects `unionVarSet`
                             vectVars)
    -- The RULES and VECTORISE declarations keep things alive!

So maybe the isExportedId is not the full truths that we are looking
for here… which would mean that CallArity might be buggy in that
respect. 

This does not contradict Note [ExportFlag on binders] – these IDs do
not need to be marked Exported, as they are kept alive by the RULE.
Would we drop, for whatever reason, the RULE, we would drop the id.

> In my case, my custom GHC would substitute away the `showString " %
> "` for an `absentError "lvl [Char]"` and crash in subtle ways. The
> only reason this isn't happening for GHC master is that DmdAnal does
> consider all top-level arguments to be used, instead of only the
> exported ones (which is what CallArity does).

It seems that CallArity is wrong here, and DmdAnal is right. The way
out is probably to have CallArity take RULES properly into account.

Greetings,
Joachim
-- 
Joachim “nomeata” Breitner
  mail at joachim-breitner.dehttps://www.joachim-breitner.de/
  XMPP: nomeata at joachim-breitner.de • OpenPGP-Key: 0xF0FBF51F
  Debian Developer: nomeata at debian.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20170529/2ba3a858/attachment.sig>


More information about the ghc-devs mailing list