[GHC] #13861: Take more advantage of STG representation invariance (follows up #9291)

GHC ghc-devs at haskell.org
Thu Jun 22 09:59:29 UTC 2017


#13861: Take more advantage of STG representation invariance (follows up #9291)
-------------------------------------+-------------------------------------
        Reporter:  heisenbug         |                Owner:  (none)
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by heisenbug):

 Replying to [comment:1 simonpj]:
 > Things to think about
 >
 > * It's not just memory layout.   To substitute one data constructor for
 another, they must have the same ''tag''; and may even need to belong to a
 data type with the same number of data constructors.  Eg

 Oh, yes I consider tags in my proposal. See my first bullet point. I doubt
 that the number of constructors must match, though. Maybe with nomeata's
 help I can come up with a proof-of-concept at some hackathon, so that we
 can get a feeling whether this optimisation kicks in often enough to
 become interesting.

 > {{{
 > case x of
 >   Nothing -> True
 > }}}
 >   `Nothing` has tag zero, and `True` has tag 1.
 >
 > * Runtime debugging or heap analysis may display the data constructor.
 Substituting a data constructor from another type would break this
 utterly.
 >
 > I'd need a bit of convincing that the benefit (in performance) justified
 the cost; and that the opportunities to exploit this happen often enough
 to use worth doing.

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


More information about the ghc-tickets mailing list