[GHC] #10844: CallStack should not be inlined

GHC ghc-devs at haskell.org
Sun Sep 20 22:00:00 UTC 2015


#10844: CallStack should not be inlined
-------------------------------------+-------------------------------------
        Reporter:  nomeata           |                   Owner:  gridaphobe
            Type:  task              |                  Status:  new
        Priority:  normal            |               Milestone:
       Component:  Compiler          |                 Version:  7.10.2
      Resolution:                    |                Keywords:
Operating System:  Unknown/Multiple  |            Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |               Test Case:
      Blocked By:                    |                Blocking:
 Related Tickets:                    |  Differential Revisions:
-------------------------------------+-------------------------------------

Comment (by gridaphobe):

 Sorry to be slow here.

 I've been investigating this more today, trying to get GHC to not inline
 CallStacks. I can tell GHC to not inline Ids with an `IP CallStack` type
 by adding a special case to `CoreUnfold.callSiteInline` and
 `SimplUtils.{pre,post}InlineUnconditionally`, but this doesn't seem to be
 good enough.

 In Joachim's minimal example (thanks by the way!) the CallStack ''still''
 ends up in `T10844`. I've posted the output of `-dverbose-core2core` with
 what I believe to be the relevant portion highlighted.

 https://gist.github.com/gridaphobe/fd9f313d7d91be405f01#file-
 gistfile1-txt-L773-L981

 You can see that the pieces of the CallStack have just been floated out to
 the top-level, but `$cfoo`s unfolding still contains the whole CallStack
 instead of just a reference to the newly-created binder.

 So it seems that we want to tell the simplifier to update the unfolding
 when a CallStack is floated out. Is that a reasonable thing to do? (Sorry,
 my knowledge of this part of GHC is very limited)

 As an alternative, perhaps we could revise how CallStacks are desugared.
 If we could tell the Desugarer to translate CallStack evidence into
 exported binders instead of local binders, we could mark those binders as
 NOINLINE. This approach seems like it would be less brittle.

 (My WIP branch is at https://github.com/gridaphobe/ghc.git, branch
 `noinline-callstacks`)

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10844#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list