diff options
author | Sebastian Graf <sebastian.graf@kit.edu> | 2022-02-28 14:52:36 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-03-13 18:12:48 -0400 |
commit | 76b94b726f6e21bb2a46ae04e4a1be2cba45a3dc (patch) | |
tree | 8db126a5c8718140a6cd7bdd8f3a20df257f580c /docs/users_guide | |
parent | ad83553153278947f439951d79a842527f2f0983 (diff) | |
download | haskell-76b94b726f6e21bb2a46ae04e4a1be2cba45a3dc.tar.gz |
Worker/wrapper: Preserve float barriers (#21150)
Issue #21150 shows that worker/wrapper allocated a worker function for a
function with multiple calls that said "called at most once" when the first
argument was absent. That's bad!
This patch makes it so that WW preserves at least one non-one-shot value lambda
(see `Note [Preserving float barriers]`) by passing around `void#` in place of
absent arguments.
Fixes #21150.
Since the fix is pretty similar to `Note [Protecting the last value argument]`,
I put the logic in `mkWorkerArgs`. There I realised (#21204) that
`-ffun-to-thunk` is basically useless with `-ffull-laziness`, so I deprecated
the flag, simplified and split into `needsVoidWorkerArg`/`addVoidWorkerArg`.
SpecConstr is another client of that API.
Fixes #21204.
Metric Decrease:
T14683
Diffstat (limited to 'docs/users_guide')
-rw-r--r-- | docs/users_guide/using-optimisation.rst | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/docs/users_guide/using-optimisation.rst b/docs/users_guide/using-optimisation.rst index 390b179f33..ab49f08ade 100644 --- a/docs/users_guide/using-optimisation.rst +++ b/docs/users_guide/using-optimisation.rst @@ -561,8 +561,7 @@ by saying ``-fno-wombat``. them. .. ghc-flag:: -ffun-to-thunk - :shortdesc: Allow worker-wrapper to convert a function closure into a thunk - if the function does not use any of its arguments. Off by default. + :shortdesc: *(deprecated)* superseded by -ffull-laziness. :type: dynamic :reverse: -fno-fun-to-thunk :category: @@ -574,6 +573,16 @@ by saying ``-fno-wombat``. thereby perhaps creating a space leak and/or disrupting inlining. This flag allows worker/wrapper to remove *all* value lambdas. + This flag was ineffective in the presence of :ghc-flag:`-ffull-laziness`, + which would flout a thunk out of a constant worker function *even though* + :ghc-flag:`-ffun-to-thunk` was off. + + Hence use of this flag is deprecated since GHC 9.4.1 and we rather suggest + to pass ``-fno-full-laziness`` instead. That implies there's no way for + worker/wrapper to turn a function into a thunk in the presence of + ``-fno-full-laziness``. If that is inconvenient for you, please leave a + comment `on the issue tracker (#21204) <https://gitlab.haskell.org/ghc/ghc/-/issues/21204>`__. + .. ghc-flag:: -fignore-asserts :shortdesc: Ignore assertions in the source. Implied by :ghc-flag:`-O`. :type: dynamic |