summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Improve handling of data type return kindswip/T18300Simon Peyton Jones2020-07-0328-350/+814
| | | | | | | | | | | | | | | | | | Following a long conversation with Richard, this patch tidies up the handling of return kinds for data/newtype declarations (vanilla, family, and instance). I have substantially edited the Notes in TyCl, so they would bear careful reading. Fixes #18300, #18357 In GHC.Tc.Instance.Family.newFamInst we were checking some Lint-like properties with ASSSERT. Instead Richard and I have added a proper linter for axioms, and called it from lintGblEnv, which in turn is called in tcRnModuleTcRnM New tests (T18300, T18357) cause an ASSERT failure in HEAD.
* LLVM: support R9 and R10 registersSylvain Henry2020-07-031-0/+2
| | | | | | d535ef006d85dbdb7cda2b09c5bc35cb80108909 allowed the use of up to 10 vanilla registers but didn't update LLVM backend to support them. This patch fixes it.
* Mention flags that are not enabled by -Wall (#18372)Valery Tolstov2020-07-031-1/+5
| | | | | * Mention missing flags that are not actually enabled by -Wall (docs/users_guide/using-warnings.rst) * Additionally remove -Wmissing-monadfail-instances from the list of flags enabled by -Wcompat, as it is not the case since 8.8
* rts/ProfHeap: Free old allocations when reinitialising CensusesBen Gamari2020-07-031-0/+15
| | | | | | | | Previously when not LDV profiling we would repeatedly reinitialise `censuses[0]` with `initEra`. This failed to free the `Arena` and `HashTable` from the old census, resulting in a memory leak. Fixes #18348.
* rts/ProfHeap: Only allocate the Censuses that we needBen Gamari2020-07-031-1/+2
| | | | | | When not LDV profiling there is no reason to allocate 32 Censuses; one will do. This is a very small memory footprint optimisation, but it comes for free.
* Replace Opt_SccProfilingOn flag with sccProfilingEnabled helper functionSylvain Henry2020-07-0219-44/+54
| | | | | | | | | | | SCC profiling was enabled in a convoluted way: if WayProf was enabled, Opt_SccProfilingOn general flag was set (in `GHC.Driver.Ways.wayGeneralFlags`), and then this flag was queried in various places. There is no need to go via general flags, so this patch defines a `sccProfilingEnabled :: DynFlags -> Bool` helper function that just checks whether WayProf is enabled.
* No need for CURSES_INCLUDE_DIRSGabor Greif2020-07-021-1/+0
| | | This is a leftover from ef63ff27251a20ff11e58c9303677fa31e609a88
* NCG: correctly handle addresses with huge offsets (#15570)Sylvain Henry2020-07-023-66/+100
| | | | | | | | | | | | | | | | | | | Before this patch we could generate addresses of this form: movzbl cP0_str+-9223372036854775808,%eax The linker can't handle them because the offset is too large: ld.lld: error: Main.o:(.text+0xB3): relocation R_X86_64_32S out of range: -9223372036852653050 is not in [-2147483648, 2147483647] With this patch we detect those cases and generate: movq $-9223372036854775808,%rax addq $cP0_str,%rax movzbl (%rax),%eax I've also refactored `getAmode` a little bit to make it easier to understand and to trace.
* Hadrian: fix PowerPC64le support (#17601)Sylvain Henry2020-07-021-3/+4
| | | | [ci skip]
* Bump ghc-prim version to 0.7.0Ryan Scott2020-07-0278-85/+85
| | | | Fixes #18279. Bumps the `text` submodule.
* T16012: Be verbose on failure.Andreas Klebinger2020-07-022-2/+6
|
* Desugar quoted uses of DerivingVia and expression type signatures properlyRyan Scott2020-07-013-100/+146
| | | | | | | | | | | | | | | | | | | | | | | | | The way that `GHC.HsToCore.Quote` desugared quoted `via` types (e.g., `deriving via forall a. [a] instance Eq a => Eq (List a)`) and explicit type annotations in signatures (e.g., `f = id @a :: forall a. a -> a`) was completely wrong, as it did not implement the scoping guidelines laid out in `Note [Scoped type variables in bindings]`. This is easily fixed. While I was in town, I did some minor cleanup of related Notes: * `Note [Scoped type variables in bindings]` and `Note [Scoped type variables in class and instance declarations]` say very nearly the same thing. I decided to just consolidate the two Notes into `Note [Scoped type variables in quotes]`. * `Note [Don't quantify implicit type variables in quotes]` is somewhat outdated, as it predates GHC 8.10, where the `forall`-or-nothing rule requires kind variables to be explicitly quantified in the presence of an explicit `forall`. As a result, the running example in that Note doesn't even compile. I have changed the example to something simpler that illustrates the same point that the original Note was making. Fixes #18388.
* Add most common return values for `os` and `arch`Hécate2020-07-012-2/+47
|
* Improve debug tracing for substitutionSimon Peyton Jones2020-07-018-58/+59
| | | | | | | | | | | | This patch improves debug tracing a bit (#18395) * Remove the ancient SDoc argument to substitution, replacing it with a HasDebugCallStack constraint. The latter does the same job (indicate the call site) but much better. * Add HasDebugCallStack to simpleOptExpr, exprIsConApp_maybe I needed this to help nail the lookupIdSubst panic in #18326, #17784
* #17169: Clarify Fixed's Enum instance.Martin Handley2020-07-011-0/+58
|
* Implement -XLexicalNegation (GHC Proposal #229)Vladislav Zavialov2020-07-0116-14/+229
| | | | | | | | This patch introduces a new extension, -XLexicalNegation, which detects whether the minus sign stands for negation or subtraction using the whitespace-based rules described in GHC Proposal #229. Updates haddock submodule.
* Add missing Ix instances for tuples of size 6 through 15 (#16643)Joshua Price2020-06-306-3/+456
|
* Update ssh keys in CI performance metrics upload scriptDavid Eichmann2020-06-301-2/+3
|
* Add ghc-bignum to 8.12 release notesSylvain Henry2020-06-301-0/+23
|
* Reject nested foralls/contexts in instance types more consistentlyRyan Scott2020-06-3023-136/+581
| | | | | | | | | | | | | | | | | | | | | | | | | | | GHC is very wishy-washy about rejecting instance declarations with nested `forall`s or contexts that are surrounded by outermost parentheses. This can even lead to some strange interactions with `ScopedTypeVariables`, as demonstrated in #18240. This patch makes GHC more consistently reject instance types with nested `forall`s/contexts so as to prevent these strange interactions. On the implementation side, this patch tweaks `splitLHsInstDeclTy` and `getLHsInstDeclHead` to not look through parentheses, which can be semantically significant. I've added a `Note [No nested foralls or contexts in instance types]` in `GHC.Hs.Type` to explain why. This also introduces a `no_nested_foralls_contexts_err` function in `GHC.Rename.HsType` to catch nested `forall`s/contexts in instance types. This function is now used in `rnClsInstDecl` (for ordinary instance declarations) and `rnSrcDerivDecl` (for standalone `deriving` declarations), the latter of which fixes #18271. On the documentation side, this adds a new "Formal syntax for instance declaration types" section to the GHC User's Guide that presents a BNF-style grammar for what is and isn't allowed in instance types. Fixes #18240. Fixes #18271.
* Fix a typo in LintSimon Peyton Jones2020-06-283-7/+13
| | | | | | | This simple error in GHC.Core.Litn.lintJoinLams meant that Lint reported bogus errors. Fixes #18399
* Add integer-gmp's ghc.mk and GNUmakefile to .gitignoreRyan Scott2020-06-282-5/+2
|
* Fix duplicated words and typos in comments and user guideJan Hrček2020-06-2878-104/+104
|
* Use NHsCoreTy to embed types into GND-generated codeRyan Scott2020-06-2810-225/+148
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `GeneralizedNewtypeDeriving` is in the unique situation where it must produce an `LHsType GhcPs` from a Core `Type`. Historically, this was done with the `typeToLHsType` function, which walked over the entire `Type` and attempted to construct an `LHsType` with the same overall structure. `typeToLHsType` is quite complicated, however, and has been the subject of numerous bugs over the years (e.g., #14579). Luckily, there is an easier way to accomplish the same thing: the `XHsType` constructor of `HsType`. `XHsType` bundles an `NHsCoreTy`, which allows embedding a Core `Type` directly into an `HsType`, avoiding the need to laboriously convert from one to another (as `typeToLHsType` did). Moreover, renaming and typechecking an `XHsType` is simple, since one doesn't need to do anything to a Core `Type`... ...well, almost. For the reasons described in `Note [Typechecking NHsCoreTys]` in `GHC.Tc.Gen.HsType`, we must apply a substitution that we build from the local `tcl_env` type environment. But that's a relatively modest price to pay. Now that `GeneralizedNewtypeDeriving` uses `NHsCoreTy`, the `typeToLHsType` function no longer has any uses in GHC, so this patch rips it out. Some additional tweaks to `hsTypeNeedsParens` were necessary to make the new `-ddump-deriv` output correctly parenthesized, but other than that, this patch is quite straightforward. This is a mostly internal refactoring, although it is likely that `GeneralizedNewtypeDeriving`-generated code will now need fewer language extensions in certain situations than it did before.
* RTS: Refactor Haskell-C glue for PPC 64-bitPeter Trommler2020-06-282-186/+85
| | | | | | | | | | | | | | Make sure the stack is 16 byte aligned even when reserved stack bytes are not a multiple of 16 bytes. Avoid saving r2 (TOC). On ELF v1 the function descriptor of StgReturn has the same TOC as StgRun, on ELF v2 the TOC is recomputed in the function prologue. Use the ABI provided functions to save clobbered GPRs and FPRs. Improve comments. Describe what the stack looks like and how it relates to the respective ABIs.
* Don't generalize when typechecking a tuple sectionKrzysztof Gogolewski2020-06-276-35/+19
| | | | The code is simpler and cleaner.
* DynFlags: don't store buildTagSylvain Henry2020-06-279-43/+40
| | | | | | | | | | | | `DynFlags.buildTag` was a field created from the set of Ways in `DynFlags.ways`. It had to be kept in sync with `DynFlags.ways` which was fragile. We want to avoid global state like this (#17957). Moreover in #14335 we also want to support loading units with different ways: target units would still use `DynFlags.ways` but plugins would use `GHC.Driver.Ways.hostFullWays`. To avoid having to deal both with build tag and with ways, we recompute the buildTag on-the-fly (should be pretty cheap) and we remove `DynFlags.buildTag` field.
* Better loop detection in findTypeShapeSimon Peyton Jones2020-06-273-34/+41
| | | | | | | Andreas pointed out, in !3466, that my fix for #18304 was not quite right. This patch fixes it properly, by having just one RecTcChecker rather than (implicitly) two nested ones, in findTypeShape.
* Fix ghc-bignum exceptionsSylvain Henry2020-06-2717-126/+255
| | | | | | | | | | | | | | | We must ensure that exceptions are not simplified. Previously we used: case raiseDivZero of _ -> 0## -- dummyValue But it was wrong because the evaluation of `raiseDivZero` was removed and the dummy value was directly returned. See new Note [ghc-bignum exceptions]. I've also removed the exception triggering primops which were fragile. We don't need them to be primops, we can have them exported by ghc-prim. I've also added a test for #18359 which triggered this patch.
* ghc-bignum: fix division by zero (#18359)Sylvain Henry2020-06-271-1/+1
|
* Revamp the treatment of auxiliary bindings for derived instancesRyan Scott2020-06-2712-349/+668
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This started as a simple fix for #18321 that organically grew into a much more sweeping refactor of how auxiliary bindings for derived instances are handled. I have rewritten `Note [Auxiliary binders]` in `GHC.Tc.Deriv.Generate` to explain all of the moving parts, but the highlights are: * Previously, the OccName of each auxiliary binding would be given a suffix containing a hash of its package name, module name, and parent data type to avoid name clashes. This was needlessly complicated, so we take the more direct approach of generating `Exact` `RdrName`s for each auxiliary binding with the same `OccName`, but using an underlying `System` `Name` with a fresh `Unique` for each binding. Unlike hashes, allocating new `Unique`s does not require any cleverness and avoid name clashes all the same... * ...speaking of which, in order to convince the renamer that multiple auxiliary bindings with the same `OccName` (but different `Unique`s) are kosher, we now use `rnLocalValBindsLHS` instead of `rnTopBindsLHS` to rename auxiliary bindings. Again, see `Note [Auxiliary binders]` for the full story. * I have removed the `DerivHsBind` constructor for `DerivStuff`—which was only used for `Data.Data`-related auxiliary bindings—and refactored `gen_Data_binds` to use `DerivAuxBind` instead. This brings the treatment of `Data.Data`-related auxiliary bindings in line with every other form of auxiliary binding. Fixes #18321.
* Implement the proposed -XQualifiedDo extensionMatthias Pall Gissurarson2020-06-2669-203/+1083
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Co-authored-by: Facundo Domínguez <facundo.dominguez@tweag.io> QualifiedDo is implemented using the same placeholders for operation names in the AST that were devised for RebindableSyntax. Whenever the renamer checks which names to use for do syntax, it first checks if the do block is qualified (e.g. M.do { stmts }), in which case it searches for qualified names in the module M. This allows users to write {-# LANGUAGE QualifiedDo #-} import qualified SomeModule as M f x = M.do -- desugars to: y <- M.return x -- M.return x M.>>= \y -> M.return y -- M.return y M.>> M.return y -- M.return y See Note [QualifiedDo] and the users' guide for more details. Issue #18214 Proposal: https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0216-qualified-do.rst Since we change the constructors `ITdo` and `ITmdo` to carry the new module name, we need to bump the haddock submodule to account or the new shape of these constructors.
* GHC.Core.Unify: Make UM actions one-shot by defaultwip/oneshot-unifySebastian Graf2020-06-251-3/+83
| | | | | | | | | | | | | This MR makes the UM monad in GHC.Core.Unify into a one-shot monad. See the long Note [The one-shot state monad trick]. See also #18202 and !3309, which applies this to all Reader/State-like monads in GHC for compile-time perf improvements. The pattern used here enables something similar to the state-hack, but is applicable to user-defined monads, not just `IO`. Metric Decrease 'runtime/bytes allocated' (test_env='i386-linux-deb9'): haddock.Cabal
* RTS: avoid overflow on 32-bit arch (#18375)Sylvain Henry2020-06-254-7/+7
| | | | | | | | | | | We're now correctly computing allocated bytes on 32-bit arch, so we get huge increases. Metric Increase: haddock.Cabal haddock.base haddock.compiler space_leak_001
* rts/Hash: Simplify freeing of HashListChunksBen Gamari2020-06-251-25/+38
| | | | | | | | | | | | | | | | While looking at #18348 I noticed that the treatment of HashLists are a bit more complex than necessary (which lead to some initial confusion on my part). Specifically, we allocate HashLists in chunks. Each chunk allocation makes two allocations: one for the chunk itself and one for a HashListChunk to link together the chunks for the purposes of freeing. Simplify this (and hopefully make the relationship between these clearer) but allocating the HashLists and HashListChunk in a single malloc. This will both make the implementation easier to follow and reduce C heap fragmentation. Note that even after this patch we fail to bound the size of the free HashList pool. However, this is a separate bug.
* Enable maxBound checks for OverloadedLists (Fixes #18172)Roland Senn2020-06-257-27/+162
| | | | | | | | | | | | | Consider the Literal `[256] :: [Data.Word.Word8]` When the `OverloadedLists` extension is not active, then the `ol_ext` field in the `OverLitTc` record that is passed to the function `getIntegralLit` contains the type `Word8`. This is a simple type, and we can use its type constructor immediately for the `warnAboutOverflowedLiterals` function. When the `OverloadedLists` extension is active, then the `ol_ext` field contains the type family `Item [Word8]`. The function `nomaliseType` is used to convert it to the needed type `Word8`.
* test suite: add reproducer for #17516Artem Pelenitsyn2020-06-253-0/+478
|
* Add MonadZip and MonadFix instances for ComplexOleg Grenrus2020-06-252-0/+12
| | | | | | | These instances are taken from https://hackage.haskell.org/package/linear-1.21/docs/Linear-Instances.html They are the unique possible, so let they be in `base`.
* Clean up haddock hyperlinks of GHC.* (part2)Takenobu Tani2020-06-2557-143/+146
| | | | | | | | | | | | | | | | | | | | | | | | | This updates haddock comments only. This patch focuses to update for hyperlinks in GHC API's haddock comments, because broken links especially discourage newcomers. This includes the following hierarchies: - GHC.Iface.* - GHC.Llvm.* - GHC.Rename.* - GHC.Tc.* - GHC.HsToCore.* - GHC.StgToCmm.* - GHC.CmmToAsm.* - GHC.Runtime.* - GHC.Unit.* - GHC.Utils.* - GHC.SysTools.*
* Clean up haddock hyperlinks of GHC.* (part1)Takenobu Tani2020-06-2565-537/+542
| | | | | | | | | | | | | | | | | | | This updates haddock comments only. This patch focuses to update for hyperlinks in GHC API's haddock comments, because broken links especially discourage newcomers. This includes the following hierarchies: - GHC.Hs.* - GHC.Core.* - GHC.Stg.* - GHC.Cmm.* - GHC.Types.* - GHC.Data.* - GHC.Builtin.* - GHC.Parser.* - GHC.Driver.* - GHC top
* Export everything from HsToCore.Zubin Duggal2020-06-252-2/+7
| | | | | | | | This lets us reuse these functions in haddock, avoiding synchronization bugs. Also fixed some divergences with haddock in that file Updates haddock submodule
* Export readBinIface_Oleg Grenrus2020-06-251-0/+2
|
* add examples to Data.TraversableAdam Wespiser2020-06-251-0/+108
|
* Expunge GhcTcIdSimon Peyton Jones2020-06-2521-162/+160
| | | | | | | | | | | | | GHC.Hs.Extension had type GhcPs = GhcPass 'Parsed type GhcRn = GhcPass 'Renamed type GhcTc = GhcPass 'Typechecked type GhcTcId = GhcTc The last of these, GhcTcId, is a vestige of the past. This patch expunges it from GHC.
* hadrian/make: Detect makeindexBen Gamari2020-06-257-9/+21
| | | | | | Previously we would simply assume that makeindex was available. Now we correctly detect it in `configure` and respect this conclusion in hadrian and make.
* make: Respect XELATEX variableBen Gamari2020-06-251-5/+5
| | | | | Previously we simply ignored the XELATEX variable when building PDF documentation.
* In `:break ident` allow out of scope and nested identifiers (Fix #3000)Roland Senn2020-06-2513-103/+337
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes the bug and implements the feature request of #3000. 1. If `Module` is a real module name and `identifier` a name of a top-level function in `Module` then `:break Module.identifer` works also for an `identifier` that is out of scope. 2. Extend the syntax for `:break identifier` to: :break [ModQual.]topLevelIdent[.nestedIdent]...[.nestedIdent] `ModQual` is optional and is either the effective name of a module or the local alias of a qualified import statement. `topLevelIdent` is the name of a top level function in the module referenced by `ModQual`. `nestedIdent` is optional and the name of a function nested in a let or where clause inside the previously mentioned function `nestedIdent` or `topLevelIdent`. If `ModQual` is a module name, then `topLevelIdent` can be any top level identifier in this module. If `ModQual` is missing or a local alias of a qualified import, then `topLevelIdent` must be in scope. Breakpoints can be set on arbitrarily deeply nested functions, but the whole chain of nested function names must be specified. 3. To support the new functionality rewrite the code to tab complete `:break`.
* Enable large address space optimization on windows.Andreas Klebinger2020-06-253-6/+21
| | | | | | | | | | | Starting with Win 8.1/Server 2012 windows no longer preallocates page tables for reserverd memory eagerly, which prevented us from using this approach in the past. We also try to allocate the heap high in the memory space. Hopefully this makes it easier to allocate things in the low 4GB of memory that need to be there. Like jump islands for the linker.
* Add missing entry to freeNamesItem (#18369)Krzysztof Gogolewski2020-06-233-2/+14
|
* Fix invalid printf formatSylvain Henry2020-06-231-1/+1
|