diff options
author | Sebastian Graf <sebastian.graf@kit.edu> | 2022-02-28 14:52:36 +0100 |
---|---|---|
committer | Sebastian Graf <sebastian.graf@kit.edu> | 2022-03-11 16:03:01 +0100 |
commit | 81e5434c6597414b036e54e4c2ad9cff420d02a4 (patch) | |
tree | 2d8f8207640d4074ccfbc484eda1185f5fc7c052 /docs/users_guide | |
parent | 844cf1e14fe031c9ed7597b00a1183ad9b1ccc0a (diff) | |
download | haskell-wip/T21150.tar.gz |
Worker/wrapper: Preserve float barriers (#21150)wip/T21150
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 |