[Git][ghc/ghc][wip/fix-T25413] 21 commits: Improve heap overflow exception message (#25198)
Cheng Shao (@TerrorJack)
gitlab at gitlab.haskell.org
Tue Oct 29 12:41:45 UTC 2024
Cheng Shao pushed to branch wip/fix-T25413 at Glasgow Haskell Compiler / GHC
Commits:
6ab8d751 by ignatiusm at 2024-10-24T01:23:35-04:00
Improve heap overflow exception message (#25198)
Catch heap overflow exceptions and suggest using `+RTS -M<size>`.
Fix #25198
- - - - -
b3f7fb80 by Rodrigo Mesquita at 2024-10-24T01:24:12-04:00
determinism: Interface re-export list det
In 'DocStructureItem' we want to make sure the 'Avails' are sorted, for
interface file determinism. This commit introduces 'DetOrdAvails', a
newtype that should only be constructed by sorting Avails with
'sortAvails' unless the avails are known to be deterministically
ordered. This newtype is used by 'DocStructureItem' where 'Avails' was
previously used to ensure the list of avails is deterministically sorted
by construction.
Note: Even though we order the constructors and avails in the interface
file, the order of constructors in the haddock output is still
determined from the order of declaration in the source. This was also
true before, when the list of constructors in the interface file <docs>
section was non-deterministic. Some haddock tests such as
"ConstructorArgs" observe this (check the order of constructors in
out/ConstructorArgs.html vs src/ConstructorArgs.hs vs its interface file)
The updated tests are caused by haddock corners where the order in the
source is not preserved (and was non-deterministic before this PR):
* Module header in the latex backend
* Re-export of pattern synonyms associated to a datatype (#25342)
Fixes #25304
- - - - -
e39c8c99 by Rodrigo Mesquita at 2024-10-24T01:24:12-04:00
Revert "ci: Allow abi-test to fail."
After #25304, the abi-test with interface and object determinism
succeeds.
This reverts commit 7b37afc9f3e79559055488998ee73187886a0e00.
- - - - -
7b1b0c6d by Alan Zimmerman at 2024-10-24T13:07:02-04:00
EPA: reduce [AddEpann] in AnnList
Remove it from the `al_rest` field, and make `AnnList` parameterized
on a type to be used in `al_rest`, for the various use cases.
- - - - -
4a00731e by Rodrigo Mesquita at 2024-10-24T13:07:38-04:00
Fix -fobject-determinism flag definition
The flag should be defined as an fflag to make sure the
-fno-object-determinism flag is also an available option.
Fixes #25397
- - - - -
55e4b9f2 by Sebastian Graf at 2024-10-25T07:01:54-04:00
CorePrep: Attach evaldUnfolding to floats to detect more values
See `Note [Pin evaluatedness on floats]`.
- - - - -
9f57c96d by Sebastian Graf at 2024-10-25T07:01:54-04:00
Make DataCon workers strict in strict fields (#20749)
This patch tweaks `exprIsConApp_maybe`, `exprIsHNF` and friends, and Demand
Analysis so that they exploit and maintain strictness of DataCon workers. See
`Note [Strict fields in Core]` for details.
Very little needed to change, and it puts field seq insertion done by Tag
Inference into a new perspective: That of *implementing* strict field semantics.
Before Tag Inference, DataCon workers are strict. Afterwards they are
effectively lazy and field seqs happen around use sites. History has shown
that there is no other way to guarantee taggedness and thus the STG Strict Field
Invariant.
Knock-on changes:
* I reworked the whole narrative around "Tag inference".
It's now called "EPT enforcement" and I recycyled the different overview
Notes into `Note [EPT enforcement]`.
* `exprIsHNF` previously used `exprOkForSpeculation` on unlifted arguments
instead of recursing into `exprIsHNF`. That regressed the termination
analysis in CPR analysis (which simply calls out to `exprIsHNF`), so I made
it call `exprOkForSpeculation`, too.
* There's a small regression in Demand Analysis, visible in the changed test
output of T16859: Previously, a field seq on a variable would give that
variable a "used exactly once" demand, now it's "used at least once",
because `dmdTransformDataConSig` accounts for future uses of the field
that actually all go through the case binder (and hence won't re-enter the
potential thunk). The difference should hardly be observable.
* The Simplifier's fast path for data constructors only applies to lazy
data constructors now. I observed regressions involving Data.Binary.Put's
`Pair` data type.
* Unfortunately, T21392 does no longer reproduce after this patch, so I marked
it as "not broken" in order to track whether we regress again in the future.
Fixes #20749, the satisfying conclusion of an annoying saga (cf. the ideas
in #21497 and #22475).
Compiler perf generally improves, sometimes drastically:
Baseline
Test Metric value New value Change
--------------------------------------------------------------------------------
ManyConstructors(normal) ghc/alloc 3,629,760,116 3,711,852,800 +2.3% BAD
MultiLayerModulesTH_OneShot(normal) ghc/alloc 2,502,735,440 2,565,282,888 +2.5% BAD
T12707(normal) ghc/alloc 804,399,798 791,807,320 -1.6% GOOD
T17516(normal) ghc/alloc 964,987,744 1,008,383,520 +4.5%
T18140(normal) ghc/alloc 75,381,152 49,860,560 -33.9% GOOD
T18698b(normal) ghc/alloc 232,614,457 184,262,736 -20.8% GOOD
T18923(normal) ghc/alloc 62,002,368 58,301,408 -6.0% GOOD
T20049(normal) ghc/alloc 75,719,168 70,494,368 -6.9% GOOD
T3294(normal) ghc/alloc 1,237,925,833 1,157,638,992 -6.5% GOOD
T9233(normal) ghc/alloc 686,490,105 635,166,688 -7.5% GOOD
geo. mean -0.7%
minimum -33.9%
maximum +4.5%
I looked at T17516. It seems we do a few more simplifier iterations and end up
with a larger program. It seems that some things inline more, while other things
inline less. I don't see low-hanging fruit.
I also looked at MultiLayerModulesTH_OneShot. It appears we generate a strange
join point in the `getUnique` method of `Uniquable GHC.Unit.Types.Module` that
should better call-site inline, but does not. Perhaps with !11492.
NoFib does not seem affected much either:
+-------------------------------++--+------------+-----------+---------------+-----------+
| || | base/ | std. err. | T20749/ (rel) | std. err. |
+===============================++==+============+===========+===============+===========+
| spectral/last-piece || | 7.263e8 | 0.0% | +0.62% | 0.0% |
+===============================++==+============+===========+===============+===========+
| geom mean || | +0.00% | | | |
+-------------------------------++--+------------+-----------+---------------+-----------+
I had a look at last-piece. Nothing changes in stg-final, but there is a bit
of ... movement around Data.Map.insert's use of GHC.Exts.lazy that is gone in
stg-final.
Co-Authored-By: Jaro Reinders <jaro.reinders at gmail.com>
Metric Decrease:
T12707
T18140
T18698b
T18923
T19695
T20049
T3294
T9233
T21839c
Metric Increase:
ManyConstructors
MultiLayerModulesTH_OneShot
- - - - -
0225249a by Simon Peyton Jones at 2024-10-25T07:02:32-04:00
Some renaming
This is a pure refactor, tidying up some inconsistent naming:
isEqPred --> isEqClassPred
isEqPrimPred --> isEqPred
isReprEqPrimPred --> isReprEqPred
mkPrimEqPred --> mkNomEqPred
mkReprPrimEqPred --> mkReprEqPred
mkPrimEqPredRold --> mkEqPredRole
Plus I moved mkNomEqPred, mkReprEqPred, mkEqPredRolek
from GHC.Core.Coercion to GHC.Core.Predicate
where they belong. That means that Coercion imports Predicate
rather than vice versa -- better.
- - - - -
15a3456b by Ryan Hendrickson at 2024-10-25T07:02:32-04:00
compiler: Fix deriving with method constraints
See Note [Inferred contexts from method constraints]
Co-authored-by: Simon Peyton Jones <simon.peytonjones at gmail.com>
- - - - -
dbc77ce8 by Alan Zimmerman at 2024-10-25T18:20:13+01:00
EPA: Remove AddEpann commit 7
EPA: Remove [AddEpAnn] from HYPHEN in Parser.y
The return value is never used, as it is part of the backpack
configuration parsing.
EPA: Remove last [AddEpAnn] usages
Remove residual usage in GHC. It is still used
- In haddock TTG extension point definitions (to be removed)
- Some check-exact residual, to be removed
- Comments around DisambECP in PostProcess
EPA: Clean up [AddEpAnn] from check-exact
There is one left, to be cleaned up when we remove AddEpann itself
EPA: Remove [AddEpAnn] from haddock
The TTG extension points need a value, it is not critical what that
value is, in most cases.
EPA: Remove AddEpAnn from HsRuleAnn
EPA: Remove AddEpAnn from HsCmdArrApp
- - - - -
23ddcc01 by Simon Peyton Jones at 2024-10-26T12:44:34-04:00
Fix optimisation of InstCo
It turned out (#25387) that the fix to #15725 was not quite right:
commit 48efbc04bd45d806c52376641e1a7ed7278d1ec7
Date: Mon Oct 15 10:25:02 2018 +0200
Fix #15725 with an extra Sym
Optimising InstCo is quite subtle, and the invariants surrounding
the LiftingContext in the coercion optimiser were not stated explicitly.
This patch refactors the InstCo optimisation, and documents these
invariants. See
* Note [Optimising InstCo]
* Note [The LiftingContext in optCoercion]
I also did some refactoring of course:
* Instead of a Bool swap-flag, I am not using GHC.Types.Basic.SwapFlag
* I added some invariant-checking the coercion-construction functions
in GHC.Core.Coercion.Opt. (Sadly these invariants don't hold during
typechecking, becuase the types are un-zonked, so I can't put these
checks in GHC.Core.Coercion.)
- - - - -
589fea7f by Cheng Shao at 2024-10-27T05:36:38-04:00
ghcid: use multi repl for ghcid
- - - - -
d52a0475 by Andrew Lelechenko at 2024-10-27T05:37:13-04:00
documentation: add motivating section to Control.Monad.Fix
- - - - -
301c3b54 by Cheng Shao at 2024-10-27T05:37:49-04:00
wasm: fix safari console error message related to import("node:timers")
This patch fixes the wasm backend JSFFI prelude script to avoid
calling `import("node:timers")` on non-deno hosts. Safari doesn't like
it and would print an error message to the console. Fixes
https://gitlab.haskell.org/ghc/ghc-wasm-meta/-/issues/13.
- - - - -
9f02dfb5 by Simon Peyton Jones at 2024-10-27T15:10:08-04:00
Add a missing tidy in UnivCo
We were failing to tidy the argument coercions of a UnivCo, which
led directly to #25391.
The fix is, happily, trivial.
I don't have a small repro case (it came up when building horde-ad,
which uses typechecker plugins). It should be possible to make a
repro case, by using a plugin (which builds a UnivCo) but I decided
it was not worth the bother. The bug is egregious and easily fixed.
- - - - -
853050c3 by Andrew Lelechenko at 2024-10-27T15:10:44-04:00
Bump text submodule to 2.1.2
- - - - -
90746a59 by Andrew Lelechenko at 2024-10-27T15:10:44-04:00
hadrian: allow -Wunused-imports for text package
- - - - -
8a6691c3 by Alan Zimmerman at 2024-10-27T19:44:48+00:00
EPA: Remove AddEpAnn Commit 8/final
EPA: Remove AddEpAnn from AnnList
EPA: Remove AddEpAnn from GrhsAnn
This is the last actual use
EPA: Remove NameAdornment from NameAnn
Also rework AnnContext to use EpToken, and AnnParen
EPA: Remove AddEpAnn. Final removal
There are now none left, except for in a large note/comment in
PostProcess, describing the historical transition to the
disambiguation infrastructure
- - - - -
d5e7990c by Alan Zimmerman at 2024-10-28T21:41:05+00:00
EPA: Remove AnnKeywordId.
This was used as part of AddEpAnn, and is no longer needed.
Also remove all the haddock comments about which of are attached to
the various parts of the AST. This is now clearly captured in the
appropriate TTG extension points, and the `ExactPrint.hs` file.
- - - - -
01430910 by Cheng Shao at 2024-10-29T13:41:36+01:00
testsuite: add T25413 test marked as broken
- - - - -
d28b52a7 by Cheng Shao at 2024-10-29T13:41:36+01:00
driver: fix recompilation check for foreign files added by qAddForeignFilePath
This patch fixes a recompilation checking bug: when a user specified
non-temporary foreign file is added by `qAddForeignFilePath`, when the
file changes it should trigger a recompilation. Fixes #25413.
- - - - -
30 changed files:
- .ghcid
- .gitlab-ci.yml
- .gitlab/ci.sh
- compiler/GHC.hs
- compiler/GHC/Builtin/Types.hs
- compiler/GHC/Builtin/Types/Prim.hs
- compiler/GHC/Core.hs
- compiler/GHC/Core/Class.hs
- compiler/GHC/Core/Coercion.hs
- compiler/GHC/Core/Coercion.hs-boot
- compiler/GHC/Core/Coercion/Opt.hs
- compiler/GHC/Core/DataCon.hs
- compiler/GHC/Core/Opt/Arity.hs
- compiler/GHC/Core/Opt/CprAnal.hs
- compiler/GHC/Core/Opt/DmdAnal.hs
- compiler/GHC/Core/Opt/Simplify/Env.hs
- compiler/GHC/Core/Opt/Simplify/Iteration.hs
- compiler/GHC/Core/Opt/WorkWrap/Utils.hs
- compiler/GHC/Core/Predicate.hs
- compiler/GHC/Core/SimpleOpt.hs
- compiler/GHC/Core/TyCo/Subst.hs
- compiler/GHC/Core/TyCo/Tidy.hs
- compiler/GHC/Core/Type.hs
- compiler/GHC/Core/Utils.hs
- compiler/GHC/CoreToStg/Prep.hs
- compiler/GHC/Driver/Main.hs
- compiler/GHC/Driver/Session.hs
- compiler/GHC/Hs.hs
- compiler/GHC/Hs/Binds.hs
- compiler/GHC/Hs/Decls.hs
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/c5aa19464ed565ad2f672d877d5831459716ee35...d28b52a7a72ec7fe17c48460dcfcc93dd9bac9c9
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/c5aa19464ed565ad2f672d877d5831459716ee35...d28b52a7a72ec7fe17c48460dcfcc93dd9bac9c9
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20241029/ab014324/attachment-0001.html>
More information about the ghc-commits
mailing list