summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Convert warnings to panicswip/more-panicsKrzysztof Gogolewski2021-08-033-6/+13
| | | | | | | | | | | This minimized module compiled with -O triggers the problem in GHC.Core.Rules: module GHC.Utils.TmpFs where import qualified Data.Map as Map cleanTempDirs :: ([String] -> a) -> Map.Map String String -> a cleanTempDirs logger ds = logger (Map.elems ds)
* Catch type-checker exceptions when splicingSimon Peyton Jones2021-08-024-4/+28
| | | | | | | | In GHC.Tc.Gen.Splice.tcTopSpliceExpr we were forgetting to catch exceptions. As a result we missed the kind error in the unsolved constraints. This patch has an easy fix, which cures #20179
* Supply missing case for '.' inShayne Fletcher2021-08-024-3/+10
|
* Disallow nonlinear fields in Template Haskell (#18378)Krzysztof Gogolewski2021-08-0211-1/+54
|
* hadrian: Drop --configure supportBen Gamari2021-08-024-93/+3
| | | | | | | | | | | | | | | Hadrian's `--configure` support has long been a point of contention. While it's convenient, it also introduces a fair bit of implementation complexity and quite a few non-trivial failure modes (see #19804, 17883, and #15948). Moreover, the feature is actively misleading to the user: `./configure` is the primary means for the user to inform the build system about the system environment and in general will require input from the user. This commits removes the feature, replacing the flag with a stub message informing the user of the deprecation. Closes #20167.
* Remove Semigroup instance for UniqDFM (#19654)Krzysztof Gogolewski2021-08-022-11/+1
| | | | | | | The (<>) operator was not associative. Fortunately, the instance is not used anywhere, except to derive another unused instance for UniqDSet.
* validate: Look for python3 executable in python detectionBen Gamari2021-08-021-4/+6
| | | | | Previously we would only look for a `python` executable, but in general we should prefer `python3` and sometimes `python` doesn't exist.
* Lookup string literals in top-level thunks (fix #16373)Sylvain Henry2021-08-024-6/+35
|
* Constant-fold unpackAppendCString (fix #20174)Sylvain Henry2021-08-026-48/+143
| | | | | | | Minor renaming: since 1ed0409010afeaa318676e351b833aea659bf93a rules get an InScopeEnv arg (containing an IdUnfoldingFun) instead of an IdUnfoldingFun directly, hence I've renamed the parameter from "id_unf" to "env" for clarity.
* Only create callstack in DEBUG buildsSylvain Henry2021-08-021-16/+16
|
* rts/OSThreads: Fix reference clock of timedWaitConditionBen Gamari2021-08-023-13/+46
| | | | | | | | | | | | | | | Previously `timedWaitCondition` assumed that timeouts were referenced against `CLOCK_MONOTONIC`. This is wrong; by default `pthread_cond_timedwait` references against `CLOCK_REALTIME`, although this can be overridden using `pthread_condattr_setclock`. Fix this and add support for using `CLOCK_MONOTONIC` whenever possible as it is more robust against system time changes and is likely cheaper to query. Unfortunately, this is complicated by the fact that older versions of Darwin did not provide `clock_gettime`, which means we also need to introduce a fallback path using `gettimeofday`. Fixes #20144.
* docs: rename the "Running a compiled program" section in the users guideAdam Sandberg Ericsson2021-08-021-3/+3
| | | | | This hopefully makes it easier to find the right section when scanning the table of contents.
* testsuite: Add test for #20137Ben Gamari2021-08-025-0/+118
|
* [AArch64/Darwin] fix packed calling conv alignmentMoritz Angermann2021-08-021-6/+38
| | | | | | Apparently we need some padding as well. Fixes #20137
* Fix spellingSylvain Henry2021-08-021-1/+1
|
* Improve documentation of openTempFile argsJulian Ospald2021-08-021-1/+3
| | | | | | | | | | https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-gettempfilenamew Specifically: > The null-terminated prefix string. The function uses up to the first > three characters of this string as the prefix of the file name. This > string must consist of characters in the OEM-defined character set.
* Add Generically (generic Semigroup, Monoid instances) and Generically1 ↵Baldur Blöndal2021-08-028-13/+225
| | | | (generic Functor, Applicative, Alternative, Eq1, Ord1 instances) to GHC.Generics.
* PrimOps: Add CAS op for all int sizesPeter Trommler2021-08-0213-12/+473
| | | | | | | | | | | PPC NCG: Implement CAS inline for 32 and 64 bit testsuite: Add tests for smaller atomic CAS X86 NCG: Catch calls to CAS C fallback Primops: Add atomicCasWord[8|16|32|64]Addr# Add tests for atomicCasWord[8|16|32|64]Addr# Add changelog entry for new primops X86 NCG: Fix MO-Cmpxchg W64 on 32-bit arch ghc-prim: 64-bit CAS C fallback on all archs
* base: Document overflow behaviour of genericLengthSimon Jakobi2021-08-021-0/+9
|
* ghc: Introduce --run modeBen Gamari2021-08-026-3/+49
| | | | | | As described in #18011, this mode provides similar functionality to the `runhaskell` command, but doesn't require that the user know the path of yet another executable, simplifying interactions with upstream tools.
* Improve preprocessor error messageShayne Fletcher2021-07-291-1/+1
|
* Reject pattern synonyms with linear types (#18806)Krzysztof Gogolewski2021-07-298-5/+36
|
* Add test for #18567Matthew Pickering2021-07-298-0/+68
| | | | Closes #18567
* UNREG: implement 64-bit mach ops for 32-bit targetsSergei Trofimovich2021-07-292-30/+63
| | | | | | | | | | | | | | | Noticed build failures like ``` ghc-stage1: panic! (the 'impossible' happened) GHC version 9.3.20210721: pprCallishMachOp_for_C: MO_x64_Ne not supported! ``` on `--tagget=hppa2.0-unknown-linux-gnu`. The change does not fix all 32-bit unreg target problems, but at least allows linking final ghc binaries. Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* compiler: Name generated locals more descriptivelyBen Gamari2021-07-294-17/+25
| | | | | | Previously `GHC.Types.Id.Make.newLocal` would name all locals `dt`, making it unnecessarily difficult to determine their origin. Noticed while looking at #19557.
* Add configure flag to enable ASSERTs in all waysDaniel Gröber2021-07-298-15/+42
| | | | | | | | Running the test suite with asserts enabled is somewhat tricky at the moment as running it with a GHC compiled the DEBUG way has some hundred failures from the start. These seem to be unrelated to assertions though. So this provides a toggle to make it easier to debug failing assertions using the test suite.
* rts: Allow building with ASSERTs on in non-DEBUG wayDaniel Gröber2021-07-293-8/+2
| | | | | | | | | | We have a couple of places where the conditions in asserts depend on code ifdefed out when DEBUG is off. I'd like to allow compiling assertions into non-DEBUG RTSen so that won't do. Currently if we remove the conditional around the definition of ASSERT() the build will not actually work due to a deadlock caused by initMutex not initializing mutexes with PTHREAD_MUTEX_ERRORCHECK because DEBUG is off.
* Delete ToDo about incorrect optimisation [skip ci]Peter Trommler2021-07-291-4/+0
| | | | | On big-endian systems a narrow after a load cannot be replaced with a narrow load.
* Port more DriverUnknownMessage into richer DriverMessage constructorsAlfredo Di Napoli2021-07-2813-74/+289
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order: * Introduce the `PsErrUnknownOptionsPragma` diagnostic message This commit changes the diagnostic emitted inside `GHC.Parser.Header.checkProcessArgsResult` from an (erroneous) and unstructured `DriverUnknownMessage` to a `PsErrUnknownOPtionsPragma`, i.e. a new data constructor of a `PsHeaderMessage`. * Add the `DriverUserDefinedRuleIgnored` diagnostic message * Add `DriverUserDefinedRuleIgnored` data constructor This commit adds (and use) a new data constructor to the `DriverMessage` type, replacing a `DriverUnknownMessage` with it. * Add and use `DriverCannotLoadInterfaceFile` constructor This commit introduces the DriverCannotLoadInterfaceFile constructor for the `DriverMessage` type and it uses it to replace and occurrence of `DriverUnknownMessage`. * Add and use the `DriverInferredSafeImport` constructor This commit adds a new `DriverInferredSafeImport` constructor to the `DriverMessage` type, and uses it in `GHC.Driver.Main` to replace one occurrence of `DriverUnknownMessage`. * Add and use `DriverCannotImportUnsafeModule` constructor This commit adds the `DriverCannotImportUnsafeModule` constructor to the `DriverMessage` type, and later using it to replace one usage of `DriverUnknownMessage` in the `GHC.Driver.Main` module. * Add and use `DriverMissingSafeHaskellMode` constructor * Add and use `DriverPackageNotTrusted` constructor * Introduce and use `DriverInferredSafeModule` constructor * Add and use `DriverMarkedTrustworthyButInferredSafe` constructor * Add and use `DriverCannotImportFromUntrustedPackage`
* Update expected stderr for affected tests, which are not under Tc directoryCarrieMY2021-07-282-4/+4
|
* Fix type check error message grammar (fixes #20122)CarrieMY2021-07-2810-55/+100
| | | | Remove trailing spaces
* Fix a subtle scoping error in simplLazyBindSimon Peyton Jones2021-07-281-10/+15
| | | | | | | | | | | | | | | | | | In the call to prepareBinding (in simplLazyBind), I had failed to extend the in-scope set with the binders from body_floats1. As as result, when eta-expanding deep inside prepareBinding we made up an eta-binder that shadowed a variable free in body1. Yikes. It's hard to trigger this bug. It showed up when I was working on !5658, and I started using the in-scope set for eta-expansion, rather than taking free variables afresh. But even then it only showed up when compiling a module in Haddock utils/haddock/haddock-api/src/Haddock/Interface/Rename.hs Sadly Haddock is compiled without Core Lint, so we ultimately got a seg-fault. Lint nailed it fast once I realised that it was off. There is some other tiny refactoring in this patch.
* Improve performance of eta expansionSimon Peyton Jones2021-07-284-73/+152
| | | | | | | | | | | | | | | | | | | | | | | | | | | Eta expansion was taking ages on T18223. This patch * Aggressively squash reflexive casts in etaInfoApp. See Note [Check for reflexive casts in eta expansion] These changes decreased compile-time allocation by 80%! * Passes the Simplifier's in-scope set to etaExpandAT, so we don't need to recompute it. (This alone saved 10% of compile time.) Annoyingly several functions in the Simplifier (namely makeTrivialBinding and friends) need to get SimplEnv, rather than SimplMode, but that is no big deal. Lots of small changes in compile-time allocation, less than 1% and in both directions. A couple of bigger changes, including the rather delicate T18223 T12425(optasm) ghc/alloc 98448216.0 97121224.0 -1.3% GOOD T18223(normal) ghc/alloc 5454689676.0 1138238008.0 -79.1% GOOD Metric Decrease: T12425 T18223
* Simplify and improve the eta expansion mechanismSimon Peyton Jones2021-07-284-154/+150
| | | | | | | | | | | Previously the eta-expansion would return lambdas interspersed with casts; now the cast is just pushed to the outside: #20153. This actually simplifies the code. I also improved mkNthCo to account for SymCo, so that mkNthCo n (SymCo (TyConAppCo tc cos)) would work well.
* Inline less logging codeSimon Peyton Jones2021-07-282-26/+47
| | | | | | | | | | | | When eyeballing calls of GHC.Core.Opt.Simplify.Monad.traceSmpl, I saw that lots of cold-path logging code was getting inlined into the main Simplifier module. So in GHC.Utils.Logger I added a NOINLINE on logDumpFile'. For logging, the "hot" path, up to and including the conditional, should be inlined, but after that we should inline as little as possible, to reduce code size in the caller.
* Make the occurrence analyser a bit stricterSimon Peyton Jones2021-07-281-29/+31
| | | | | | | | | | | | occAnalArgs and occAnalApp are very heavily used functions, so it pays to make them rather strict: fewer thunks constructed. All these thunks are ultimately evaluated anyway. This patch gives a welcome reduction compile time allocation of around 0.5% across the board. For T9961 it's a 2.2% reduction. Metric Decrease: T9961
* White space, spelling, and a tiny refactorSimon Peyton Jones2021-07-282-6/+9
| | | | No change in behaviour
* Extend the in-scope set to silence substExpr warningsSimon Peyton Jones2021-07-281-2/+12
| | | | | | substExpr warns if it finds a LocalId that isn't in the in-scope set. This patch extends the in-scope set to silence the warnings. (It has no effect on behaviour.)
* Improve postInlineUnconditionallySimon Peyton Jones2021-07-281-14/+29
| | | | | | | | | | | See Note [Use occ-anald RHS in postInlineUnconditionally]. This explains how to eliminate an extra round of simplification, which can happen if postInlineUnconditionally uses a RHS that is no occurrence-analysed. This opportunity has been there for ages; I discovered it when looking at a compile-time perf regression that happened because the opportunity wasn't exploited.
* Print out module name in "bailing out" messageSimon Peyton Jones2021-07-281-2/+2
|
* Fix smallEnoughToInlineSimon Peyton Jones2021-07-281-2/+5
| | | | | I noticed that smallEnoughToInline said "no" to UnfWhen guidance, which seems quite wrong -- those functions are particularly small.
* Functor docs: link to free theorem explanation (#19300)Krzysztof Gogolewski2021-07-281-0/+3
|
* Improve docs of bang patterns (#19068)Krzysztof Gogolewski2021-07-281-43/+62
|
* Document DerivingVia unsafety (#19786)Krzysztof Gogolewski2021-07-281-2/+3
|
* Docs: use :default: and :ghc-ticket:Krzysztof Gogolewski2021-07-288-56/+62
|
* rts: Don't rely on configuration when CLEANING=YESBen Gamari2021-07-281-0/+4
| | | | | | | | The make build system doesn't source config.mk when CLEANING=YES, consequently we previously failed to identify an appropriate adjustor implementation to use during cleaning. Fixes #20166.
* Hadrian: disable profiled RTS with no_profiled_libs flavour transformerSylvain Henry2021-07-281-1/+3
| | | | | | | Hadrian uses the RTS ways to determine which iserv programs to embed into bindist. But profiled iserv program (and any other code) can't be built without profiling libs and Hadrian fails. So we disable the profiling RTS way with the no_profiled_libs flavour transformer.
* PIC: test for cross-module referencesSylvain Henry2021-07-271-7/+4
|
* Don't abort on representation polymorphism checkKrzysztof Gogolewski2021-07-271-1/+1
| | | | | | | | | This is reverting a change introduced in linear types commit 40fa237e1da. Previously, we had to abort early, but thanks to later changes, this is no longer needed. There's no test, but the behavior should be better. The plan is to remove levity polymorphism checking in the desugarer anyway.
* Add a regression test for #17697Krzysztof Gogolewski2021-07-273-0/+15
|