summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Fix spelling mistakes and typosbuggymcbugfix2020-05-214-6/+6
|
* Use braces with do in `SplicePat` case for consistencyJohn Ericson2020-05-211-2/+2
|
* Tiny cleaup eta-reduce away a function argumentJohn Ericson2020-05-211-2/+2
| | | | In GHC, not in the code being compiled!
* Put `PatEnv` first in `GHC.Tc.Gen.Pat.Checker`John Ericson2020-05-211-62/+65
|
* More judiciously panic in `ts_pat`John Ericson2020-05-211-3/+3
|
* Use `Checker` for `tc_lpat` and `tc_lpats`John Ericson2020-05-211-32/+25
|
* Use `Checker` for `tc_pat`John Ericson2020-05-211-56/+58
|
* llvmGen: Consider Relocatable read-only data as not constantReferences: #18137Tuan Le2020-05-216-13/+42
|
* Update documentation for GHCi :scriptStefan Holdermans2020-05-212-3/+8
| | | | | | | | | This patch adds the fixes that allow for file names containing spaces to be passed to GHCi's ':script' command to the release notes for 8.12 and expands the user-guide documentation for ':script' by mentioning how such file names can be passed. Related to #18027.
* Allow GHCi :script file names in double quotesStefan Holdermans2020-05-213-2/+7
| | | | | | | | | | | | | | This patch updates the user interface of GHCi so that file names passed to the ':script' command can be wrapped in double quotes. For example: :script "foo bar.script" The implementation uses a modified version of 'words' that treats character sequences enclosed in double quotes as single words. Fixes #18027.
* Add extra tests for GHCi :script syntax checksStefan Holdermans2020-05-213-0/+5
| | | | | | | | The syntax for GHCi's ":script" command allows for only a single file name to be passed as an argument. This patch adds a test for the cases in which a file name is missing or multiple file names are passed. Related to #T18027.
* Allow spaces in GHCi :script file namesStefan Holdermans2020-05-215-1/+18
| | | | | | | | | | | | | | This patch updates the user interface of GHCi so that file names passed to the ':script' command may contain spaces escaped with a backslash. For example: :script foo\ bar.script The implementation uses a modified version of 'words' that does not break on escaped spaces. Fixes #18027.
* gitlab-ci: Set locale to C.UTF-8.Gleb Popov2020-05-213-2/+5
|
* NCG: Codelayout: Distinguish conditional and other branches.Andreas Klebinger2020-05-211-3/+54
| | | | | | | | | | | | | | In #18053 we ended up with a suboptimal code layout because the code layout algorithm didn't distinguish between conditional and unconditional control flow. We can completely eliminate unconditional control flow instructions by placing blocks next to each other, not so much for conditionals. In terms of implementation we simply give conditional branches less weight before computing the layout. Fixes #18053
* Refactor linear reg alloc to remember past assignments.Andreas Klebinger2020-05-2116-48/+152
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When assigning registers we now first try registers we assigned to in the past, instead of picking the "first" one. This is in extremely helpful when dealing with loops for which variables are dead for part of the loop. This is important for patterns like this: foo = arg1 loop: use(foo) ... foo = getVal() goto loop; There we: * assign foo to the register of arg1. * use foo, it's dead after this use as it's overwritten after. * do other things. * look for a register to put foo in. If we pick an arbitrary one it might differ from the register the start of the loop expect's foo to be in. To fix this we simply look for past register assignments for the given variable. If we find one and the register is free we use that register. This reduces the need for fixup blocks which match the register assignment between blocks. In the example above between the end and the head of the loop. This patch also moves branch weight estimation ahead of register allocation and adds a flag to control it (cmm-static-pred). * It means the linear allocator is more likely to assign the hotter code paths first. * If it assign these first we are: + Less likely to spill on the hot path. + Less likely to introduce fixup blocks on the hot path. These two measure combined are surprisingly effective. Based on nofib we get in the mean: * -0.9% instructions executed * -0.1% reads/writes * -0.2% code size. * -0.1% compiler allocations. * -0.9% compile time. * -0.8% runtime. Most of the benefits are simply a result of removing redundant moves and spills. Reduced compiler allocations likely are the result of less code being generated. (The added lookup is mostly non-allocating).
* nonmoving: Optimise the write barrierBen Gamari2020-05-211-21/+18
|
* Lint should say when it is checking a ruleBen Price2020-05-211-1/+5
| | | | | | | | | | | | | | | | It is rather confusing that when lint finds an error in a rule attached to a binder, it reports the error as in the RHS, not the rule: ... In the RHS of foo We add a clarifying line: ... In the RHS of foo In a rule attached to foo The implication that the rule lives inside the RHS is a bit odd, but this niggle is already present for unfoldings, whose pattern we are following.
* Explicit SpecificityGert-Jan Bottu2020-05-21124-772/+1616
| | | | | | | | | | | | | | | | | | | | Implementation for Ticket #16393. Explicit specificity allows users to manually create inferred type variables, by marking them with braces. This way, the user determines which variables can be instantiated through visible type application. The additional syntax is included in the parser, allowing users to write braces in type variable binders (type signatures, data constructors etc). This information is passed along through the renamer and verified in the type checker. The AST for type variable binders, data constructors, pattern synonyms, partial signatures and Template Haskell has been updated to include the specificity of type variables. Minor notes: - Bumps haddock submodule - Disables pattern match checking in GHC.Iface.Type with GHC 8.8
* base: Add Generic instances to various datatypes under GHC.*Fumiaki Kinoshita2020-05-215-0/+39
| | | | | | | | | | | | * GHC.Fingerprint.Types: Fingerprint * GHC.RTS.Flags: GiveGCStats, GCFlags, ConcFlags, DebugFlags, CCFlags, DoHeapProfile, ProfFlags, DoTrace, TraceFlags, TickyFlags, ParFlags and RTSFlags * GHC.Stats: RTSStats and GCStats * GHC.ByteOrder: ByteOrder * GHC.Unicode: GeneralCategory * GHC.Stack.Types: SrcLoc Metric Increase: haddock.base
* Remove duplicate Note [When to print foralls] in GHC.Core.TyCo.Pprwip/duplicate-forall-printing-notesRyan Scott2020-05-171-19/+2
| | | | | | | | | | | There are two different Notes named `[When to print foralls]`. The most up-to-date one is in `GHC.Iface.Type`, but there is a second one in `GHC.Core.TyCo.Ppr`. The latter is less up-to-date, as it was written before GHC switched over to using ifaces to pretty-print types. I decided to just remove the latter and replace it with a reference to the former. [ci skip]
* GHC.Cmm.Opt: Handle MO_XX_ConvBen Gamari2020-05-153-0/+20
| | | | | | | | | This MachOp was introduced by 2c959a1894311e59cd2fd469c1967491c1e488f3 but a wildcard match in cmmMachOpFoldM hid the fact that it wasn't handled. Ideally we would eliminate the match but this appears to be a larger task. Fixes #18141.
* DmdAnal: Improve handling of precise exceptionsSebastian Graf2020-05-1537-534/+808
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch does two things: Fix possible unsoundness in what was called the "IO hack" and implement part 2.1 of the "fixing precise exceptions" plan in https://gitlab.haskell.org/ghc/ghc/wikis/fixing-precise-exceptions, which, in combination with !2956, supersedes !3014 and !2525. **IO hack** The "IO hack" (which is a fallback to preserve precise exceptions semantics and thus soundness, rather than some smart thing that increases precision) is called `exprMayThrowPreciseException` now. I came up with two testcases exemplifying possible unsoundness (if twisted enough) in the old approach: - `T13380d`: Demonstrating unsoundness of the "IO hack" when resorting to manual state token threading and direct use of primops. More details below. - `T13380e`: Demonstrating unsoundness of the "IO hack" when we have Nested CPR. Not currently relevant, as we don't have Nested CPR yet. - `T13380f`: Demonstrating unsoundness of the "IO hack" for safe FFI calls. Basically, the IO hack assumed that precise exceptions can only be thrown from a case scrutinee of type `(# State# RealWorld, _ #)`. I couldn't come up with a program using the `IO` abstraction that violates this assumption. But it's easy to do so via manual state token threading and direct use of primops, see `T13380d`. Also similar code might be generated by Nested CPR in the (hopefully not too) distant future, see `T13380e`. Hence, we now have a more careful test in `forcesRealWorld` that passes `T13380{d,e}` (and will hopefully be robust to Nested CPR). **Precise exceptions** In #13380 and #17676 we saw that we didn't preserve precise exception semantics in demand analysis. We fixed that with minimal changes in !2956, but that was terribly unprincipled. That unprincipledness resulted in a loss of precision, which is tracked by these new test cases: - `T13380b`: Regression in dead code elimination, because !2956 was too syntactic about `raiseIO#` - `T13380c`: No need to apply the "IO hack" when the IO action may not throw a precise exception (and the existing IO hack doesn't detect that) Fixing both issues in !3014 turned out to be too complicated and had the potential to regress in the future. Hence we decided to only fix `T13380b` and augment the `Divergence` lattice with a new middle-layer element, `ExnOrDiv`, which means either `Diverges` (, throws an imprecise exception) or throws a *precise* exception. See the wiki page on Step 2.1 for more implementational details: https://gitlab.haskell.org/ghc/ghc/wikis/fixing-precise-exceptions#dead-code-elimination-for-raiseio-with-isdeadenddiv-introducing-exnordiv-step-21
* IdInfo: Add reference to bitfield-packing ticketBen Gamari2020-05-141-1/+1
|
* Use Data.IntMap.disjointSimon Jakobi2020-05-1416-34/+29
| | | | | | | | | Data.IntMap gained a dedicated `disjoint` function in containers-0.6.2.1. This patch applies this function where appropriate in hopes of modest compiler performance improvements. Closes #16806.
* Improve some folds over Uniq[D]FMSimon Jakobi2020-05-1421-86/+134
| | | | | | | | | | | | | | | * Replace some non-deterministic lazy folds with strict folds. * Replace some O(n log n) folds in deterministic order with O(n) non-deterministic folds. * Replace some folds with set-operations on the underlying IntMaps. This reduces max residency when compiling `nofib/spectral/simple/Main.hs` with -O0 by about 1%. Maximum residency when compiling Cabal also seems reduced on the order of 3-9%.
* hadrian: Tell testsuite driver about LLVM availabilityBen Gamari2020-05-131-1/+2
| | | | | | This reflects the logic present in the Make build system into Hadrian. Fixes #18167.
* Ensure that printMinimalImports closes handleBen Gamari2020-05-131-3/+2
| | | | Fixes #18166.
* Handle single unused importJeff Happily2020-05-135-5/+12
|
* GHCi: Add link to the user's guide in help messageTakenobu Tani2020-05-131-0/+4
| | | | | | | This commit adds a link to the user's guide in ghci's `:help` message. Newcomers could easily reach to details of ghci.
* Tweak man page for ghc commandTakenobu Tani2020-05-132-1/+6
| | | | | | | | | | This commit updates the ghc command's man page as followings: * Enable `man_show_urls` to show URL addresses in the `DESCRIPTION` section of ghc.rst, because sphinx currently removes hyperlinks for man pages. * Add a `SEE ALSO` section to point to the GHC homepage
* Document (->) using inferred quantification for its runtime representations.Baldur Blöndal2020-05-134-6/+26
| | | | Fixes #18142.
* fix(documentation): Fix the RST links to GHC.PrimHécate2020-05-133-5/+4
|
* Factor out HsPatSigType for pat sigs/RULE term sigs (#16762)Ryan Scott2020-05-1318-109/+246
| | | | | | | | | | | | | | | This implements chunks (2) and (3) of https://gitlab.haskell.org/ghc/ghc/issues/16762#note_270170. Namely, it introduces a dedicated `HsPatSigType` AST type, which represents the types that can appear in pattern signatures and term-level `RULE` binders. Previously, these were represented with `LHsSigWcType`. Although `LHsSigWcType` is isomorphic to `HsPatSigType`, the intended semantics of the two types are slightly different, as evidenced by the fact that they have different code paths in the renamer and typechecker. See also the new `Note [Pattern signature binders and scoping]` in `GHC.Hs.Types`.
* Don't reload environment files on every setSessionDynFlagsArtem Pelenitsyn2020-05-136-3/+34
| | | | | | | | Makes `interpretPackageEnv` (which loads envirinment files) a part of `parseDynamicFlags` (parsing command-line arguments, which is typically done once) instead of `setSessionDynFlags` (which is typically called several times). Making several (transitive) calls to `interpretPackageEnv`, as before, caused #18125 #16318, which should be fixed now.
* hadrian: add a --freeze2 option to freeze stage 1 and 2Alp Mestanogullari2020-05-133-4/+20
|
* Predicate, Equivalence derive via `.. -> a -> All'Baldur Blöndal2020-05-131-36/+132
|
* doc: Reformulate the opening paragraph of Ch. 4 in User's guideIvan-Yudin2020-05-131-9/+11
| | | | | | | | | Removes mentioning of Hugs (it is not helpful for new users anymore). Changes the wording for the rest of the paragraph. Fixes #18132.
* testsuite: Add testcase for #18129Ben Gamari2020-05-132-0/+53
|
* testsuite: Print sign of performance changesBen Gamari2020-05-131-2/+2
| | | | | Executes the minor formatting change in the tabulated performance changes suggested in #18135.
* users-guide: Add discussion of shared object namingBen Gamari2020-05-132-1/+10
| | | | Fixes #18074.
* CprAnal: Don't attach CPR sigs to expandable bindings (#18154)Sebastian Graf2020-05-1329-111/+124
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead, look through expandable unfoldings in `cprTransform`. See the new Note [CPR for expandable unfoldings]: ``` Long static data structures (whether top-level or not) like xs = x1 : xs1 xs1 = x2 : xs2 xs2 = x3 : xs3 should not get CPR signatures, because they * Never get WW'd, so their CPR signature should be irrelevant after analysis (in fact the signature might even be harmful for that reason) * Would need to be inlined/expanded to see their constructed product * Recording CPR on them blows up interface file sizes and is redundant with their unfolding. In case of Nested CPR, this blow-up can be quadratic! But we can't just stop giving DataCon application bindings the CPR property, for example fac 0 = 1 fac n = n * fac (n-1) fac certainly has the CPR property and should be WW'd! But FloatOut will transform the first clause to lvl = 1 fac 0 = lvl If lvl doesn't have the CPR property, fac won't either. But lvl doesn't have a CPR signature to extrapolate into a CPR transformer ('cprTransform'). So instead we keep on cprAnal'ing through *expandable* unfoldings for these arity 0 bindings via 'cprExpandUnfolding_maybe'. In practice, GHC generates a lot of (nested) TyCon and KindRep bindings, one for each data declaration. It's wasteful to attach CPR signatures to each of them (and intractable in case of Nested CPR). ``` Fixes #18154.
* fix printf warning when using with ghc with clang on mingwEmeka Nkurumeh2020-05-131-1/+1
|
* Add few cleanups of the CAF logicBen Gamari2020-05-135-13/+23
| | | | | Give the NameSet of non-CAFfy names a proper newtype to distinguish it from all of the other NameSets floating about.
* docs: Add examples for Data.Semigroup.Arg{Min,Max}Simon Jakobi2020-05-131-0/+7
| | | | Context: #17153
* get-win32-tarballs: Improve diagnostics outputBen Gamari2020-05-131-2/+8
|
* get-win32-tarballs: Fix base URLBen Gamari2020-05-131-1/+0
| | | | Revert a change previously made for testing purposes.
* Pack some of IdInfo fields into a bit fieldÖmer Sinan Ağacan2020-05-131-25/+117
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reduces residency of compiler quite a bit on some programs. Example stats when building T10370: Before: 2,871,242,832 bytes allocated in the heap 4,693,328,008 bytes copied during GC 33,941,448 bytes maximum residency (276 sample(s)) 375,976 bytes maximum slop 83 MiB total memory in use (0 MB lost due to fragmentation) After: 2,858,897,344 bytes allocated in the heap 4,629,255,440 bytes copied during GC 32,616,624 bytes maximum residency (278 sample(s)) 314,400 bytes maximum slop 80 MiB total memory in use (0 MB lost due to fragmentation) So -3.9% residency, -1.3% bytes copied and -0.4% allocations. Fixes #17497 Metric Decrease: T9233 T9675
* rts/CNF: Fix fixup comparison functionBen Gamari2020-05-134-2/+31
| | | | | | | Previously we would implicitly convert the difference between two words to an int, resulting in an integer overflow on 64-bit machines. Fixes #16992
* rts: Make non-existent linker search path merely a warningBen Gamari2020-05-091-2/+2
| | | | | | | | As noted in #18105, previously this resulted in a rather intrusive error message. This is in contrast to the general expectation that search paths are merely places to look, not places that must exist. Fixes #18105.
* Fix unboxed-sums GC ptr-slot rubbish value (#17791)Sylvain Henry2020-05-0914-42/+135
| | | | | | | This patch allows boot libraries to use unboxed sums without implicitly depending on `base` package because of `absentSumFieldError`. See updated Note [aBSENT_SUM_FIELD_ERROR_ID] in GHC.Core.Make