[GHC] #9279: Local wrapper function remains in final program; result = extra closure allocation

GHC ghc-devs at haskell.org
Mon Sep 10 16:19:31 UTC 2018


#9279: Local wrapper function remains in final program; result = extra closure
allocation
-------------------------------------+-------------------------------------
        Reporter:  simonmar          |                Owner:  simonpj
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  7.8.2
      Resolution:                    |             Keywords:  LateLamLift
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Runtime           |  Unknown/Multiple
  performance bug                    |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by sgraf):

 `Note [Absent errors]` reads

 {{{
 Note: I did try the experiment of using an error thunk for unlifted
 things too, relying on the simplifier to drop it as dead code.
 But this is fragile

  - It fails when profiling is on, which disables various optimisations

  - It fails when reboxing happens. E.g.
       data T = MkT Int Int#
       f p@(MkT a _) = ...g p....
    where g is /lazy/ in 'p', but only uses the first component.  Then
    'f' is /strict/ in 'p', and only uses the first component.  So we only
    pass that component to the worker for 'f', which reconstructs 'p' to
    pass it to 'g'.  Alas we can't say
        ...f (MkT a (absentError Int# "blah"))...
    bacause `MkT` is strict in its Int# argument, so we get an absentError
    exception when we shouldn't.  Very annoying!

 So absentError is only used for lifted types.
 }}}

 But I suppose having just use `NULL` for the other unlifted+boxed cases is
 OK. We've been doing it for `Addr#` for a long time.

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


More information about the ghc-tickets mailing list