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

#16005: Don't use a generic apply thunk for known calls -------------------------------------+------------------------------------- Reporter: sgraf | Owner: (none) Type: task | Status: new Priority: normal | Milestone: 8.6.3 Component: Compiler | Version: 8.6.2 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): Phab:D5414 | Wiki Page: -------------------------------------+------------------------------------- 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. ---- I prepared a patch over at Phab:D5414 that fixes this by checking if the arity of `f` is unknown (e.g. 0). If not, it will no longer delegate to a generic apply thunk and generate regular entry code and info tables instead. No impact on allocations, but on counted instructions and code size. Significant changes to counted instructions: ||cryptarithm1 || -2.5%|| ||lcss || -2.3%|| ||paraffins || -3.8%|| ||wheel-sieve2 || -3.4%|| |||||| ||Min || -3.8%|| ||Max || +0.0%|| || Geometric Mean || -0.2%|| And changes to binary size greater than 0.1% (all the other programs, basically): || Program ||Size || Instrs|| || anna ||+0.3% ||-0.2%|| || expert ||+0.2% ||-0.0%|| || fluid ||+0.2% ||-0.1%|| || grep ||+0.2% ||-0.0%|| || infer ||+0.2% ||-0.4%|| || last-piece ||+0.2% ||-0.1%|| || lift ||+0.2% ||-0.0%|| || paraffins ||+0.2% ||-3.8%|| || prolog ||+0.2% ||-0.1%|| || scs ||+0.3% ||-0.0%|| || transform ||+0.2% ||-0.2%|| || veritas ||+0.2% ||+0.0%|| |||||||| || Min ||+0.1% ||-3.8%|| || Max ||+0.3% ||+0.0%|| || Geometric Mean ||+0.1% ||-0.2%|| -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16005 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#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: | -------------------------------------+------------------------------------- Changes (by sgraf): * status: new => patch -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16005#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#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

#16005: Don't use a generic apply thunk for known calls -------------------------------------+------------------------------------- Reporter: sgraf | Owner: (none) Type: task | Status: closed Priority: normal | Milestone: 8.8.1 Component: Compiler | Version: 8.6.2 Resolution: fixed | 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: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: patch => closed * resolution: => fixed * milestone: 8.6.3 => 8.8.1 Comment: Given this isn't strictly speaking a bug fix I'm going to defer this to 8.8. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16005#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC