summaryrefslogtreecommitdiff
path: root/compiler
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'master' into wip/binary-readerTwip/binary-readerTJosh Meredith2019-12-04149-2679/+2635
|\
| * Elf: Fix link info note generationBen Gamari2019-12-031-12/+4
| | | | | | | | | | | | | | | | | | | | | | | | Previously we would use the `.int` assembler directive to generate 32-bit words in the note section. However, `.int` is note guaranteed to produce 4-bytes; in fact, on some platforms (e.g. AArch64) it produces 8-bytes. Use the `.4bytes` directive to avoid this. Moreover, we used the `.align` directive, which is quite platform dependent. On AArch64 it appears to not even be idempotent (despite what the documentation claims). `.balign` is consequentially preferred as it offers consistent behavior across platforms.
| * Simplify uniqAwayBen Gamari2019-12-035-57/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This does two things: * Eliminate all uses of Unique.deriveUnique, which was quite easy to mis-use and extremely subtle. * Rename the previous "derived unique" notion to "local unique". This is possible because the only places where `uniqAway` can be safely used are those where local uniqueness (with respect to some InScopeSet) is sufficient. * Rework the implementation of VarEnv.uniqAway, as discussed in #17462. This should make the operation significantly more efficient than its previous iterative implementation.. Metric Decrease: T9872c T12227 T9233 T14683 T5030 T12545 hie002 Metric Increase: T9961
| * Drop Uniquable constraint for AnnTargetBen Gamari2019-12-033-30/+50
| | | | | | | | | | | | This relied on deriveUnique, which was far too subtle to be safely applied. Thankfully the instance doesn't appear to be used so let's just drop it.
| * Add constant folding rule (#16402)Sylvain Henry2019-12-031-6/+32
| | | | | | | | | | | | | | | | narrowN (x .&. m) m .&. (2^N-1) = 2^N-1 ==> narrowN x e.g. narrow16 (x .&. 0x12FFFF) ==> narrow16 x
| * Make BCO# liftedBen Gamari2019-12-032-5/+8
| | | | | | | | | | | | | | | | | | In #17424 Simon PJ noted that there is a potentially unsafe occurrence of unsafeCoerce#, coercing from an unlifted to lifted type. However, nowhere in the compiler do we assume that a BCO# is not a thunk. Moreover, in the case of a CAF the result returned by `createBCO` *will* be a thunk (as noted in [Updatable CAF BCOs]). Consequently it seems better to rather make BCO# a lifted type and rename it to BCO.
| * Add `timesInt2#` primopSylvain Henry2019-12-028-0/+65
| |
| * Simplify: Fix pretty-printing of strictnessBen Gamari2019-12-021-2/+2
| | | | | | | | | | | | A colleague recently hit the panic in Simplify.addEvals and I noticed that the message is quite unreadable due to incorrect pretty-printing. Fix this.
| * More Haddock syntax in GHC.Hs.UtilsBen Gamari2019-12-021-15/+16
| | | | | | | | As suggested by RyanGlScott in !2163.
| * Fix more typosBrian Wignall2019-12-0210-10/+10
| |
| * API Annotations: Unicode '->' on HsForallTyAlan Zimmerman2019-12-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | The code fragment type family Proxy2' ∷ ∀ k → k → Type where Proxy2' = Proxy' Generates AnnRarrow instead of AnnRarrowU for the first →. Fixes #17519
| * Convert warnings into assertionsKrzysztof Gogolewski2019-12-022-4/+4
| | | | | | | | | | Since the invariants always hold in the testsuite, we can convert them to asserts.
| * Update DisambECP-related commentsVladislav Zavialov2019-12-011-112/+36
| |
| * Simpler Semigroup instance for InsideLam and InterestingCtxtSebastian Graf2019-11-301-6/+4
| | | | | | | | | | This mirrors the definition of `(&&)` and `(||)` now, relieving the Simplifier of a marginal amount of pressure.
| * Remove HasSrcSpan (#17494)Vladislav Zavialov2019-11-3047-1582/+1427
| | | | | | | | | | Metric Decrease: haddock.compiler
| * Pass ModDetails with (partial) ModIface in HscStatusÖmer Sinan Ağacan2019-11-294-46/+51
| | | | | | | | | | | | | | | | | | | | (Partial) ModIface and ModDetails are generated at the same time, but they're passed differently: ModIface is passed in HscStatus consturctors while ModDetails is returned in a tuple. This refactors ModDetails passing so that it's passed around with ModIface in HscStatus constructors. This makes the code more consistent and hopefully easier to understand: ModIface and ModDetails are really very closely related. It makes sense to treat them the same way.
| * Factor out HsSCC/HsCoreAnn/HsTickPragma into HsPragEwip/hs-pragVladislav Zavialov2019-11-2812-177/+160
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a refactoring with no user-visible changes (except for GHC API users). Consider the HsExpr constructors that correspond to user-written pragmas: HsSCC representing {-# SCC ... #-} HsCoreAnn representing {-# CORE ... #-} HsTickPragma representing {-# GENERATED ... #-} We can factor them out into a separate datatype, HsPragE. It makes the code a bit tidier, especially in the parser. Before this patch: hpc_annot :: { Located ( (([AddAnn],SourceText),(StringLiteral,(Int,Int),(Int,Int))), ((SourceText,SourceText),(SourceText,SourceText)) ) } After this patch: prag_hpc :: { Located ([AddAnn], HsPragE GhcPs) }
| * Fix endian handling of LLVM backendStefan Schulze Frielinghaus2019-11-281-10/+4
| | | | | | | | | | Get rid of CPP macro WORDS_BIGENDIAN which is not defined anymore, and replace it by DynFlag. This fixes partially #17337.
| * Fix typos, using Wikipedia list of common typosBrian Wignall2019-11-2869-98/+98
| |
| * Reduce boolean blindness in OccInfo(OneOcc) #17482Philipp Krüger2019-11-285-56/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | * Transformed the type aliases `InterestingCxt`, `InsideLam` and `OneBranch` into data types. * Added Semigroup and Monoid instances for use in orOccInfo in OccurAnal.hs * Simplified some usage sites by using pattern matching instead of boolean algebra. Metric Increase: T12150 This increase was on a Mac-build of exactly 1%. This commit does *not* re-intruduce the asymptotic memory usage described in T12150.
| * Whitespace-sensitive bang patterns (#1087, #17162)wip/whitespace-and-lookaheadVladislav Zavialov2019-11-279-350/+364
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch implements a part of GHC Proposal #229 that covers five operators: * the bang operator (!) * the tilde operator (~) * the at operator (@) * the dollar operator ($) * the double dollar operator ($$) Based on surrounding whitespace, these operators are disambiguated into bang patterns, lazy patterns, strictness annotations, type applications, splices, and typed splices. This patch doesn't cover the (-) operator or the -Woperator-whitespace warning, which are left as future work.
| * Make warnings for TH splices opt-inSebastian Graf2019-11-275-79/+128
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In #17270 we have the pattern-match checker emit incorrect warnings. The reason for that behavior is ultimately an inconsistency in whether we treat TH splices as written by the user (`FromSource :: Origin`) or as generated code (`Generated`). This was first reported in #14838. The current solution is to TH splices as `Generated` by default and only treat them as `FromSource` when the user requests so (-fenable-th-splice-warnings). There are multiple reasons for opt-in rather than opt-out: * It's not clear that the user that compiles a splice is the author of the code that produces the warning. Think of the situation where she just splices in code from a third-party library that produces incomplete pattern matches. In this scenario, the user isn't even able to fix that warning. * Gathering information for producing the warnings (pattern-match check warnings in particular) is costly. There's no point in doing so if the user is not interested in those warnings. Fixes #17270, but not #14838, because the proper solution needs a GHC proposal extending the TH AST syntax.
| * Remove prefix arrow support for GADTs (#17211)Krzysztof Gogolewski2019-11-251-16/+0
| | | | | | | | | | | | | | This reverts the change in #9096. The specialcasing done for prefix (->) is brittle and does not support VTA, type families, type synonyms etc.
| * Fix typosBrian Wignall2019-11-2322-29/+28
| |
* | Merge branch 'master' into binary-readerTJosh Meredith2019-11-245-30/+26
|\ \ | |/
| * Packages: Don't use expectJustBen Gamari2019-11-231-5/+8
| | | | | | | | | | Throw a slightly more informative error on failure. Motivated by the errors seen in !2160.
| * Prevent -optc arguments from being duplicated in reverse order (#17471)Ryan Scott2019-11-231-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts a part of commit 7bc5d6c6578ab9d60a83b81c7cc14819afef32ba that causes all arguments to `-optc` (and `-optcxx`) to be passed twice to the C/C++ compiler, once in reverse order and then again in the correct order. While passing duplicate arguments is usually harmless it can cause breakage in this pattern, which is employed by Hackage libraries in the wild: ``` ghc Foo.hs foo.c -optc-D -optcFOO ``` As `FOO -D -D FOO` will cause compilers to error. Fixes #17471.
| * Make CorePrep.tryEtaReducePrep and CoreUtils.tryEtaReduce line upMatheus Magalhães de Alcantara2019-11-232-20/+10
| | | | | | | | | | | | | | Simon PJ says he prefers this fix to #17429 over banning eta-reduction for jumps entirely. Sure enough, this also works. Test case: simplCore/should_compile/T17429.hs
| * Take care to not eta-reduce jumps in CorePrepMatheus Magalhães de Alcantara2019-11-231-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | CorePrep already had a check to prevent it from eta-reducing Ids that respond true to hasNoBinding (foreign calls, constructors for unboxed sums and products, and Ids with compulsory unfoldings). It did not, however, consider join points as ids that 'must be saturated'. Checking whether the Id responds True to 'isJoinId' should prevent CorePrep from turning saturated jumps like the following (from #17429) into undersaturated ones: (\ eta_XP -> join { mapped_s1vo _ = lvl_s1vs } in jump mapped_s1vo eta_XP)
| * Fix typo in Note reference [skip ci]nineonine2019-11-231-6/+6
| |
* | Revert to the old binary buffer expansion behaviourJosh Meredith2019-11-231-1/+1
| |
* | Merge branch 'binary-readerT' into 'master'Josh Meredith2019-11-2232-2830/+2914
|\ \ | |/ |/|
| * Fix byte-for-byte compatibility with old binary implementationJosh Meredith2019-11-213-15/+12
| |
| * Change CPP version boundsJosh Meredith2019-10-211-9/+1
| |
| * CPP importsJosh Meredith2019-10-212-2/+17
| |
| * Fix FastString put looping and get off by one errorJosh Meredith2019-10-214-17/+25
| |
| * Abstract binary serialization behind a ReaderT newtype with pure ↵Josh Meredith2019-10-1632-2830/+2902
| | | | | | | | encode/decode interface
* | Strip parentheses in expressions contexts in error messagesVladislav Zavialov2019-11-192-1/+5
| | | | | | | | This makes error messages a tad less noisy.
* | Packages.hs: use O(n*log(n)) ordNub instead of O(n*n) nubÖmer Sinan Ağacan2019-11-191-6/+6
| | | | | | | | | | As reported in #8173 in some environments package lists can get quite long, so we use more efficient ordNub instead of nub on package lists.
* | Give seq a more precise type and remove magicBen Gamari2019-11-194-134/+106
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `GHC.Prim.seq` previously had the rather plain type: seq :: forall a b. a -> b -> b However, it also had a special typing rule to applications where `b` is not of kind `Type`. Issue #17440 noted that levity polymorphism allows us to rather give it the more precise type: seq :: forall (r :: RuntimeRep) a (b :: TYPE r). a -> b -> b This allows us to remove the special typing rule that we previously required to allow applications on unlifted arguments. T9404 contains a non-Type application of `seq` which should verify that this works as expected. Closes #17440.
* | desugar: Drop stale Note [Matching seqId]Ben Gamari2019-11-191-6/+0
| | | | | | | | | | The need for this note vanished in eae703aa60f41fd232be5478e196b661839ec3de.
* | Optimize MonadUnique instances based on IO (#16843)nineonine2019-11-1911-121/+79
| | | | | | | | | | Metric Decrease: T14683
* | Turn some comments into GHC.Hs.Utils into haddocksAndreas Klebinger2019-11-171-37/+46
| |
* | Fix random typos [skip ci]nineonine2019-11-178-9/+9
| |
* | base: Bump version to 4.14.0.0Ben Gamari2019-11-141-1/+1
| | | | | | | | | | Metric Increase: T4801
* | Only pass mod_location with HscRecomp instead of the entire ModSummaryÖmer Sinan Ağacan2019-11-133-15/+12
| | | | | | | | | | | | | | | | HscRecomp users only need the ModLocation of the module being compiled, so only pass that to users instead of the entire ModSummary Metric Decrease: T4801
* | Print name prefixly in the Outputable instance for StandaloneKindSigRyan Scott2019-11-131-1/+2
| | | | | | | | | | | | | | | | | | Issue #17461 was occurring because the `Outputable` instance for standalone kind signatures was simply calling `ppr` on the name in the kind signature, which does not add parentheses to infix names. The solution is simple: use `pprPrefixOcc` instead. Fixes #17461.
* | Ensure that coreView/tcView are able to inlineBen Gamari2019-11-1339-246/+224
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously an import cycle between Type and TyCoRep meant that several functions in TyCoRep ended up SOURCE import coreView. This is quite unfortunate as coreView is intended to be fused into a larger pattern match and not incur an extra call. Fix this with a bit of restructuring: * Move the functions in `TyCoRep` which depend upon things in `Type` into `Type` * Fold contents of `Kind` into `Type` and turn `Kind` into a simple wrapper re-exporting kind-ish things from `Type` * Clean up the redundant imports that popped up as a result Closes #17441. Metric Decrease: T4334
* | Document CmmTopInfo typeÖmer Sinan Ağacan2019-11-131-0/+2
| | | | | | | | [ci skip]
* | Fix #17405 by not checking imported equationsRichard Eisenberg2019-11-105-104/+125
| | | | | | | | | | | | | | | | | | | | | | | | | | Previously, we checked all imported type family equations for injectivity. This is very silly. Now, we check only for conflicts. Before I could even imagine doing the fix, I needed to untangle several functions that were (in my opinion) overly complicated. It's still not quite as perfect as I'd like, but it's good enough for now. Test case: typecheck/should_compile/T17405