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

Ömer Sinan Ağacan omeragacan at gmail.com
Tue Feb 20 16:25:23 UTC 2018


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


More information about the ghc-devs mailing list