summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* Switch off eta-expansion in rules and unfoldingsSimon Peyton Jones2022-07-251-8/+14
| | | | | | I think this change will make little difference except to reduce clutter. But that's it -- if it causes problems we can switch it on again.
* Fix isEvaldUnfolding and isValueUnfoldingSimon Peyton Jones2022-07-251-0/+2
| | | | This fixes (1) in #21831. Easy, obviously correct.
* ghc-cabal: allow Cabal 3.8 to unbreak make buildsternenseemann2022-07-251-2/+2
| | | | | | | | | When bootstrapping GHC 9.4.*, the build will fail when configuring ghc-cabal as part of the make based build system due to this upper bound, as Cabal has been updated to a 3.8 release. Reference #21914, see especially https://gitlab.haskell.org/ghc/ghc/-/issues/21914#note_444699
* docs: Fix documentation of \casesSimon Jakobi2022-07-251-3/+3
| | | | Fixes #21902.
* Fix #21889, GHCi misbehaves with Ctrl-C on WindowsZubin Duggal2022-07-254-7/+34
| | | | | | | | | | | | | | | | | | | | | | On Windows, we create multiple levels of wrappers for GHCi which ultimately execute ghc --interactive. In order to handle console events properly, each of these wrappers must call FreeConsole() in order to hand off event processing to the child process. See #14150. In addition to this, FreeConsole must only be called from interactive processes (#13411). This commit makes two changes to fix this situation: 1. The hadrian wrappers generated using `hadrian/bindist/cwrappers/version-wrapper.c` call `FreeConsole` if the CPP flag INTERACTIVE_PROCESS is set, which is set when we are generating a wrapper for GHCi. 2. The GHCi wrapper in `driver/ghci/` calls the `ghc-$VER.exe` executable which is not wrapped rather than calling `ghc.exe` is is wrapped on windows (and usually non-interactive, so can't call `FreeConsole`: Before: ghci-$VER.exe calls ghci.exe which calls ghc.exe which calls ghc-$VER.exe After: ghci-$VER.exe calls ghci.exe which calls ghc-$VER.exe
* Fix a small buglet in tryEtaReduceSimon Peyton Jones2022-07-254-7/+24
| | | | | | | Gergo points out (#21801) that GHC.Core.Opt.Arity.tryEtaReduce was making an ill-formed cast. It didn't matter, because the subsequent guard discarded it; but still worth fixing. Spurious warnings are distracting.
* More improvements to worker/wrapperSimon Peyton Jones2022-07-2512-154/+310
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes #21888, and simplifies finaliseArgBoxities by eliminating the (recently introduced) data type FinalDecision. A delicate interaction meant that this patch commit d1c25a48154236861a413e058ea38d1b8320273f Date: Tue Jul 12 16:33:46 2022 +0100 Refactor wantToUnboxArg a bit make worker/wrapper go into an infinite loop. This patch fixes it by narrowing the handling of case (B) of Note [Boxity for bottoming functions], to deal only the arguemnts that are type variables. Only then do we drop the trimBoxity call, which is what caused the bug. I also * Added documentation of case (B), which was previously completely un-mentioned. And a regression test, T21888a, to test it. * Made unboxDeeplyDmd stop at lazy demands. It's rare anyway for a bottoming function to have a lazy argument (mainly when the data type is recursive and then we don't want to unbox deeply). Plus there is Note [No lazy, Unboxed demands in demand signature] * Refactored the Case equation for dmdAnal a bit, to do less redundant pattern matching.
* Docs: clarify ConstraintKinds infelicitysheaf2022-07-251-11/+17
| | | | | | | | | | | GHC doesn't consistently require the ConstraintKinds extension to be enabled, as it allows programs such as type families returning a constraint without this extension. MR !7784 fixes this infelicity, but breaking user programs was deemed to not be worth it, so we document it instead. Fixes #21061.
* ci: Disable (broken) perf-nofibBryan Richter2022-07-251-2/+3
| | | | See #21859
* Default implementation for mempty/(<>)Gabriella Gonzalez2022-07-252-1/+23
| | | | | | | | | | | | Approved by: https://github.com/haskell/core-libraries-committee/issues/61 This adds a default implementation for `mempty` and `(<>)` along with a matching `MINIMAL` pragma so that `Semigroup` and `Monoid` instances can be defined in terms of `sconcat` / `mconcat`. The description for each class has also been updated to include the equivalent set of laws for the `sconcat`-only / `mconcat`-only instances.
* Add DeepSubsumption09Zubin Duggal2022-07-252-0/+11
|
* Fix the interaction of operator sections and deep subsumptionSimon Peyton Jones2022-07-253-8/+50
| | | | Fixes DeepSubsumption08
* Add DeepSubsumption08Matthew Pickering2022-07-252-0/+17
|
* Add tests that -XHaskell98 and -XHaskell2010 enable DeepSubsumptionMatthew Pickering2022-07-254-1/+29
|
* Implement DeepSubsumptionSimon Peyton Jones2022-07-2529-202/+841
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This MR adds the language extension -XDeepSubsumption, implementing GHC proposal #511. This change mitigates the impact of GHC proposal The changes are highly localised, by design. See Note [Deep subsumption] in GHC.Tc.Utils.Unify. The main changes are: * Add -XDeepSubsumption, which is on by default in Haskell98 and Haskell2010, but off in Haskell2021. -XDeepSubsumption largely restores the behaviour before the "simple subsumption" change. -XDeepSubsumpition has a similar flavour as -XNoMonoLocalBinds: it makes type inference more complicated and less predictable, but it may be convenient in practice. * The main changes are in: * GHC.Tc.Utils.Unify.tcSubType, which does deep susumption and eta-expanansion * GHC.Tc.Utils.Unify.tcSkolemiseET, which does deep skolemisation * In GHC.Tc.Gen.App.tcApp we call tcSubTypeNC to match the result type. Without deep subsumption, unifyExpectedType would be sufficent. See Note [Deep subsumption] in GHC.Tc.Utils.Unify. * There are no changes to Quick Look at all. * The type of `withDict` becomes ambiguous; so add -XAllowAmbiguousTypes to GHC.Magic.Dict * I fixed a small but egregious bug in GHC.Core.FVs.varTypeTyCoFVs, where we'd forgotten to take the free vars of the multiplicity of an Id. * I also had to fix tcSplitNestedSigmaTys When I did the shallow-subsumption patch commit 2b792facab46f7cdd09d12e79499f4e0dcd4293f Date: Sun Feb 2 18:23:11 2020 +0000 Simple subsumption I changed tcSplitNestedSigmaTys to not look through function arrows any more. But that was actually an un-forced change. This function is used only in * Improving error messages in GHC.Tc.Gen.Head.addFunResCtxt * Validity checking for default methods: GHC.Tc.TyCl.checkValidClass * A couple of calls in the GHCi debugger: GHC.Runtime.Heap.Inspect All to do with validity checking and error messages. Acutally its fine to look under function arrows here, and quite useful a test DeepSubsumption05 (a test motivated by a build failure in the `lens` package) shows. The fix is easy. I added Note [tcSplitNestedSigmaTys].
* Hadrian: don't try to build "unix" on Windowssheaf2022-07-221-26/+26
|
* Add test for #21360sheaf2022-07-222-0/+23
| | | | | | | | | The way record updates are typechecked/desugared changed in MR !7981. Because we desugar in the typechecker to a simple case expression, the pattern match checker becomes able to spot the long-distance information and avoid emitting an incorrect pattern match warning. Fixes #21360
* Add test for #21871sheaf2022-07-223-0/+23
| | | | | | | This adds a test for #21871, which was fixed by the No Skolem Info rework (MR !7105). Fixes #21871
* upload_ghc_libs: Fix path to documentationBen Gamari2022-07-221-1/+1
| | | | | | | The documentation was moved in a10584e8df9b346cecf700b23187044742ce0b35 but this one occurrence was note updated. Finally closes #21164.
* Add a Note summarising GHC's UTF-8 implementationsBen Gamari2022-07-224-2/+54
| | | | | GHC has a somewhat dizzying array of UTF-8 implementations. This note describes why this is the case.
* base: Introduce GHC.Encoding.UTF8Ben Gamari2022-07-223-0/+288
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Here we copy a subset of the UTF-8 implementation living in `ghc-boot` into `base`, with the intent of dropping the former in the future. For this reason, the `ghc-boot` copy is now CPP-guarded on `MIN_VERSION_base(4,18,0)`. Naturally, we can't copy *all* of the functions defined by `ghc-boot` as some depend upon `bytestring`; we rather just copy those which only depend upon `base` and `ghc-prim`. Further consolidation? ---------------------- Currently GHC ships with at least five UTF-8 implementations: * the implementation used by GHC in `ghc-boot:GHC.Utils.Encoding`; this can be used at a number of types including `Addr#`, `ByteArray#`, `ForeignPtr`, `Ptr`, `ShortByteString`, and `ByteString`. Most of this can be removed in GHC 9.6+2, when the copies in `base` will become available to `ghc-boot`. * the copy of the `ghc-boot` definition now exported by `base:GHC.Encoding.UTF8`. This can be used at `Addr#`, `Ptr`, `ByteArray#`, and `ForeignPtr` * the decoder used by `unpackCStringUtf8#` in `ghc-prim:GHC.CString`; this is specialised at `Addr#`. * the codec used by the IO subsystem in `base:GHC.IO.Encoding.UTF8`; this is specialised at `Addr#` but, unlike the above, supports recovery in the presence of partial codepoints (since in IO contexts codepoints may be broken across buffers) * the implementation provided by the `text` library This does seem a tad silly. On the other hand, these implementations *do* materially differ from one another (e.g. in the types they support, the detail in errors they can report, and the ability to recover from partial codepoints). Consequently, it's quite unclear that further consolidate would be worthwhile.
* ghc-boot: Clean up UTF-8 codecsBen Gamari2022-07-2210-315/+363
| | | | | | | | In preparation for moving the UTF-8 codecs into `base`: * Move them to GHC.Utils.Encoding.UTF8 * Make names more consistent * Add some Haddocks
* Make the specialiser deal better with specialised methodsSimon Peyton Jones2022-07-222-187/+230
| | | | | | | | | | | This patch fixes #21848, by being more careful to update unfoldings in the type-class specialiser. See the new Note [Update unfolding after specialisation] Now that we are being so much more careful about unfoldings, it turned out that I could dispense with se_interesting, and all its tricky corners. Hooray. This fixes #21368.
* Refactored Simplify passDominik Peteler2022-07-2229-5667/+5925
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Removed references to driver from GHC.Core.LateCC, GHC.Core.Simplify namespace and GHC.Core.Opt.Stats. Also removed services from configuration records. * Renamed GHC.Core.Opt.Simplify to GHC.Core.Opt.Simplify.Iteration. * Inlined `simplifyPgm` and renamed `simplifyPgmIO` to `simplifyPgm` and moved the Simplify driver to GHC.Core.Opt.Simplify. * Moved `SimplMode` and `FloatEnable` to GHC.Core.Opt.Simplify.Env. * Added a configuration record `TopEnvConfig` for the `SimplTopEnv` environment in GHC.Core.Opt.Simplify.Monad. * Added `SimplifyOpts` and `SimplifyExprOpts`. Provide initialization functions for those in a new module GHC.Driver.Config.Core.Opt.Simplify. Also added initialization functions for `SimplMode` to that module. * Moved `CoreToDo` and friends to a new module GHC.Core.Pipeline.Types and the counting types and functions (`SimplCount` and `Tick`) to new module GHC.Core.Opt.Stats. * Added getter functions for the fields of `SimplMode`. The pedantic bottoms option and the platform are retrieved from the ArityOpts and RuleOpts and the getter functions allow us to retrieve values from `SpecEnv` without the knowledge where the data is stored exactly. * Moved the coercion optimization options from the top environment to `SimplMode`. This way the values left in the top environment are those dealing with monadic functionality, namely logging, IO related stuff and counting. Added a note "The environments of the Simplify pass". * Removed `CoreToDo` from GHC.Core.Lint and GHC.CoreToStg.Prep and got rid of `CoreDoSimplify`. Pass `SimplifyOpts` in the `CoreToDo` type instead. * Prep work before removing `InteractiveContext` from `HscEnv`.
* Make withDict opaque to the specialisersheaf2022-07-218-46/+193
| | | | | | | | | | | | | | | | | As pointed out in #21575, it is not sufficient to set withDict to inline after the typeclass specialiser, because we might inline withDict in one module and then import it in another, and we run into the same problem. This means we could still end up with incorrect runtime results because the typeclass specialiser would assume that distinct typeclass evidence terms at the same type are equal, when this is not necessarily the case when using withDict. Instead, this patch introduces a new magicId, 'nospec', which is only inlined in CorePrep. We make use of it in the definition of withDict to ensure that the typeclass specialiser does not common up distinct typeclass evidence terms. Fixes #21575
* rts/ProfHeap: Ensure new Censuses are zeroedBen Gamari2022-07-191-0/+1
| | | | | | | | When growing the Census array ProfHeap previously neglected to zero the new part of the array. Consequently `freeEra` would attempt to free random words that often looked suspiciously like pointers. Fixes #21880.
* driver: Fix implementation of -SMatthew Pickering2022-07-194-14/+27
| | | | | | | We were failing to stop before running the assembler so the object file was also created. Fixes #21869
* configure: Use AC_PATH_TOOL to detect toolsBen Gamari2022-07-191-12/+9
| | | | | | | | Previously we used AC_PATH_PROG which, as noted by #21601, does not look for tools with a target prefix, breaking cross-compilation. Fixes #21601.
* Add mapAccumM, forAccumM to Data.TraversableBoris Lykah2022-07-193-5/+80
| | | | | Approved by Core Libraries Committee in https://github.com/haskell/core-libraries-committee/issues/65#issuecomment-1186275433
* gitignore: don't ignore all aclocal.m4 filesBen Gamari2022-07-181-1/+2
| | | | | | | | | While GHC's own aclocal.m4 is generated by the aclocal tool, other packages' aclocal.m4 are committed in the repository. Previously `.gitignore` included an entry which covered *any* file named `aclocal.m4`, which lead to quite some confusion (e.g. see #21740). Fix this by modifying GHC's `.gitignore` to only cover GHC's own `aclocal.m4`.
* Allow running memInventory when the concurrent nonmoving gc is enabledTeo Camarasu2022-07-182-5/+14
| | | | | | | | If the nonmoving gc is enabled and we are using a threaded RTS, we now try to grab the collector mutex to avoid memInventory and the collection racing. Before memInventory was disabled.
* Refactor wantToUnboxArg a bitSimon Peyton Jones2022-07-184-174/+217
| | | | | | | | | | | | | | | | | | | * Rename GHC.Core.Opt.WorkWrap.Utils.wantToUnboxArg to canUnboxArg and similarly wantToUnboxResult to canUnboxResult. * Add GHC.Core.Opt.DmdAnal.wantToUnboxArg as a wrapper for the (new) GHC.Core.Opt.WorkWrap.Utils.canUnboxArg, avoiding some yukky duplication. I decided it was clearer to give it a new data type for its return type, because I nedeed the FD_RecBox case which was not otherwise readiliy expressible. * Add dcpc_args to WorkWrap.Utils.DataConPatContext for the payload * Get rid of the Unlift constructor of UnboxingDecision, eliminate two panics, and two arguments to canUnboxArg (new name). Much nicer now.
* Make SetLevels honour floatConstsSimon Peyton Jones2022-07-181-4/+4
| | | | | | | | This fix, in the definition of profitableFloat, is just for consistency. `floatConsts` should do what it says! I don't think it'll affect anything much, though.
* Inline mapAccumLMSimon Peyton Jones2022-07-181-0/+5
| | | | | | | | | This function is called in inner loops in the compiler, and it's overloaded and higher order. Best just to inline it. This popped up when I was looking at something else. I think perhaps GHC is delicately balanced on the cusp of inlining this automatically.
* Make transferPolyIdInfo work for CPRSimon Peyton Jones2022-07-182-5/+14
| | | | I don't know why this hasn't bitten us before, but it was plain wrong.
* White space only in FamInstEnvSimon Peyton Jones2022-07-181-30/+34
|
* Rule matching: Don't compute the FVs if we don't look at them.Andreas Klebinger2022-07-182-3/+17
|
* Refactor SpecConstr to use treat bindings uniformlySimon Peyton Jones2022-07-181-264/+260
| | | | | | | | | | | | | | | | | | | | | | This patch, provoked by #21457, simplifies SpecConstr by treating top-level and nested bindings uniformly (see the new scBind). * Eliminates the mysterious scTopBindEnv * Refactors scBind to handle top-level and nested definitions uniformly. * But, for now at least, continues the status quo of not doing SpecConstr for top-level non-recursive bindings. (In contrast we do specialise nested non-recursive bindings, although the original paper did not; see Note [Local let bindings].) I tried the effect of specialising top-level non-recursive bindings (which is now dead easy to switch on, unlike before) but found some regressions, so I backed off. See !8135. It's a pure refactoring. I think it'll do a better job in a few cases, but there is no regression test.
* typosEric Lindblad2022-07-1827-35/+35
|
* changelog typoEric Lindblad2022-07-181-1/+1
|
* hadrian: Add multi:<pkg> and multi targets for starting a multi-replMatthew Pickering2022-07-188-30/+138
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support to hadrian for starting a multi-repl containing all the packages which stage0 can build. In particular, there is the new user-facing command: ``` ./hadrian/ghci-multi ``` which when executed will start a multi-repl containing the `ghc` package and all it's dependencies. This is implemented by two new hadrian targets: ``` ./hadrian/build multi:<pkg> ``` Construct the arguments for a multi-repl session where the top-level package is <pkg>. For example, `./hadrian/ghci-multi` is implemented using `multi:ghc` target. There is also the `multi` command which constructs a repl for everything in stage0 which we can build.
* Fix incorrect proof of applyWhen’s propertiesAnselm Schüler2022-07-171-1/+1
|
* hadrian: Rename documentation directories for consistency with makeBen Gamari2022-07-176-16/+11
| | | | | | | * Rename `docs` to `doc` * Place pdf documentation in `doc/` instead of `doc/pdfs/` Fixes #21164.
* testsuite: Fix T11829 on Centos 7Ben Gamari2022-07-161-1/+1
| | | | | | It appears that Centos 7 has a more strict C++ compiler than most distributions since std::runtime_error is defined in <stdexcept> rather than <exception>. In T11829 we mistakenly imported the latter.
* rts/linker: Ensure that __cxa_finalize is called on code unloadBen Gamari2022-07-162-0/+25
|
* rts/linker: Clean up section kindsBen Gamari2022-07-161-2/+5
|
* rts/linker: Fix resolution of __dso_handle on DarwinBen Gamari2022-07-161-1/+1
| | | | Darwin expects a leading underscore.
* testsuite: Mark T13366Cxx as unbroken on DarwinBen Gamari2022-07-161-3/+1
|
* rts/linker/Elf: Work around GCC 6 init/fini behaviorBen Gamari2022-07-161-3/+19
| | | | | | | It appears that GCC 6t (at least on i386) fails to give init_array/fini_array sections the correct SHT_INIT_ARRAY/SHT_FINI_ARRAY section types, instead marking them as SHT_PROGBITS. This caused T20494 to fail on Debian.
* testsuite: Use system-cxx-std-lib instead of config.stdcxx_implBen Gamari2022-07-168-26/+11
|