[Git][ghc/ghc][wip/simplifier-tweaks] 81 commits: Move function checks to RTS configure
Simon Peyton Jones (@simonpj)
gitlab at gitlab.haskell.org
Sat Nov 18 23:51:05 UTC 2023
Simon Peyton Jones pushed to branch wip/simplifier-tweaks at Glasgow Haskell Compiler / GHC
Commits:
02efc181 by John Ericson at 2023-10-22T02:48:55-04:00
Move function checks to RTS configure
Some of these functions are used in `base` too, but we can copy the
checks over to its configure if that's an issue.
- - - - -
5f4bccab by John Ericson at 2023-10-22T02:48:55-04:00
Move over a number of C-style checks to RTS configure
- - - - -
5cf04f58 by John Ericson at 2023-10-22T02:48:55-04:00
Move/Copy more `AC_DEFINE` to RTS config
Only exception is the LLVM version macros, which are used for GHC
itself.
- - - - -
b8ce5dfe by John Ericson at 2023-10-22T02:48:55-04:00
Define `TABLES_NEXT_TO_CODE` in the RTS configure
We create a new cabal flag to facilitate this.
- - - - -
4a40271e by John Ericson at 2023-10-22T02:48:55-04:00
Configure scripts: `checkOS`: Make a bit more robust
`mingw64` and `mingw32` are now both accepted for `OSMinGW32`. This
allows us to cope with configs/triples that we haven't normalized extra
being what GNU `config.sub` does.
- - - - -
16bec0a0 by John Ericson at 2023-10-22T02:48:55-04:00
Generate `ghcplatform.h` from RTS configure
We create a new cabal flag to facilitate this.
- - - - -
7dfcab2f by John Ericson at 2023-10-22T02:48:55-04:00
Get rid of all mention of `mk/config.h`
The RTS configure script is now solely responsible for managing its
headers; the top level configure script does not help.
- - - - -
c1e3719c by Cheng Shao at 2023-10-22T02:49:33-04:00
rts: drop stale mentions of MIN_UPD_SIZE
We used to have MIN_UPD_SIZE macro that describes the minimum reserved
size for thunks, so that the thunk can be overwritten in place as
indirections or blackholes. However, this macro has not been actually
defined or used anywhere since a long time ago; StgThunkHeader already
reserves a padding word for this purpose. Hence this patch which drops
stale mentions of MIN_UPD_SIZE.
- - - - -
d24b0d85 by Andrew Lelechenko at 2023-10-22T02:50:11-04:00
base changelog: move non-backported entries from 4.19 section to 4.20
Neither !10933 (check https://hackage.haskell.org/package/base-4.19.0.0/docs/src/Text.Read.Lex.html#numberToRangedRational)
nor !10189 (check https://hackage.haskell.org/package/base-4.19.0.0/docs/src/Data.List.NonEmpty.html#unzip)
were backported to `base-4.19.0.0`. Moving them to `base-4.20.0.0` section.
Also minor stylistic changes to other entries, bringing them to a uniform form.
- - - - -
de78b32a by Alan Zimmerman at 2023-10-23T09:09:41-04:00
EPA Some tweaks to annotations
- Fix span for GRHS
- Move TrailingAnns from last match to FunBind
- Fix GADT 'where' clause span
- Capture full range for a CaseAlt Match
- - - - -
d5a8780d by Simon Hengel at 2023-10-23T09:10:23-04:00
Update primitives.rst
- - - - -
4d075924 by Josh Meredith at 2023-10-24T23:04:12+11:00
JS/userguide: add explanation of writing jsbits
- - - - -
07ab5cc1 by Cheng Shao at 2023-10-24T15:40:32-04:00
testsuite: increase timeout of ghc-api tests for wasm32
ghc-api tests for wasm32 are more likely to timeout due to the large
wasm module sizes, especially when testing with wasm native tail
calls, given wasmtime's handling of tail call opcodes are suboptimal
at the moment. It makes sense to increase timeout specifically for
these tests on wasm32. This doesn't affect other targets, and for
wasm32 we don't increase timeout for all tests, so not to risk letting
major performance regressions slip through the testsuite.
- - - - -
0d6acca5 by Greg Steuck at 2023-10-26T08:44:23-04:00
Explicitly require RLIMIT_AS before use in OSMem.c
This is done elsewhere in the source tree. It also suddenly is
required on OpenBSD.
- - - - -
9408b086 by Sylvain Henry at 2023-10-26T08:45:03-04:00
Modularity: modularize external linker
Decouple runLink from DynFlags to allow calling runLink more easily.
This is preliminary work for calling Emscripten's linker (emcc) from
our JavaScript linker.
- - - - -
e0f35030 by doyougnu at 2023-10-27T08:41:12-04:00
js: add JStg IR, remove unsaturated constructor
- Major step towards #22736 and adding the optimizer in #22261
- - - - -
35587eba by Simon Peyton Jones at 2023-10-27T08:41:48-04:00
Fix a bug in tail calls with ticks
See #24078 for the diagnosis. The change affects only
the Tick case of occurrence analysis.
It's a bit hard to test, so no regression test (yet anyway).
- - - - -
9bc5cb92 by Matthew Craven at 2023-10-28T07:06:17-04:00
Teach tag-inference about SeqOp/seq#
Fixes the STG/tag-inference analogue of #15226.
Co-Authored-By: Simon Peyton Jones <simon.peytonjones at gmail.com>
- - - - -
34f06334 by Moritz Angermann at 2023-10-28T07:06:53-04:00
[PEi386] Mask SYM_TYPE_DUP_DISCARD in makeSymbolExtra
48e391952c17ff7eab10b0b1456e3f2a2af28a9b
introduced `SYM_TYPE_DUP_DISCARD` to the bitfield.
The linker however, failed to mask the `SYM_TYPE_DUP_DISCARD` value.
Thus `== SYM_TYPE_CODE` comparisons easily failed. This lead to us
relocating DATA lookups (GOT) into E8 (call) and E9 (jump) instructions.
- - - - -
5b51b2a2 by Mario Blažević at 2023-10-28T07:07:33-04:00
Fix and test for issue #24111, TH.Ppr output of pattern synonyms
- - - - -
723bc352 by Alan Zimmerman at 2023-10-30T20:36:41-04:00
EPA: print doc comments as normal comments
And ignore the ones allocated in haddock processing.
It does not guarantee that every original haddock-like comment appears
in the output, as it discards ones that have no legal attachment point.
closes #23459
- - - - -
21b76843 by Simon Peyton Jones at 2023-10-30T20:37:17-04:00
Fix non-termination bug in equality solver
constraint left-to-right then right to left, forever.
Easily fixed.
- - - - -
270867ac by Sebastian Graf at 2023-10-30T20:37:52-04:00
ghc-toolchain: build with `-package-env=-` (#24131)
Otherwise globally installed libraries (via `cabal install --lib`)
break the build.
Fixes #24131.
- - - - -
7a90020f by Krzysztof Gogolewski at 2023-10-31T20:03:37-04:00
docs: fix ScopedTypeVariables example (#24101)
The previous example didn't compile.
Furthermore, it wasn't demonstrating the point properly.
I have changed it to an example which shows that 'a' in the signature
must be the same 'a' as in the instance head.
- - - - -
49f69f50 by Krzysztof Gogolewski at 2023-10-31T20:04:13-04:00
Fix pretty-printing of type family dependencies
"where" should be after the injectivity annotation.
- - - - -
73c191c0 by Ben Gamari at 2023-10-31T20:04:49-04:00
gitlab-ci: Bump LLVM bootstrap jobs to Debian 12
As the Debian 10 images have too old an LLVM.
Addresses #24056.
- - - - -
5b0392e0 by Matthew Pickering at 2023-10-31T20:04:49-04:00
ci: Run aarch64 llvm backend job with "LLVM backend" label
This brings it into line with the x86 LLVM backend job.
- - - - -
9f9c9227 by Ryan Scott at 2023-11-01T09:19:12-04:00
More robust checking for DataKinds
As observed in #22141, GHC was not doing its due diligence in catching code
that should require `DataKinds` in order to use. Most notably, it was allowing
the use of arbitrary data types in kind contexts without `DataKinds`, e.g.,
```hs
data Vector :: Nat -> Type -> Type where
```
This patch revamps how GHC tracks `DataKinds`. The full specification is
written out in the `DataKinds` section of the GHC User's Guide, and the
implementation thereof is described in `Note [Checking for DataKinds]` in
`GHC.Tc.Validity`. In brief:
* We catch _type_-level `DataKinds` violations in the renamer. See
`checkDataKinds` in `GHC.Rename.HsType` and `check_data_kinds` in
`GHC.Rename.Pat`.
* We catch _kind_-level `DataKinds` violations in the typechecker, as this
allows us to catch things that appear beneath type synonyms. (We do *not*
want to do this in type-level contexts, as it is perfectly fine for a type
synonym to mention something that requires DataKinds while still using the
type synonym in a module that doesn't enable DataKinds.) See `checkValidType`
in `GHC.Tc.Validity`.
* There is now a single `TcRnDataKindsError` that classifies all manner of
`DataKinds` violations, both in the renamer and the typechecker. The
`NoDataKindsDC` error has been removed, as it has been subsumed by
`TcRnDataKindsError`.
* I have added `CONSTRAINT` is `isKindTyCon`, which is what checks for illicit
uses of data types at the kind level without `DataKinds`. Previously,
`isKindTyCon` checked for `Constraint` but not `CONSTRAINT`. This is
inconsistent, given that both `Type` and `TYPE` were checked by `isKindTyCon`.
Moreover, it thwarted the implementation of the `DataKinds` check in
`checkValidType`, since we would expand `Constraint` (which was OK without
`DataKinds`) to `CONSTRAINT` (which was _not_ OK without `DataKinds`) and
reject it. Now both are allowed.
* I have added a flurry of additional test cases that test various corners of
`DataKinds` checking.
Fixes #22141.
- - - - -
575d7690 by Sylvain Henry at 2023-11-01T09:19:53-04:00
JS: fix FFI "wrapper" and "dynamic"
Fix codegen and helper functions for "wrapper" and "dynamic" foreign
imports.
Fix tests:
- ffi006
- ffi011
- T2469
- T4038
Related to #22363
- - - - -
81fb8885 by Alan Zimmerman at 2023-11-01T22:23:56-04:00
EPA: Use full range for Anchor
This change requires a series of related changes, which must all land
at the same time, otherwise all the EPA tests break.
* Use the current Anchor end as prior end
Use the original anchor location end as the source of truth for
calculating print deltas.
This allows original spacing to apply in most cases, only changed
AST items need initial delta positions.
* Add DArrow to TrailingAnn
* EPA Introduce HasTrailing in ExactPrint
Use [TrailingAnn] in enterAnn and remove it from
ExactPrint (LocatedN RdrName)
* In HsDo, put TrailingAnns at top of LastStmt
* EPA: do not convert comments to deltas when balancing.
* EPA: deal with fallout from getMonoBind
* EPA fix captureLineSpacing
* EPA print any comments in the span before exiting it
* EPA: Add comments to AnchorOperation
* EPA: remove AnnEofComment, it is no longer used
Updates Haddock submodule
- - - - -
03e82511 by Rodrigo Mesquita at 2023-11-01T22:24:32-04:00
Fix in docs regarding SSymbol, SNat, SChar (#24119)
- - - - -
362cc693 by Matthew Pickering at 2023-11-01T22:25:08-04:00
hadrian: Update bootstrap plans (9.4.6, 9.4.7, 9.6.2, 9.6.3, 9.8.1)
Updating the bootstrap plans with more recent GHC versions.
- - - - -
00b9b8d3 by Matthew Pickering at 2023-11-01T22:25:08-04:00
ci: Add 9.8.1 bootstrap testing job
- - - - -
ef3d20f8 by Matthew Pickering at 2023-11-01T22:25:08-04:00
Compatibility with 9.8.1 as boot compiler
This fixes several compatability issues when using 9.8.1 as the boot
compiler.
* An incorrect version guard on the stack decoding logic in ghc-heap
* Some ghc-prim bounds need relaxing
* ghc is no longer wired in, so we have to remove the -this-unit-id ghc
call.
Fixes #24077
- - - - -
6755d833 by Jaro Reinders at 2023-11-03T10:54:42+01:00
Add NCG support for common 64bit operations to the x86 backend.
These used to be implemented via C calls which was obviously quite bad
for performance for operations like simple addition.
Co-authored-by: Andreas Klebinger
- - - - -
0dfb1fa7 by Vladislav Zavialov at 2023-11-03T14:08:41-04:00
T2T in Expressions (#23738)
This patch implements the T2T (term-to-type) transformation in
expressions. Given a function with a required type argument
vfun :: forall a -> ...
the user can now call it as
vfun (Maybe Int)
instead of
vfun (type (Maybe Int))
The Maybe Int argument is parsed and renamed as a term (HsExpr), but then
undergoes a conversion to a type (HsType).
See the new function expr_to_type in compiler/GHC/Tc/Gen/App.hs
and Note [RequiredTypeArguments and the T2T mapping]
Left as future work: checking for puns.
- - - - -
cc1c7c54 by Duncan Coutts at 2023-11-05T00:23:44-04:00
Add a test for I/O managers
It tries to cover the cases of multiple threads waiting on the same
fd for reading and multiple threads waiting for writing, including
wait cancellation by async exceptions.
It should work for any I/O manager, in-RTS or in-Haskell.
Unfortunately it will not currently work for Windows because it relies
on anonymous unix sockets. It could in principle be ported to use
Windows named pipes.
- - - - -
2e448f98 by Cheng Shao at 2023-11-05T00:23:44-04:00
Skip the IOManager test on wasm32 arch.
The test relies on the sockets API which are not (yet) available.
- - - - -
fe50eb35 by Cheng Shao at 2023-11-05T00:24:20-04:00
compiler: fix eager blackhole symbol in wasm32 NCG
- - - - -
af771148 by Cheng Shao at 2023-11-05T00:24:20-04:00
testsuite: fix optasm tests for wasm32
- - - - -
1b90735c by Matthew Pickering at 2023-11-05T00:24:20-04:00
testsuite: Add wasm32 to testsuite arches with NCG
The compiler --info reports that wasm32 compilers have a NCG, so we
should agree with that here.
- - - - -
db9a6496 by Alan Zimmerman at 2023-11-05T00:24:55-04:00
EPA: make locA a function, not a field name
And use it to generalise reLoc
The following for the windows pipeline one. 5.5%
Metric Increase:
T5205
- - - - -
833e250c by Simon Peyton Jones at 2023-11-05T00:25:31-04:00
Update the unification count in wrapUnifierX
Omitting this caused type inference to fail in #24146.
This was an accidental omision in my refactoring of the
equality solver.
- - - - -
e451139f by Andreas Klebinger at 2023-11-05T00:26:07-04:00
Remove an accidental git conflict marker from a comment.
- - - - -
30baac7a by Tobias Haslop at 2023-11-06T10:50:32+00:00
Add laws relating between Foldable/Traversable with their Bi- superclasses
See https://github.com/haskell/core-libraries-committee/issues/205 for
discussion.
This commit also documents that the tuple instances only satisfy the
laws up to lazyness, similar to the documentation added in !9512.
- - - - -
df626f00 by Tobias Haslop at 2023-11-07T02:20:37-05:00
Elaborate on the quantified superclass of Bifunctor
This was requested in the comment
https://github.com/haskell/core-libraries-committee/issues/93#issuecomment-1597271700
for when Traversable becomes a superclass of Bitraversable, but similarly
applies to Functor/Bifunctor, which already are in a superclass relationship.
- - - - -
8217acb8 by Alan Zimmerman at 2023-11-07T02:21:12-05:00
EPA: get rid of l2l and friends
Replace them with
l2l to convert the location
la2la to convert a GenLocated thing
Updates haddock submodule
- - - - -
dd88a260 by Luite Stegeman at 2023-11-07T02:21:53-05:00
JS: remove broken newIdents from JStg Monad
GHC.JS.JStg.Monad.newIdents was broken, resulting in duplicate
identifiers being generated in h$c1, h$c2, ... .
This change removes the broken newIdents.
- - - - -
455524a2 by Matthew Craven at 2023-11-09T08:41:59-05:00
Create specially-solved DataToTag class
Closes #20532. This implements CLC proposal 104:
https://github.com/haskell/core-libraries-committee/issues/104
The design is explained in Note [DataToTag overview]
in GHC.Tc.Instance.Class. This replaces the existing
`dataToTag#` primop.
These metric changes are not "real"; they represent Unique-related
flukes triggering on a different set of jobs than they did previously.
See also #19414.
Metric Decrease:
T13386
T8095
Metric Increase:
T13386
T8095
Co-authored-by: Simon Peyton Jones <simon.peytonjones at gmail.com>
- - - - -
a05f4554 by Alan Zimmerman at 2023-11-09T08:42:35-05:00
EPA: get rid of glRR and friends in GHC/Parser.y
With the HasLoc and HasAnnotation classes, we can replace a
number of type-specific helper functions in the parser with
polymorphic ones instead
Metric Decrease:
MultiLayerModulesTH_Make
- - - - -
18498538 by Cheng Shao at 2023-11-09T16:58:12+00:00
ci: bump ci-images for wasi-sdk upgrade
- - - - -
52c0fc69 by PHO at 2023-11-09T19:16:22-05:00
Don't assume the current locale is *.UTF-8, set the encoding explicitly
primops.txt contains Unicode characters:
> LC_ALL=C ./genprimopcode --data-decl < ./primops.txt
> genprimopcode: <stdin>: hGetContents: invalid argument (cannot decode byte sequence starting from 226)
Hadrian must also avoid using readFile' to read primops.txt because it
tries to decode the file with a locale-specific encoding.
- - - - -
7233b3b1 by PHO at 2023-11-09T19:17:01-05:00
Use '[' instead of '[[' because the latter is a Bash-ism
It doesn't work on platforms where /bin/sh is something other than Bash.
- - - - -
6dbab180 by Simon Peyton Jones at 2023-11-09T19:17:36-05:00
Add an extra check in kcCheckDeclHeader_sig
Fix #24083 by checking for a implicitly-scoped type variable that is not
actually bound. See Note [Disconnected type variables] in GHC.Tc.Gen.HsType
For some reason, on aarch64-darwin we saw a 2.8% decrease in compiler
allocations for MultiLayerModulesTH_Make; but 0.0% on other architectures.
Metric Decrease:
MultiLayerModulesTH_Make
- - - - -
22551364 by Sven Tennie at 2023-11-11T06:35:22-05:00
AArch64: Delete unused LDATA pseudo-instruction
Though there were consuming functions for LDATA, there were no
producers. Thus, the removed code was "dead".
- - - - -
2a0ec8eb by Alan Zimmerman at 2023-11-11T06:35:59-05:00
EPA: harmonise acsa and acsA in GHC/Parser.y
With the HasLoc class, we can remove the acsa helper function,
using acsA instead.
- - - - -
7ae517a0 by Teo Camarasu at 2023-11-12T08:04:12-05:00
nofib: bump submodule
This includes changes that:
- fix building a benchmark with HEAD
- remove a Makefile-ism that causes errors in bash scripts
Resolves #24178
- - - - -
3f0036ec by Alan Zimmerman at 2023-11-12T08:04:47-05:00
EPA: Replace Anchor with EpaLocation
An Anchor has a location and an operation, which is either that it is
unchanged or that it has moved with a DeltaPos
data Anchor = Anchor { anchor :: RealSrcSpan
, anchor_op :: AnchorOperation }
An EpaLocation also has either a location or a DeltaPos
data EpaLocation = EpaSpan !RealSrcSpan !(Strict.Maybe BufSpan)
| EpaDelta !DeltaPos ![LEpaComment]
Now that we do not care about always having a location in the anchor,
we remove Anchor and replace it with EpaLocation
We do this with a type alias initially, to ease the transition.
The alias will be removed in time.
We also have helpers to reconstruct the AnchorOperation from an
EpaLocation. This is also temporary.
Updates Haddock submodule
- - - - -
a7492048 by Alan Zimmerman at 2023-11-12T13:43:07+00:00
EPA: get rid of AnchorOperation
Now that the Anchor type is an alias for EpaLocation, remove
AnchorOperation.
Updates haddock submodule
- - - - -
0745c34d by Andrew Lelechenko at 2023-11-13T16:25:07-05:00
Add since annotation for showHFloat
- - - - -
e98051a5 by Rodrigo Mesquita at 2023-11-15T13:18:58-05:00
Suppress duplicate librares linker warning of new macOS linker
Fixes #24167
XCode 15 introduced a new linker which warns on duplicate libraries being
linked. To disable this warning, we pass -Wl,-no_warn_duplicate_libraries as
suggested by Brad King in CMake issue #25297.
This flag isn't necessarily available to other linkers on darwin, so we must
only configure it into the CC linker arguments if valid.
- - - - -
c411c431 by Rodrigo Mesquita at 2023-11-15T13:18:58-05:00
testsuite: Encoding test witnesses recent iconv bug is fragile
A regression in the new iconv() distributed with XCode 15 and MacOS
Sonoma causes the test 'encoding004' to fail in the CP936 roundrip.
We mark this test as fragile until this is fixed upstream (rather than
broken, since previous versions of iconv pass the test)
See #24161
- - - - -
ce7fe5a9 by Rodrigo Mesquita at 2023-11-15T13:18:58-05:00
testsuite: Update to LC_ALL=C no longer being ignored in darwin
MacOS seems to have fixed an issue where it used to ignore the variable
`LC_ALL` in program invocations and default to using Unicode.
Since the behaviour seems to be fixed to account for the locale
variable, we mark tests that were previously broken in spite of it as
fragile (since they now pass in recent macOS distributions)
See #24161
- - - - -
e6c803f7 by Rodrigo Mesquita at 2023-11-15T13:18:58-05:00
darwin: Fix single_module is obsolete warning
In XCode 15's linker, -single_module is the default and otherwise
passing it as a flag results in a warning being raised:
ld: warning: -single_module is obsolete
This patch fixes this warning by, at configure time, determining whether
the linker supports -single_module (which is likely false for all
non-darwin linkers, and true for darwin linkers in previous versions of
macOS), and using that information at runtime to decide to pass or not
the flag in the invocation.
Fixes #24168
- - - - -
929ba2f9 by Rodrigo Mesquita at 2023-11-15T13:18:58-05:00
testsuite: Skip MultiLayerModulesTH_Make on darwin
The recent toolchain upgrade on darwin machines resulted in the
MultiLayerModulesTH_Make test metrics varying too much from the
baseline, ultimately blocking the CI pipelines.
This commit skips the test on darwin to temporarily avoid failures due
to the environment change in the runners. However, the metrics
divergence is being investigated still (tracked in #24177)
- - - - -
af261ccd by Rodrigo Mesquita at 2023-11-15T13:18:58-05:00
configure: check target (not build) understands -no_compact_unwind
Previously, we were branching on whether the build system was darwin to
shortcut this check, but we really want to branch on whether the target
system (which is what we are configuring ld_prog for) is darwin.
- - - - -
2125c176 by Luite Stegeman at 2023-11-15T13:19:38-05:00
JS: Fix missing variable declarations
The JStg IR update was missing some local variable declarations
that were present earlier, causing global variables to be used
implicitly (or an error in JavaScript strict mode).
This adds the local variable declarations again.
- - - - -
99ced73b by Krzysztof Gogolewski at 2023-11-15T13:20:14-05:00
Remove loopy superclass solve mechanism
Programs with a -Wloopy-superclass-solve warning will now fail with an error.
Fixes #23017
- - - - -
2aff2361 by Zubin Duggal at 2023-11-15T13:20:50-05:00
users-guide: Fix links to libraries from the users-guide.
The unit-ids generated in c1a3ecde720b3bddc2c8616daaa06ee324e602ab include the
package name, so we don't need to explicitly add it to the links.
Fixes #24151
- - - - -
27981fac by Alan Zimmerman at 2023-11-15T13:21:25-05:00
EPA: splitLHsForAllTyInvis does not return ann
We did not use the annotations returned from splitLHsForAllTyInvis, so
do not return them.
- - - - -
a6467834 by Krzysztof Gogolewski at 2023-11-15T22:22:59-05:00
Document defaulting of RuntimeReps
Fixes #24099
- - - - -
2776920e by Simon Peyton Jones at 2023-11-15T22:23:35-05:00
Second fix to #24083
My earlier fix turns out to be too aggressive for data/type families
See wrinkle (DTV1) in Note [Disconnected type variables]
- - - - -
cee81370 by Sylvain Henry at 2023-11-16T09:57:46-05:00
Fix unusable units and module reexport interaction (#21097)
This commit fixes an issue with ModUnusable introduced in df0f148feae.
In mkUnusableModuleNameProvidersMap we traverse the list of unusable
units and generate ModUnusable origin for all the modules they contain:
exposed modules, hidden modules, and also re-exported modules. To do
this we have a two-level map:
ModuleName -> Unit:ModuleName (aka Module) -> ModuleOrigin
So for each module name "M" in broken unit "u" we have:
"M" -> u:M -> ModUnusable reason
However in the case of module reexports we were using the *target*
module as a key. E.g. if "u:M" is a reexport for "X" from unit "o":
"M" -> o:X -> ModUnusable reason
Case 1: suppose a reexport without module renaming (u:M -> o:M) from
unusable unit u:
"M" -> o:M -> ModUnusable reason
Here it's claiming that the import of M is unusable because a reexport
from u is unusable. But if unit o isn't unusable we could also have in
the map:
"M" -> o:M -> ModOrigin ...
Issue: the Semigroup instance of ModuleOrigin doesn't handle the case
(ModUnusable <> ModOrigin)
Case 2: similarly we could have 2 unusable units reexporting the same module
without renaming, say (u:M -> o:M) and (v:M -> o:M) with u and v
unusable. It gives:
"M" -> o:M -> ModUnusable ... (for u)
"M" -> o:M -> ModUnusable ... (for v)
Issue: the Semigroup instance of ModuleOrigin doesn't handle the case
(ModUnusable <> ModUnusable).
This led to #21097, #16996, #11050.
To fix this, in this commit we make ModUnusable track whether the module
used as key is a reexport or not (for better error messages) and we use
the re-export module as key. E.g. if "u:M" is a reexport for "o:X" and u
is unusable, we now record:
"M" -> u:M -> ModUnusable reason reexported=True
So now, we have two cases for a reexport u:M -> o:X:
- u unusable: "M" -> u:M -> ModUnusable ... reexported=True
- u usable: "M" -> o:X -> ModOrigin ... reexportedFrom=u:M
The second case is indexed with o:X because in this case the Semigroup
instance of ModOrigin is used to combine valid expositions of a module
(directly or via reexports).
Note that module lookup functions select usable modules first (those who
have a ModOrigin value), so it doesn't matter if we add new ModUnusable
entries in the map like this:
"M" -> {
u:M -> ModUnusable ... reexported=True
o:M -> ModOrigin ...
}
The ModOrigin one will be used. Only if there is no ModOrigin or
ModHidden entry will the ModUnusable error be printed. See T21097 for an
example printing several reasons why an import is unusable.
- - - - -
3e606230 by Krzysztof Gogolewski at 2023-11-16T09:58:22-05:00
Fix IPE test
A helper function was defined in a different module than used.
To reproduce: ./hadrian/build test --test-root-dirs=testsuite/tests/rts/ipe
- - - - -
49f5264b by Andreas Klebinger at 2023-11-16T20:52:11-05:00
Properly compute unpacked sizes for -funpack-small-strict-fields.
Use rep size rather than rep count to compute the size.
Fixes #22309
- - - - -
b4f84e4b by James Henri Haydon at 2023-11-16T20:52:53-05:00
Explicit methods for Alternative Compose
Explicitly define some and many in Alternative instance for
Data.Functor.Compose
Implementation of https://github.com/haskell/core-libraries-committee/issues/181
- - - - -
9bc0dd1f by Ignat Insarov at 2023-11-16T20:53:34-05:00
Add permutations for non-empty lists.
Approved by CLC in https://github.com/haskell/core-libraries-committee/issues/68#issuecomment-1221409837
- - - - -
5643ecf9 by Andrew Lelechenko at 2023-11-16T20:53:34-05:00
Update changelog and since annotations for Data.List.NonEmpty.permutations
Approved by CLC in https://github.com/haskell/core-libraries-committee/issues/68#issuecomment-1221409837
- - - - -
94ff2134 by Oleg Alexander at 2023-11-16T20:54:15-05:00
Update doc string for traceShow
Updated doc string for traceShow.
- - - - -
30ae3224 by Simon Peyton Jones at 2023-11-18T21:42:04+00:00
Several improvements to the handling of coercions
* Make `mkSymCo` and `mkInstCo` smarter
Fixes #23642
* Fix return role of `SelCo` in the coercion optimiser.
Fixes #23617
* Make the coercion optimiser `opt_trans_rule` work better for newtypes
Fixes #23619
- - - - -
10e5e6ce by Simon Peyton Jones at 2023-11-18T23:02:53+00:00
Simplifier improvements
This MR started as: allow the simplifer to do more in one pass,
arising from places I could see the simplifier taking two iterations
where one would do. But it turned into a larger project, because
these changes unexpectedly made inlining blow up, especially join
points in deeply-nested cases.
The net result is good: a 2% improvement in compile time. The table
below shows changes over 1%.
The main changes are:
* The SimplEnv now has a seInlineDepth field, which says how deep
in unfoldings we are. See Note [Inline depth] in Simplify.Env
* Avoid repeatedly simplifying coercions.
see Note [Avoid re-simplifying coercions] in Simplify.Iteration
As you'll see from the Note, this makes use of the seInlineDepth.
* Simplify.Utils.postInlineUnconditionally:
* Inline variables that are used exactly once.
See Note [Post-inline for single-use things].
* Never postInlineUnconditionally join points; see join points below.
* Don't postInlineUnconditionally strict bindings; doing so does not
save allocation
Also refactor the logic, which had grown rather convoluted.
* Allow Simplify.Iteration.simplAuxBind to inline used-once things.
This is another part of Note [Post-inline for single-use things], and
is really good for reducing simplifier iterations in situations like
case K e of { K x -> blah }
wher x is used once in blah.
* Make GHC.Core.SimpleOpt.exprIsConApp_maybe do some simple case
elimination. Note [Case elim in exprIsConApp_maybe]
* In SetLevels (full laziness) float a non-recursive join point only if it
is going to get to top level. See GHC.Core.Opt.SetLevels.wantFloatNonRec
* In GHC.Core.Opt.Arity.myExprIsCheap include `isCallStackTy`. See
Note [Eta expanding through CallStacks]
* Many new or rewritten Notes. E.g. Note [Avoiding simplifying repeatedly]
Lots of stuff about join points.
* Be very careful about inlining a join point $j = K x y, where K is a data
constructor. See the long Note [Duplicating join points] in
GHC.Core.Opt.Simplify.Iteration. There are a number of pieces to this;
see wrinkles (DJ1)-(DJ5).
* Do not add an unfolding to a join point at birth. This is a tricky one
and has a long Note [Do not add unfoldings to join points at birth]
It shows up in two places
- In `mkDupableAlt` do not add an inlining
- (trickier) In `simplLetUnfolding` don't add an unfolding for a
fresh join point
I am not fully satisifed with this, but it works and is well documented.
* A bit of tuning in thumbsUpPlanA in GHC.Core.Opt.Simplify.Iteration.
Small other things:
* I discovered that GHC.HsToCore.Pmc.Solver.Types.trvVarInfo was very
delicately balanced. It's a small, heavily used, overloaded function
and it's important that it inlines. By a fluke it was before, but at
various times in my journey it stopped doing so. So I added an INLINE
pragma to it.
* Added an invariant to GHC.Types.Tickish.GenTickish.
Metrics: compile_time/bytes allocated
------------------------------------------------
CoOpt_Singletons(normal) -4.3% GOOD
LargeRecord(normal) -23.3% GOOD
PmSeriesS(normal) -2.4%
T11195(normal) -1.7%
T12227(normal) -20.0% GOOD
T12545(normal) -5.4%
T13253-spj(normal) -50.7% GOOD
T13386(normal) -5.1% GOOD
T14766(normal) -2.4% GOOD
T15164(normal) -1.7%
T15304(normal) +1.0%
T15630(normal) -7.7%
T15630a(normal) NEW
T15703(normal) -7.5% GOOD
T16577(normal) -5.1% GOOD
T17516(normal) -3.6%
T18223(normal) -16.8% GOOD
T18282(normal) -1.5%
T18304(normal) +1.9%
T21839c(normal) -3.5% GOOD
T3064(normal) -1.5%
T5030(normal) -16.2% GOOD
T5321Fun(normal) -1.6%
T6048(optasm) -2.1% GOOD
T8095(normal) -6.1% GOOD
T9630(normal) -5.1% GOOD
WWRec(normal) -1.6%
geo. mean -2.1%
minimum -50.7%
maximum +1.9%
Metric Decrease:
CoOpt_Singletons
LargeRecord
T12227
T13253-spj
T13386
T14766
T15703
T16577
T18223
T21839c
T5030
T6048
T8095
T9630
- - - - -
26 changed files:
- .gitignore
- .gitlab-ci.yml
- .gitlab/generate-ci/gen_ci.hs
- .gitlab/jobs.yaml
- compiler/GHC/Builtin/Names.hs
- compiler/GHC/Builtin/PrimOps.hs
- compiler/GHC/Builtin/primops.txt.pp
- compiler/GHC/CmmToAsm/AArch64/CodeGen.hs
- compiler/GHC/CmmToAsm/AArch64/Instr.hs
- compiler/GHC/CmmToAsm/AArch64/Ppr.hs
- compiler/GHC/CmmToAsm/Wasm/FromCmm.hs
- compiler/GHC/CmmToAsm/X86/CodeGen.hs
- compiler/GHC/CmmToAsm/X86/Instr.hs
- compiler/GHC/CmmToAsm/X86/Ppr.hs
- compiler/GHC/Core/Coercion.hs
- compiler/GHC/Core/Coercion/Opt.hs
- compiler/GHC/Core/FamInstEnv.hs
- compiler/GHC/Core/Lint.hs
- compiler/GHC/Core/Opt/Arity.hs
- compiler/GHC/Core/Opt/ConstantFold.hs
- compiler/GHC/Core/Opt/OccurAnal.hs
- compiler/GHC/Core/Opt/SetLevels.hs
- compiler/GHC/Core/Opt/Simplify/Env.hs
- compiler/GHC/Core/Opt/Simplify/Inline.hs
- compiler/GHC/Core/Opt/Simplify/Iteration.hs
- compiler/GHC/Core/Opt/Simplify/Monad.hs
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/c559190dcf35edd3379e8b00b0e8bb913db2f339...10e5e6ced5f3186f382c493d685aff51e253e0e9
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/c559190dcf35edd3379e8b00b0e8bb913db2f339...10e5e6ced5f3186f382c493d685aff51e253e0e9
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/20231118/f6dc8e9d/attachment-0001.html>
More information about the ghc-commits
mailing list