From 0e5411374ebbb934227ceb533f984886f611f1b6 Mon Sep 17 00:00:00 2001 From: Sebastian Graf Date: Mon, 22 Mar 2021 10:11:35 +0100 Subject: Worker/wrapper: Consistent names --- compiler/GHC/Core/Make.hs | 2 +- compiler/GHC/Core/Opt/DmdAnal.hs | 2 +- compiler/GHC/Core/Opt/Simplify.hs | 2 +- compiler/GHC/Core/Opt/WorkWrap.hs | 16 ++++++++-------- compiler/GHC/Core/Opt/WorkWrap/Utils.hs | 4 ++-- compiler/GHC/Core/Unfold.hs | 4 ++-- compiler/GHC/Core/Unfold/Make.hs | 2 +- compiler/GHC/Iface/Tidy.hs | 2 +- compiler/GHC/Tc/Gen/Sig.hs | 2 +- docs/users_guide/using-optimisation.rst | 2 +- 10 files changed, 19 insertions(+), 19 deletions(-) diff --git a/compiler/GHC/Core/Make.hs b/compiler/GHC/Core/Make.hs index 3638b43c56..72cffdbfa9 100644 --- a/compiler/GHC/Core/Make.hs +++ b/compiler/GHC/Core/Make.hs @@ -978,7 +978,7 @@ It turned out that g didn't use the second component, and hence f doesn't use the first. But the stable-unfolding for f looks like \x. case x of MkT a b -> g ($WMkT b a) where $WMkT is the wrapper for MkT that evaluates its arguments. We -apply the same w/w split to this unfolding (see Note [Worker-wrapper +apply the same w/w split to this unfolding (see Note [Worker/wrapper for INLINEABLE functions] in GHC.Core.Opt.WorkWrap) so the template ends up like \b. let a = absentError "blah" x = MkT a b diff --git a/compiler/GHC/Core/Opt/DmdAnal.hs b/compiler/GHC/Core/Opt/DmdAnal.hs index 11270ae8a8..0de022a78b 100644 --- a/compiler/GHC/Core/Opt/DmdAnal.hs +++ b/compiler/GHC/Core/Opt/DmdAnal.hs @@ -1319,7 +1319,7 @@ useful semantic strictness information, so now we analyse them like any other function, and pin strictness information on them. That in turn forces us to worker/wrapper them; see -Note [Worker-wrapper for NOINLINE functions] in GHC.Core.Opt.WorkWrap. +Note [Worker/wrapper for NOINLINE functions] in GHC.Core.Opt.WorkWrap. Note [Lazy and unleashable free variables] diff --git a/compiler/GHC/Core/Opt/Simplify.hs b/compiler/GHC/Core/Opt/Simplify.hs index e46a5c1cc5..dfbfd30e64 100644 --- a/compiler/GHC/Core/Opt/Simplify.hs +++ b/compiler/GHC/Core/Opt/Simplify.hs @@ -517,7 +517,7 @@ cast! We want to transfer the pagma to $wf: It's exactly like worker/wrapper for strictness analysis: f is the wrapper and must inline like crazy $wf is the worker and must carry f's original pragma -See Note [Worker-wrapper for NOINLINE functions] in +See Note [Worker/wrapper for NOINLINE functions] in GHC.Core.Opt.WorkWrap. See #17673, #18093, #18078. diff --git a/compiler/GHC/Core/Opt/WorkWrap.hs b/compiler/GHC/Core/Opt/WorkWrap.hs index a85ff4d04e..b7a52d4571 100644 --- a/compiler/GHC/Core/Opt/WorkWrap.hs +++ b/compiler/GHC/Core/Opt/WorkWrap.hs @@ -181,7 +181,7 @@ Notice that we refrain from w/w'ing an INLINE function even if it is in a recursive group. It might not be the loop breaker. (We could test for loop-breaker-hood, but I'm not sure that ever matters.) -Note [Worker-wrapper for INLINABLE functions] +Note [Worker/wrapper for INLINABLE functions] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If we have {-# INLINABLE f #-} @@ -226,7 +226,7 @@ in advance...the logic in mkWwBodies is complex. So I've left the super-simple test, with this Note to explain. -Note [Worker-wrapper for NOINLINE functions] +Note [Worker/wrapper for NOINLINE functions] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ We used to disable worker/wrapper for NOINLINE things, but it turns out this can cause unnecessary reboxing of values. Consider @@ -300,7 +300,7 @@ splitting a NOINLINE function. Note [Worker activation] ~~~~~~~~~~~~~~~~~~~~~~~~ -Follows on from Note [Worker-wrapper for INLINABLE functions] +Follows on from Note [Worker/wrapper for INLINABLE functions] It is *vital* that if the worker gets an INLINABLE pragma (from the original function), then the worker has the same phase activation as @@ -413,7 +413,7 @@ When should the wrapper inlining be active? Id 2. It should be active at some point, despite (1) because of - Note [Worker-wrapper for NOINLINE functions] + Note [Worker/wrapper for NOINLINE functions] 3. For ordinary functions with no pragmas we want to inline the wrapper as early as possible (#15056). Suppose another module @@ -469,7 +469,7 @@ Note [Wrapper NoUserInlinePrag] ~~~~~~~~~~~~~~~~~~~~~~~~~~~ We use NoUserInlinePrag on the wrapper, to say that there is no user-specified inline pragma. (The worker inherits that; see Note -[Worker-wrapper for INLINABLE functions].) The wrapper has no pragma +[Worker/wrapper for INLINABLE functions].) The wrapper has no pragma given by the user. (Historical note: we used to give the wrapper an INLINE pragma, but @@ -492,7 +492,7 @@ tryWW :: DynFlags -- if two, then a worker and a -- wrapper. tryWW dflags fam_envs is_rec fn_id rhs - -- See Note [Worker-wrapper for NOINLINE functions] + -- See Note [Worker/wrapper for NOINLINE functions] | Just stable_unf <- certainlyWillInline uf_opts fn_info = return [ (fn_id `setIdUnfolding` stable_unf, rhs) ] @@ -658,7 +658,7 @@ mkWWBindPair dflags fn_id fn_info arity rhs work_uniq div cpr , inl_sat = Nothing , inl_act = work_act , inl_rule = FunLike } - -- inl_inline: copy from fn_id; see Note [Worker-wrapper for INLINABLE functions] + -- inl_inline: copy from fn_id; see Note [Worker/wrapper for INLINABLE functions] -- inl_act: see Note [Worker activation] -- inl_rule: it does not make sense for workers to be constructorlike. @@ -677,7 +677,7 @@ mkWWBindPair dflags fn_id fn_info arity rhs work_uniq div cpr `setInlinePragma` work_prag `setIdUnfolding` mkWorkerUnfolding simpl_opts work_fn fn_unfolding - -- See Note [Worker-wrapper for INLINABLE functions] + -- See Note [Worker/wrapper for INLINABLE functions] `setIdDmdSig` mkClosedDmdSig work_demands div -- Even though we may not be at top level, diff --git a/compiler/GHC/Core/Opt/WorkWrap/Utils.hs b/compiler/GHC/Core/Opt/WorkWrap/Utils.hs index 6221804446..9c0a2b278f 100644 --- a/compiler/GHC/Core/Opt/WorkWrap/Utils.hs +++ b/compiler/GHC/Core/Opt/WorkWrap/Utils.hs @@ -720,7 +720,7 @@ If we have f :: Ord a => [a] -> Int -> a {-# INLINABLE f #-} and we worker/wrapper f, we'll get a worker with an INLINABLE pragma -(see Note [Worker-wrapper for INLINABLE functions] in GHC.Core.Opt.WorkWrap), +(see Note [Worker/wrapper for INLINABLE functions] in GHC.Core.Opt.WorkWrap), which can still be specialised by the type-class specialiser, something like fw :: Ord a => [a] -> Int# -> a @@ -1023,7 +1023,7 @@ splitting: like U(AAAA) for suitable number of absent demands. So we have a special case for it, with arity coming from the data constructor. -Note [Worker-wrapper for bottoming functions] +Note [Worker/wrapper for bottoming functions] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ We used not to split if the result is bottom. [Justification: there's no efficiency to be gained.] diff --git a/compiler/GHC/Core/Unfold.hs b/compiler/GHC/Core/Unfold.hs index cc95b3536e..93b41c1c3b 100644 --- a/compiler/GHC/Core/Unfold.hs +++ b/compiler/GHC/Core/Unfold.hs @@ -960,7 +960,7 @@ certainlyWillInline opts fn_info = case fn_unf of CoreUnfolding { uf_tmpl = expr, uf_guidance = guidance, uf_src = src } | loop_breaker -> Nothing -- Won't inline, so try w/w - | noinline -> Nothing -- See Note [Worker-wrapper for NOINLINE functions] + | noinline -> Nothing -- See Note [Worker/wrapper for NOINLINE functions] | otherwise -> case guidance of UnfNever -> Nothing @@ -1033,7 +1033,7 @@ certainlyWillInline /must/ return Nothing for a large INLINABLE thing, even though we have a stable inlining, so that strictness w/w takes place. It makes a big difference to efficiency, and the w/w pass knows how to transfer the INLINABLE info to the worker; see WorkWrap -Note [Worker-wrapper for INLINABLE functions] +Note [Worker/wrapper for INLINABLE functions] ************************************************************************ * * diff --git a/compiler/GHC/Core/Unfold/Make.hs b/compiler/GHC/Core/Unfold/Make.hs index aa95a13af1..29ec60087c 100644 --- a/compiler/GHC/Core/Unfold/Make.hs +++ b/compiler/GHC/Core/Unfold/Make.hs @@ -88,7 +88,7 @@ mkWwInlineRule opts expr arity , ug_boring_ok = boringCxtNotOk }) mkWorkerUnfolding :: SimpleOpts -> (CoreExpr -> CoreExpr) -> Unfolding -> Unfolding --- See Note [Worker-wrapper for INLINABLE functions] in GHC.Core.Opt.WorkWrap +-- See Note [Worker/wrapper for INLINABLE functions] in GHC.Core.Opt.WorkWrap mkWorkerUnfolding opts work_fn (CoreUnfolding { uf_src = src, uf_tmpl = tmpl , uf_is_top = top_lvl }) diff --git a/compiler/GHC/Iface/Tidy.hs b/compiler/GHC/Iface/Tidy.hs index c6175b2602..e9e69f5c68 100644 --- a/compiler/GHC/Iface/Tidy.hs +++ b/compiler/GHC/Iface/Tidy.hs @@ -1254,7 +1254,7 @@ tidyTopIdInfo uf_opts rhs_tidy_env name orig_rhs tidy_rhs idinfo show_unfold -- the function returns bottom -- In this case, show_unfold will be false (we don't expose unfoldings -- for bottoming functions), but we might still have a worker/wrapper - -- split (see Note [Worker-wrapper for bottoming functions] in + -- split (see Note [Worker/wrapper for bottoming functions] in -- GHC.Core.Opt.WorkWrap) diff --git a/compiler/GHC/Tc/Gen/Sig.hs b/compiler/GHC/Tc/Gen/Sig.hs index 5a6560864d..f327d8f9f7 100644 --- a/compiler/GHC/Tc/Gen/Sig.hs +++ b/compiler/GHC/Tc/Gen/Sig.hs @@ -850,7 +850,7 @@ An imported Id may or may not have an unfolding. If not, we obviously can't specialise it here; indeed the desugar falls over (#18118). We used to test whether it had a user-specified INLINABLE pragma but, -because of Note [Worker-wrapper for INLINABLE functions] in +because of Note [Worker/wrapper for INLINABLE functions] in GHC.Core.Opt.WorkWrap, even an INLINABLE function may end up with a wrapper that has no pragma, just an unfolding (#19246). So now we just test whether the function has an unfolding. diff --git a/docs/users_guide/using-optimisation.rst b/docs/users_guide/using-optimisation.rst index 2722a285df..523b0a7e66 100644 --- a/docs/users_guide/using-optimisation.rst +++ b/docs/users_guide/using-optimisation.rst @@ -488,7 +488,7 @@ by saying ``-fno-wombat``. :default: off - Worker-wrapper removes unused arguments, but usually we do not + Worker/wrapper removes unused arguments, but usually we do not remove them all, lest it turn a function closure into a thunk, thereby perhaps creating a space leak and/or disrupting inlining. This flag allows worker/wrapper to remove *all* value lambdas. -- cgit v1.2.1