summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Drop the app invariantwip/joachim/no-app-invariantJoachim Breitner2022-04-0723-271/+383
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | previously, GHC had the "let/app-invariant" which said that the RHS of a let or the argument of an application must be of lifted type or ok for speculation. We want this on let to freely float them around, and we wanted that on app to freely convert between the two (e.g. in beta-reduction or inlining). However, the app invariant meant that simple code didn't stay simple and this got in the way of rules matching. By removing the app invariant, this thus fixes #20554. The new invariant is now called "let-can-float invariant", which is hopefully easier to guess its meaning correctly. Dropping the app invariant means that everywhere where we effectively do beta-reduction (in the two simplifiers, but also in `exprIsConApp_maybe` and other innocent looking places) we now have to check if the argument must be evaluated (unlifted and side-effecting), and analyses have to be adjusted to the new semantics of `App`. Also, `LetFloats` in the simplifier can now also carry such non-floating bindings. The fix for DmdAnal, refine by Sebastian, makes functions with unlifted arguments strict in these arguments, which changes some signatures. This causes some extra calls to `exprType` and `exprOkForSpeculation`, so some perf benchmarks regress a bit (while others improve). Metric Decrease: T9020 Metric Increase: LargeRecord T12545 T15164 T16577 T18223 T5642 T9961 Co-authored-by: Sebastian Graf <sebastian.graf@kit.edu>
* Properly explain where INLINE pragmas can appear.Andreas Klebinger2022-04-071-6/+41
| | | | Fixes #20676
* Fix the free-var test in validDerivPredSimon Peyton Jones2022-04-074-57/+74
| | | | | | | | | | The free-var test (now documented as (VD3)) was too narrow, affecting only class predicates. #21302 demonstrated that this wasn't enough! Fixes #21302. Co-authored-by: Ryan Scott <ryan.gl.scott@gmail.com>
* Rename [] to List (#21294)Vladislav Zavialov2022-04-0722-46/+98
| | | | | | | | | | | | | This patch implements a small part of GHC Proposal #475. The key change is in GHC.Types: - data [] a = [] | a : [a] + data List a = [] | a : List a And the rest of the patch makes sure that List is pretty-printed as [] in various contexts. Updates the haddock submodule.
* Use prepareBinding in tryCastWorkerWrapperSimon Peyton Jones2022-04-076-164/+213
| | | | | | | | | | | | | | | | | | | | | | | | | | | | As #21144 showed, tryCastWorkerWrapper was calling prepareRhs, and then unconditionally floating the bindings, without the checks of doFloatFromRhs. That led to floating an unlifted binding into a Rec group. This patch refactors prepareBinding to make these checks, and do them uniformly across all calls. A nice improvement. Other changes * Instead of passing around a RecFlag and a TopLevelFlag; and sometimes a (Maybe SimplCont) for join points, define a new Simplifier-specific data type BindContext: data BindContext = BC_Let TopLevelFlag RecFlag | BC_Join SimplCont and use it consistently. * Kill off completeNonRecX by inlining it. It was only called in one place. * Add a wrapper simplImpRules for simplRules. Compile time on T9630 drops by 4.7%; little else changes. Metric Decrease: T9630
* EPA: handling of con_bndrs in mkGadtDeclAlan Zimmerman2022-04-073-21/+571
| | | | | | Get rid of unnnecessary case clause that always matched. Closes #20558
* Remove Fun pattern from Typeable COMPLETE setsheaf2022-04-073-3/+4
| | | | | | | | | | | | | | GHC merge request !963 improved warnings in the presence of COMPLETE annotations. This allows the removal of the Fun pattern from the complete set. Doing so expectedly causes some redundant pattern match warnings, in particular in GHC.Utils.Binary.Typeable and Data.Binary.Class from the binary library; this commit addresses that. Updates binary submodule Fixes #20230
* Refactor OutputableBndrFlag instancesVladislav Zavialov2022-04-061-36/+7
| | | | | The matching on GhcPass introduced by 95275a5f25a is not necessary. This patch reverts it to make the code simpler.
* Bump text submodule to current `master`Ben Gamari2022-04-061-0/+0
| | | | Addresses #21295.
* gitlab-ci: Bump bootstrap compiler to 9.2.2Ben Gamari2022-04-065-10/+11
| | | | | | This is necessary to build recent `text` commits. Bumps Hackage index state for a hashable which builds with GHC 9.2.
* Fix a few new warnings when booting with GHC 9.2.2Ben Gamari2022-04-064-6/+18
| | | | | -Wuni-incomplete-patterns and apparent improvements in the pattern match checker surfaced these.
* gitlab/darwin: Factor out bindistsBen Gamari2022-04-061-13/+12
| | | | This makes it a bit easier to bump them.
* gitlab-ci: Drop dead HACKAGE_INDEX_STATE variableBen Gamari2022-04-061-2/+0
|
* hadrian: Clean up flavour transformer definitionsBen Gamari2022-04-061-8/+6
| | | | | Previously the `ipe` and `omit_pragmas` transformers were hackily defined using the textual key-value syntax. Fix this.
* adjustors/i386: Use AdjustorPoolBen Gamari2022-04-065-133/+163
| | | | | | | | | | | | | | | In !7511 (closed) I introduced a new allocator for adjustors, AdjustorPool, which eliminates the address space fragmentation issues which adjustors can introduce. In that work I focused on amd64 since that was the platform where I observed issues. However, in #21132 we noted that the size of adjustors is also a cause of CI fragility on i386. In this MR I port i386 to use AdjustorPool. Sadly the complexity of the i386 adjustor code does cause require a bit of generalization which makes the code a bit more opaque but such is the world. Closes #21132.
* rts/AdjustorPool: Generalize to allow arbitrary contextsBen Gamari2022-04-064-35/+62
| | | | Unfortunately the i386 adjustor logic needs this.
* Add warnings for file header pragmas that appear in the body of a module ↵Zubin Duggal2022-04-0625-28/+156
| | | | | | | | | | | | | | | (#20385) Once we are done parsing the header of a module to obtain the options, we look through the rest of the tokens in order to determine if they contain any misplaced file header pragmas that would usually be ignored, potentially resulting in bad error messages. The warnings are reported immediately so that later errors don't shadow over potentially helpful warnings. Metric Increase: T13719
* Build ar archives with -L when "joining" objectsBen Gamari2022-04-068-1/+14
| | | | Since there may be .o files which are in fact archives.
* Add a Note describing lack of object merging on WindowsBen Gamari2022-04-064-8/+39
| | | | See #21068.
* hadrian: Produce ar archives with L modifier on WindowsBen Gamari2022-04-065-1/+41
| | | | | | | | Since object files may in fact be archive files, we must ensure that their contents are merged rather than constructing an archive-of-an-archive. See #21068.
* hadrian: Refactor handling of ar flagsBen Gamari2022-04-065-31/+37
| | | | | Previously the setup was quite fragile as it had to assume which arguments were file arguments and which were flags.
* driver: Make object merging optionalBen Gamari2022-04-065-7/+18
| | | | | | | On Windows we don't have a linker which supports object joining (i.e. the `-r` flag). Consequently, `-pgmlm` is now a `Maybe`. See #21068.
* rts/linker: Catch archives masquerading as object filesBen Gamari2022-04-063-2/+33
| | | | | | | Check the file's header to catch static archive bearing the `.o` extension, as may happen on Windows after the Clang refactoring. See #21068
* Use static archives as an alternative to object mergingBen Gamari2022-04-063-8/+15
| | | | | | | | | | Unfortunately, `lld`'s COFF backend does not currently support object merging. With ld.bfd having broken support for high image-load base addresses, it's necessary to find an alternative. Here I introduce support in the driver for generating static archives, which we use on Windows instead of object merging. Closes #21068.
* Add /linters/*/dist-install/ to .gitignoreRyan Scott2022-04-061-0/+1
| | | | | | Fixes #21335. [ci skip]
* gitlab-ci: Disable cabal-install store caching on WindowsBen Gamari2022-04-052-34/+21
| | | | | | | For reasons that remain a mystery, cabal-install seems to consistently corrupt its cache on Windows. Disable caching for now. Works around #21347.
* Ensure implicit parameters are liftedsheaf2022-04-014-5/+19
| | | | | | | | `tcExpr` typechecked implicit parameters by introducing a metavariable of kind `TYPE kappa`, without enforcing that `kappa ~ LiftedRep`. This patch instead creates a metavariable of kind `Type`. Fixes #21327
* users-guide: Fix various markup issuesBen Gamari2022-04-011-15/+15
|
* Fix error when using empty case in arrow notationJakob Bruenker2022-04-015-13/+50
| | | | | | | | | It was previously not possible to use -XEmptyCase in Arrow notation, since GHC would print "Exception: foldb of empty list". This is now fixed. Closes #21301
* Add a regression test for #21323sheaf2022-04-012-0/+56
| | | | | This bug was fixed at some point between GHC 9.0 and GHC 9.2; this patch simply adds a regression test.
* Implement \cases (Proposal 302)Jakob Bruenker2022-04-0175-568/+1096
| | | | | | | | | | | | This commit implements proposal 302: \cases - Multi-way lambda expressions. This adds a new expression heralded by \cases, which works exactly like \case, but can match multiple apats instead of a single pat. Updates submodule haddock to support the ITlcases token. Closes #20768
* Keep track of promotion ticks in HsOpTywip/no-c-stubswip/matt-merge-batchsheaf2022-04-0132-132/+295
| | | | | | | | | | | | | | | | This patch adds a PromotionFlag field to HsOpTy, which is used in pretty-printing and when determining whether to emit warnings with -fwarn-unticked-promoted-constructors. This allows us to correctly report tick-related warnings for things like: type A = Int : '[] type B = [Int, Bool] Updates haddock submodule Fixes #19984
* docs: Update documentation interaction of search path, -hidir and -c mode.Matthew Pickering2022-04-011-5/+9
| | | | | | | | | As noted in #20569 the documentation for search path was wrong because it seemed to indicate that `-i` dirs were important when looking for interface files in `-c` mode, but they are not important if `-hidir` is set. Fixes #20569
* driver: In oneshot mode, look for interface files in hidirMatthew Pickering2022-04-015-3/+20
| | | | | | | | | | | | | | | | How things should work: * -i is the search path for source files * -hidir explicitly sets the search path for interface files and the output location for interface files. * -odir sets the search path and output location for object files. Before in one shot mode we would look for the interface file in the search locations given by `-i`, but then set the path to be in the `hidir`, so in unusual situations the finder could find an interface file in the `-i` dir but later fail because it tried to read the interface file from the `-hidir`. A bug identified by #20569
* driver: Improve -Wunused-packages error message (and simplify implementation)Matthew Pickering2022-04-018-46/+42
| | | | | | | | | | | | | | | | | | | | | In the past I improved the part of -Wunused-packages which found which packages were used. Now I improve the part which detects which ones were specified. The key innovation is to use the explicitUnits field from UnitState which has the result of resolving the package flags, so we don't need to mess about with the flag arguments from DynFlags anymore. The output now always includes the package name and version (and the flag which exposed it). ``` The following packages were specified via -package or -package-id flags, but were not needed for compilation: - bytestring-0.11.2.0 (exposed by flag -package bytestring) - ghc-9.3 (exposed by flag -package ghc) - process-1.6.13.2 (exposed by flag -package process) ``` Fixes #21307
* Change GHC.Prim to GHC.Exts in docs and testsKrzysztof Gogolewski2022-04-01113-118/+93
| | | | | Users are supposed to import GHC.Exts rather than GHC.Prim. Part of #18749.
* hlint: Ignore suggestions in generated HaddockLex fileMatthew Pickering2022-04-011-1/+1
| | | | | | | | With the make build system this file ends up in the compiler/ subdirectory so is linted. With hadrian, the file ends up in _build so it's not linted. Fixes #21313
* hadrian: Add assertion that in/out tree args are the sameMatthew Pickering2022-04-012-23/+37
| | | | | | | | There have been a few instances where this calculation was incorrect, so we add a non-terminal assertion when now checks they the two computations indeed compute the same thing. Fixes #21285
* hadrian: Fix race involving empty package databasesMatthew Pickering2022-04-013-5/+18
| | | | | | | | | | | | | | | | There was a small chance of a race occuring between the small window of 1. The first package (.conf) file get written into the database 2. hadrian calling "ghc-pkg recache" to refresh the package.conf file In this window the package database would contain rts.conf but not a package.cache file, and therefore if ghc was invoked it would error because it was missing. To solve this we call "ghc-pkg recache" at when the database is created by shake by writing the stamp file into the database folder. This also creates the package.cache file and so avoids the possibility of this race.
* hadrian: Remove vestigial -this-unit-id support checkJohn Ericson2022-04-011-2/+0
| | | | This has been dead code since 400ead81e80f66ad7b1260b11b2a92f25ccc3e5a.
* Fix panic when pretty printing HsCmdLamJakob Bruenker2022-04-015-2/+17
| | | | | | | When pretty printing a HsCmdLam with more than one argument, GHC panicked because of a missing case. This fixes that. Closes #21300
* hadrian: Introduce CheckProgram datatype to replace a 7-tupleMatthew Pickering2022-04-011-10/+19
|
* hadrian: allow testing linters with out of tree compilersZubin Duggal2022-04-011-21/+21
|
* hadrian: Remove linters-common from bindistMatthew Pickering2022-04-012-3/+22
| | | | | | | | | | | | | | Zubin observed that the bindists contains the utility library linters-common. There are two options: 1. Make sure only the right files are added into the bindist.. a bit tricky due to the non-trivial structure of the lib directory. 2. Remove the bad files once they get copied in.. a bit easier So I went for option 2 but we perhaps should go for option 1 in the future. Fixes #21203
* Change may not to might notMaxHearnden2022-04-011-1/+1
|
* Add tests and docs on plugin args and order.Phil de Joux2022-04-0117-1/+208
|
* two typosEric Lindblad2022-04-012-2/+2
|
* hadrian typosEric Lindblad2022-04-014-4/+4
|
* Minor cleanupKrzysztof Gogolewski2022-04-0125-108/+28
| | | | | | | | | | | - Remove unused functions exprToCoercion_maybe, applyTypeToArg, typeMonoPrimRep_maybe, runtimeRepMonoPrimRep_maybe. - Replace orValid with a simpler check - Use splitAtList in applyTysX - Remove calls to extra_clean in the testsuite; it does not do anything. Metric Decrease: T18223
* Add test cases for #20640ARATA Mizuki2022-04-015-0/+22
| | | | Closes #20640