Strictness/demand analysis without worker/wrapper, or, reviving -fmax-worker-args

Christiaan Baaij christiaan.baaij at gmail.com
Mon Oct 12 16:38:15 UTC 2015


Hi,

As a GHC API user, I would like to run GHC’s strictness and demand analysis pass, but I don’t want any worker/wrappers.
My specific use-case is to generate digital circuits from Haskell code, where I’ve yet to encounter any benefit from worker/wrappers: the generated circuits do not get any smaller or faster.
They do however induce longer compilation times for my compiler.
I still want to have GHC’s strictness and demand analysis, because, if I understand correctly, the demand and strictness annotations are needed by GHC’s dead code analysis (and other optimisations) which is beneficial for my use case.

Looking through DynFlags, I encountered the ‘maxWorkerArgs’ field, which is controlled by ‘-fmax-worker-args’.
The user guide says the following:
"If a worker has that many arguments, none will be unpacked anymore (default: 10)”
I don’t know exactly what this means, but I was hoping that if I would set that number to 0 (zero), no worker/wrapper pairs would be created.
Is that correct?

The reason that I’m asking is because -fmax-worker-args is basically dead code.
The ‘maxWorkerArgs’ field of DynFlags is not used anywhere.
If setting ‘-fmax-worker-args’ to zero does indeed prevent any worker/wrappers from being generated, should I reimplement the flag and submit it as a patch?
Or, is it preferable to simply remove ‘-fmax-worker-args’ (given that it doesn’t do anything right now), and create a new flag, ‘-fno-worker-wrapper’, that simply disables the creation of worker/wrapper pairs everywhere?

Regards,

Christiaan


More information about the ghc-devs mailing list