[GHC] #16005: Don't use a generic apply thunk for known calls

GHC ghc-devs at haskell.org
Thu Dec 6 15:40:27 UTC 2018


#16005: Don't use a generic apply thunk for known calls
-------------------------------------+-------------------------------------
        Reporter:  sgraf             |                Owner:  (none)
            Type:  task              |               Status:  patch
        Priority:  normal            |            Milestone:  8.6.3
       Component:  Compiler          |              Version:  8.6.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):  Phab:D5414
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by Sebastian Graf <sebastian.graf@…>):

 In [changeset:"dc54c07cf18356a64cbe04aa9772c7f4c9fbc11d/ghc" dc54c07/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="dc54c07cf18356a64cbe04aa9772c7f4c9fbc11d"
 Don't use a generic apply thunk for known calls

 Summary:
 Currently, an AP thunk like `sat = f a b c` will not have its own entry
 point and info pointer and will instead reuse a generic apply thunk
 like `stg_ap_4_upd`.

 That's great from a code size perspective, but if `f` is a known
 function, a specialised entry point with a plain call can be much faster
 than figuring out the arity and doing dynamic dispatch.

 This looks at `f`s arity to figure out if it is a known function and if
 so, it
 will not lower it to a generic apply function.

 Benchmark results are encouraging: No changes to allocation, but 0.2% less
 counted instructions.

 Test Plan: Validates locally

 Reviewers: simonmar, osa1, simonpj, bgamari

 Reviewed By: simonpj

 Subscribers: rwbarton, carter

 GHC Trac Issues: #16005

 Differential Revision: https://phabricator.haskell.org/D5414
 }}}

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


More information about the ghc-tickets mailing list