
#10613: Mechanism for checking that we only enter single-entry thunks once -------------------------------------+------------------------------------- Reporter: bgamari | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj):
It seems that if a certain static thunk is created ''n'' times, then it will report ''n'' entries; whereas in the scope of this ticket we want to know that each allocated thunk was entered once.
Yes exactly. Let's call the code that allocates the thunk the '''thunk allocation site'''. For some of these sites, cardinality analysis may say "this is a single-entry thunk". Call those the ''single-entry thunk allocation sites''' and the others the '''multi-entry thunk allocation sites'''. * For each single-entry thunk allocation site, we'd like to know if any of the thunks it allocates are entered more than once. (This would mean that the analysis was unsound.) * For each multi-entry allocation site, we'd like to know if all the thunks it allocates are entered at most once. This is a possible missed opportunity to make it a single-entry site. (Only "possible" because in a different run it might be entered more than once.) * For all allocation sites we'd like to know if every thunk allocated there was never entered; that's a possible missed opportunity for absence. A counting indirection sounds like the right kind of thing. I would also like to count lambdas! So for the STG binding {{{ f = \xy. e }}} * How many times do I call f (ie enter the closure)? That is, is it a one-shot lambda. * Do I ever partially apply it, or is it always saturated? Similar technology might do the job. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10613#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler