A (late-)demand analysis and w/w question

Simon Peyton Jones simonpj at microsoft.com
Tue Feb 20 22:47:18 UTC 2018


It's called "reboxing" and is referred to in all the strictness analysis papers about GHC.  I don't know a reliable way to get rid of it; but I have it paged out at the moment.

Eg https://www.microsoft.com/en-us/research/publication/theory-practice-demand-analysis-haskell/
https://www.microsoft.com/en-us/research/publication/demand-analysis/ (the box-demad stuff in the appendix is not implemented in GHC)

Simon


| -----Original Message-----
| From: ghc-devs [mailto:ghc-devs-bounces at haskell.org] On Behalf Of Ömer
| Sinan Agacan
| Sent: 20 February 2018 16:25
| To: ghc-devs <ghc-devs at haskell.org>
| Subject: A (late-)demand analysis and w/w question
| 
| Hi,
| 
| I was recently looking at #6087. One of the cases that increased
| allocations (see comment:27) is when we do worker/wrapper to pass an
| `Int#` instead of `Int` when we need the boxed form in the function body.
| This causes redundant allocations because we already have the boxed
| version of the value but we passed it unboxed as a result of
| worker/wrapper.
| 
| This raises the obvious (but maybe naive?) question of whether we could
| improve the demand analysis and/or worker/wrapper to avoid unpacking
| arguments when the argument is boxed again somewhere in the function
| body.
| 
| Does this make sense? Has anyone tried this before?
| 
| Thanks,
| 
| Ömer
| _______________________________________________
| ghc-devs mailing list
| ghc-devs at haskell.org
| https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmail.hask
| ell.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fghc-
| devs&data=04%7C01%7Csimonpj%40microsoft.com%7C6adfeaddd9964adcba3208d5787
| eb1b1%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636547407938408171%7CU
| nknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwi
| fQ%3D%3D%7C-
| 1&sdata=XQ7xTxQepBeyi%2FDSHMmyXD0H8xFkh%2FoawqiIJJCUBYk%3D&reserved=0


More information about the ghc-devs mailing list