summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Use the right InScopeSet for findBestwip/T20200Simon Peyton Jones2021-08-153-22/+30
| | | | | | | | | This is the right thing to do, easy to do, and fixes a second not-in-scope crash in #20200 (see !6302) The problem occurs in the findBest test, which compares two RULES. Repro case in simplCore/should_compile/T20200a
* Fix lookupIdSubst call during RULE matchingKrzysztof Gogolewski2021-08-154-12/+27
| | | | | | | | | | | As #20200 showed, there was a call to lookupIdSubst during RULE matching, where the variable being looked up wasn't in the InScopeSet. This patch fixes the problem at source, by dealing separately with nested and non-nested binders. As a result we can change the trace call in lookupIdSubst to a proper panic -- if it happens, we really want to know.
* Update TcPlugin_RewritePerf performance testsheaf2021-08-155-29/+21
| | | | | | | | | | | | This test exhibited inconsistent behaviour, with different CI runs having a 98% decrease in allocations. This commit addresses this problem by ensuring that we measure allocations of the whole collection of modules used in the test. ------------------------- Metric Increase: TcPlugin_RewritePerf -------------------------
* Detect TypeError when checking for insolubilitysheaf2021-08-1515-75/+265
| | | | | | | | | | | | | | | We detect insoluble Givens by making getInertInsols take into account TypeError constraints, on top of insoluble equalities such as Int ~ Bool (which it already took into account). This allows pattern matches with insoluble contexts to be reported as redundant (tyOracle calls tcCheckGivens which calls getInertInsols). As a bonus, we get to remove a workaround in Data.Typeable.Internal: we can directly use a NotApplication type family, as opposed to needing to cook up an insoluble equality constraint. Fixes #11503 #14141 #16377 #20180
* hadrian: Also produce versioned wrapper scriptsMatthew Pickering2021-08-132-34/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since !6133 we are more consistent about producing versioned executables but we still didn't produce versioned wrappers. This patch adds the corresponding versioned wrappers to match the versioned executables in the relocatable bindist. I also fixed the ghci wrapper so that it wasn't overwritten during installation. The final bindir looks like: ``` lrwxrwxrwx 1 matt users 16 Aug 12 11:56 ghc -> ghc-9.3.20210809 -rwxr-xr-x 1 matt users 674 Aug 12 11:56 ghc-9.3.20210809 lrwxrwxrwx 1 matt users 17 Aug 12 11:56 ghci -> ghci-9.3.20210809 -rwxr-xr-x 1 matt users 708 Aug 12 11:56 ghci-9.3.20210809 lrwxrwxrwx 1 matt users 20 Aug 12 11:56 ghc-pkg -> ghc-pkg-9.3.20210809 -rwxr-xr-x 1 matt users 734 Aug 12 11:56 ghc-pkg-9.3.20210809 lrwxrwxrwx 1 matt users 14 Aug 12 11:56 haddock -> haddock-2.24.0 -rwxr-xr-x 1 matt users 682 Aug 12 11:56 haddock-2.24.0 lrwxrwxrwx 1 matt users 9 Aug 12 11:56 hp2ps -> hp2ps-0.1 -rwxr-xr-x 1 matt users 648 Aug 12 11:56 hp2ps-0.1 lrwxrwxrwx 1 matt users 8 Aug 12 11:56 hpc -> hpc-0.68 -rwxr-xr-x 1 matt users 646 Aug 12 11:56 hpc-0.68 lrwxrwxrwx 1 matt users 13 Aug 12 11:56 hsc2hs -> hsc2hs-0.68.8 -rwxr-xr-x 1 matt users 1.4K Aug 12 11:56 hsc2hs-0.68.8 lrwxrwxrwx 1 matt users 19 Aug 12 11:56 runghc -> runghc-9.3.20210809 -rwxr-xr-x 1 matt users 685 Aug 12 11:56 runghc-9.3.20210809 ``` Fixes #20225
* Create absolute symlink for test executablesMatthew Pickering2021-08-131-1/+3
| | | | | | | This is necessary because the symlink needs to be created between two arbritary filepaths in the build tree, it's hard to compute how to get between them relatively. As this symlink doesn't end up in a bindist then it's fine for it to be absolute.
* Revert "hadrian: Make copyFileLinked a bit more robust"Matthew Pickering2021-08-132-14/+11
| | | | This reverts commit d45e3cda669c5822aa213d42bf7f7c551b9d1bbf.
* Add rewriting to typechecking pluginssheaf2021-08-1324-195/+851
| | | | | | | | | | | | | | | | | | | | | | | | | | | Type-checking plugins can now directly rewrite type-families. The TcPlugin record is given a new field, tcPluginRewrite. The plugin specifies how to rewrite certain type-families with a value of type `UniqFM TyCon TcPluginRewriter`, where: type TcPluginRewriter = RewriteEnv -- Rewriter environment -> [Ct] -- Givens -> [TcType] -- type family arguments -> TcPluginM TcPluginRewriteResult data TcPluginRewriteResult = TcPluginNoRewrite | TcPluginRewriteTo { tcPluginRewriteTo :: Reduction , tcRewriterNewWanteds :: [Ct] } When rewriting an exactly-saturated type-family application, GHC will first query type-checking plugins for possible rewritings before proceeding. Includes some changes to the TcPlugin API, e.g. removal of the EvBindsVar parameter to the TcPluginM monad.
* Refactoring module dependenciesSylvain Henry2021-08-1318-139/+181
| | | | | | | | | | | | | | * Make mkDependencies pure * Use Sets instead of sorted lists Notable perf changes: MultiLayerModules(normal) ghc/alloc 4130851520.0 2981473072.0 -27.8% T13719(normal) ghc/alloc 4313296052.0 4151647512.0 -3.7% Metric Decrease: MultiLayerModules T13719
* Move `ol_witness` to `OverLitTc`Dr. ERDI Gergo2021-08-1311-69/+79
| | | | | | | | We also add a new `ol_from_fun` field to renamed (but not yet typechecked) OverLits. This has the nice knock-on effect of making total some typechecker functions that used to be partial. Fixes #20151
* Modify InlineSpec data constructor (helps fix #18138)Alina Banerjee2021-08-1118-87/+147
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The inl_inline field of the InlinePragma record is modified to store pragma source text by adding a data constructor of type SourceText. This can help in tracking the actual text of pragma names. Add/modify functions, modify type instance for InlineSpec type Modify parser, lexer to handle InlineSpec constructors containing SourceText Modify functions with InlineSpec type Extract pragma source from InlineSpec for SpecSig, InlineSig types Modify cvtInline function to add SourceText to InlineSpec type Extract name for InlineSig, SpecSig from pragma, SpectInstSig from source (fixes #18138) Extract pragma name for SpecPrag pragma, SpecSig signature Add Haddock annotation for inlinePragmaName function Add Haddock annotations for using helper functions in hsSigDoc Remove redundant ppr in pragma name for SpecSig, InlineSig; update comment Rename test to T18138 for misplaced SPECIALIZE pragma testcase
* Optimize Info Table Provenance Entries (IPEs) Map creation and lookupSven Tennie2021-08-1116-58/+985
| | | | | | | | | | | | | | | Using a hash map reduces the complexity of lookupIPE(), making it non linear. On registration each IPE list is added to a temporary IPE lists buffer, reducing registration time. The hash map is built lazily on first lookup. IPE event output to stderr is added with tests. For details, please see Note [The Info Table Provenance Entry (IPE) Map]. A performance test for IPE registration and lookup can be found here: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/5724#note_370806
* Update HACKING.mdMoritz Angermann2021-08-111-1/+1
|
* Fix pprDepsSylvain Henry2021-08-102-2/+4
| | | | Copy-paste error in 38faeea1a94072ffd9f459d9fe570f06bc1da84a
* Fix recomp021 localeSylvain Henry2021-08-101-1/+1
| | | | `diff` uses the locale to print its message.
* Refactor HsStmtContext and remove HsDoRnArtyom Kuznetsov2021-08-1016-165/+165
| | | | | | | | | Parts of HsStmtContext were split into a separate data structure HsDoFlavour. Before this change HsDo used to have HsStmtContext inside, but in reality only parts of HsStmtContext were used and other cases were invariants handled with panics. Separating those parts into its own data structure helps us to get rid of those panics as well as HsDoRn type family.
* Add a Typeable constraint to fromStaticPtr, addressing #19729David Simmons-Duffin2021-08-104-7/+17
|
* Hadrian: fix .cabal fileSylvain Henry2021-08-091-1/+1
| | | | | | | | `stack sdist` in the hadrian directory reported: Package check reported the following errors: To use the 'extra-doc-files' field the package needs to specify at least 'cabal-version: >= 1.18'.
* Move `/includes` to `/rts/include`, sort per package betterJohn Ericson2021-08-09141-184/+216
| | | | | | | | | | | | | | | | | | | | | | | | | | | In order to make the packages in this repo "reinstallable", we need to associate source code with a specific packages. Having a top level `/includes` dir that mixes concerns (which packages' includes?) gets in the way of this. To start, I have moved everything to `rts/`, which is mostly correct. There are a few things however that really don't belong in the rts (like the generated constants haskell type, `CodeGen.Platform.h`). Those needed to be manually adjusted. Things of note: - No symlinking for sake of windows, so we hard-link at configure time. - `CodeGen.Platform.h` no longer as `.hs` extension (in addition to being moved to `compiler/`) so as not to confuse anyone, since it is next to Haskell files. - Blanket `-Iincludes` is gone in both build systems, include paths now more strictly respect per-package dependencies. - `deriveConstants` has been taught to not require a `--target-os` flag when generating the platform-agnostic Haskell type. Make takes advantage of this, but Hadrian has yet to.
* Make `PosixSource.h` installed and under `rts/`John Ericson2021-08-0994-105/+116
| | | | | | is used outside of the rts so we do this rather than just fish it out of the repo in ad-hoc way, in order to make packages in this repo more self-contained.
* Clean up whitespace in /includesJohn Ericson2021-08-099-104/+104
| | | | I need to do this now or when I move these files the linter will be mad.
* Remove ad-hoc fromIntegral rulesSylvain Henry2021-08-099-313/+1255
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fromIntegral is defined as: {-# NOINLINE [1] fromIntegral #-} fromIntegral :: (Integral a, Num b) => a -> b fromIntegral = fromInteger . toInteger Before this patch, we had a lot of rewrite rules for fromIntegral, to avoid passing through Integer when there is a faster way, e.g.: "fromIntegral/Int->Word" fromIntegral = \(I# x#) -> W# (int2Word# x#) "fromIntegral/Word->Int" fromIntegral = \(W# x#) -> I# (word2Int# x#) "fromIntegral/Word->Word" fromIntegral = id :: Word -> Word Since we have added sized types and primops (Word8#, Int16#, etc.) and Natural, this approach didn't really scale as there is a combinatorial explosion of types. In addition, we really want these conversions to be optimized for all these types and in every case (not only when fromIntegral is explicitly used). This patch removes all those ad-hoc fromIntegral rules. Instead we rely on inlining and built-in constant-folding rules. There are not too many native conversions between Integer/Natural and fixed size types, so we can handle them all explicitly. Foreign.C.Types was using rules to ensure that fromIntegral rules "sees" through the newtype wrappers,e.g.: {-# RULES "fromIntegral/a->CSize" fromIntegral = \x -> CSize (fromIntegral x) "fromIntegral/CSize->a" fromIntegral = \(CSize x) -> fromIntegral x #-} But they aren't necessary because coercions due to newtype deriving are pushed out of the way. So this patch removes these rules (as fromIntegral is now inlined, they won't match anymore anyway). Summary: * INLINE `fromIntegral` * Add some missing constant-folding rules * Remove every fromIntegral ad-hoc rules (fix #19907) Fix #20062 (missing fromIntegral rules for sized primitives) Performance: - T12545 wiggles (tracked by #19414) Metric Decrease: T12545 T10359 Metric Increase: T12545
* Ensure that newtype deriving strategy is used for CTypesSylvain Henry2021-08-091-12/+6
|
* rts: Fix use of sized array in Heap.hBen Gamari2021-08-093-5/+9
| | | | | | Sized arrays cannot be used in headers that might be imported from C++. Fixes #20199.
* testsuite: Add test for #20199Ben Gamari2021-08-094-0/+17
| | | | Ensures that Rts.h can be parsed as C++.
* Consistent use of coercion and TypeApplicationsViktor Dukhovni2021-08-081-6/+11
| | | | | | | | | | | This makes the implementations of: - mapAccumL - mapAccumR - fmapDefault - foldMapDefault more uniform and match the approach in the overview.
* Rewrite of Traversable overviewViktor Dukhovni2021-08-081-211/+845
|
* Minor fix to pretty-printing of linear typesKrzysztof Gogolewski2021-08-057-12/+31
| | | | | | The function ppr_arrow_chain was not printing multiplicities. Also remove the Outputable instance: no longer used, and could cover bugs like those.
* Add Data.ByteArray, derived from primitiveBodigrim2021-08-053-0/+245
|
* Use Reductions to keep track of rewritingssheaf2021-08-0421-919/+1410
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We define Reduction = Reduction Coercion !Type. A reduction of the form 'Reduction co new_ty' witnesses an equality ty ~co~> new_ty. That is, the rewriting happens left-to-right: the right-hand-side type of the coercion is the rewritten type, and the left-hand-side type the original type. Sticking to this convention makes the codebase more consistent, helping to avoid certain applications of SymCo. This replaces the parts of the codebase which represented reductions as pairs, (Coercion,Type) or (Type,Coercion). Reduction being strict in the Type argument improves performance in some programs that rewrite many type families (such as T9872). Fixes #20161 ------------------------- Metric Decrease: T5321Fun T9872a T9872b T9872c T9872d -------------------------
* Fix GHCi completion (#20101)Zubin Duggal2021-08-047-17/+38
| | | | Updates haskeline submodule
* hadrian: Create relative rather than absolute symlinks in binary dist folderMatthew Pickering2021-08-041-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The symlink structure now looks like: ``` lrwxrwxrwx 1 matt users 16 Aug 3 16:27 _build/bindist/ghc-9.3.20210721-x86_64-unknown-linux/bin/ghc -> ghc-9.3.20210721 -rwxr-xr-x 1 matt users 1750336 Aug 3 15:00 _build/bindist/ghc-9.3.20210721-x86_64-unknown-linux/bin/ghc-9.3.20210721 lrwxrwxrwx 1 matt users 22 Aug 3 16:27 _build/bindist/ghc-9.3.20210721-x86_64-unknown-linux/bin/ghc-iserv -> ghc-iserv-9.3.20210721 -rwxr-xr-x 1 matt users 31703176 Aug 3 15:00 _build/bindist/ghc-9.3.20210721-x86_64-unknown-linux/bin/ghc-iserv-9.3.20210721 lrwxrwxrwx 1 matt users 26 Aug 3 16:27 _build/bindist/ghc-9.3.20210721-x86_64-unknown-linux/bin/ghc-iserv-dyn -> ghc-iserv-dyn-9.3.20210721 -rwxr-xr-x 1 matt users 40808 Aug 3 15:00 _build/bindist/ghc-9.3.20210721-x86_64-unknown-linux/bin/ghc-iserv-dyn-9.3.20210721 lrwxrwxrwx 1 matt users 20 Aug 3 16:27 _build/bindist/ghc-9.3.20210721-x86_64-unknown-linux/bin/ghc-pkg -> ghc-pkg-9.3.20210721 -rwxr-xr-x 1 matt users 634872 Aug 3 15:00 _build/bindist/ghc-9.3.20210721-x86_64-unknown-linux/bin/ghc-pkg-9.3.20210721 lrwxrwxrwx 1 matt users 14 Aug 3 16:27 _build/bindist/ghc-9.3.20210721-x86_64-unknown-linux/bin/haddock -> haddock-2.24.0 -rwxr-xr-x 1 matt users 4336664 Aug 3 15:00 _build/bindist/ghc-9.3.20210721-x86_64-unknown-linux/bin/haddock-2.24.0 lrwxrwxrwx 1 matt users 9 Aug 3 16:27 _build/bindist/ghc-9.3.20210721-x86_64-unknown-linux/bin/hp2ps -> hp2ps-0.1 -rwxr-xr-x 1 matt users 49312 Aug 3 15:00 _build/bindist/ghc-9.3.20210721-x86_64-unknown-linux/bin/hp2ps-0.1 lrwxrwxrwx 1 matt users 8 Aug 3 16:27 _build/bindist/ghc-9.3.20210721-x86_64-unknown-linux/bin/hpc -> hpc-0.68 -rwxr-xr-x 1 matt users 687896 Aug 3 15:00 _build/bindist/ghc-9.3.20210721-x86_64-unknown-linux/bin/hpc-0.68 lrwxrwxrwx 1 matt users 13 Aug 3 16:27 _build/bindist/ghc-9.3.20210721-x86_64-unknown-linux/bin/hsc2hs -> hsc2hs-0.68.8 -rwxr-xr-x 1 matt users 729904 Aug 3 15:00 _build/bindist/ghc-9.3.20210721-x86_64-unknown-linux/bin/hsc2hs-0.68.8 lrwxrwxrwx 1 matt users 19 Aug 3 16:27 _build/bindist/ghc-9.3.20210721-x86_64-unknown-linux/bin/runghc -> runghc-9.3.20210721 -rwxr-xr-x 1 matt users 57672 Aug 3 15:00 _build/bindist/ghc-9.3.20210721-x86_64-unknown-linux/bin/runghc-9.3.20210721 lrwxrwxrwx 1 matt users 9 Aug 3 16:27 _build/bindist/ghc-9.3.20210721-x86_64-unknown-linux/bin/unlit -> unlit-0.1 -rwxr-xr-x 1 matt users 14896 Aug 3 15:00 _build/bindist/ghc-9.3.20210721-x86_64-unknown-linux/bin/unlit-0.1 ``` Fixes #20198
* Make HsWrapper a MonoidJohn Ericson2021-08-041-0/+21
| | | | See instance documentation for caviat.
* Linear types: fix linting of multiplicities (#19165)Krzysztof Gogolewski2021-08-042-15/+21
| | | | The previous version did not substitute the type used in the scrutinee.
* Disable -fdefer-type-errors for linear types (#20083)Krzysztof Gogolewski2021-08-048-5/+67
|
* Don't store tmpDir in SettingsSylvain Henry2021-08-033-18/+9
| | | | There was no point in doing this as indicated by the TODO.
* Fix ASSERTS_ENABLED CPPSylvain Henry2021-08-033-3/+3
|
* move bytecode preparation into the STG pipelineLuite Stegeman2021-08-035-199/+245
| | | | | this makes it possible to combine passes to compute free variables more efficiently in a future change
* Correctly unload libs on GHCi with external iservTito Sacchi2021-08-032-3/+2
| | | | | | | | | Fix #17669 `hostIsDynamic` is basically a compile-time constant embedded in the RTS. Therefore, GHCi didn't unload object files properly when used with an external interpreter built in a different way.
* Handle OverloadedRecordDot in TH (#20185)Zubin Duggal2021-08-0312-5/+95
|
* Improve documentation for HscTypes.usg_mod_hashAndreas Klebinger2021-08-031-2/+5
|
* Add "fast-ci" label, for skipping most builds (#19280)Krzysztof Gogolewski2021-08-031-0/+20
| | | | | | | If "fast-ci" is present, only the following parts of full-build are run: - validate-x86_64-linux-deb9-debug - validate-x86_64-windows-hadrian - validate-x86_64-linux-deb9-unreg-hadrian
* Remove eager forcing of RuleInfo in substRuleInfoMatthew Pickering2021-08-035-9/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | substRuleInfo updates the IdInfo for an Id, therefore it is important to not force said IdInfo whilst updating it, otherwise we end up in an infinite loop. This is what happened in #20112 where `mkTick` forced the IdInfo being updated by checking the arity in isSaturatedConApp. The fix is to stop the expression being forced so early by removing the call to seqRuleInfo. The call sequence looked something like: * `substRecBndrs` * `substIdBndr` * `substIdInfo` * `substRuleInfo` * `substRule` * `substExpr` * `mkTick` * `isSaturatedConApp` * Look at `IdInfo` for thing we are currently substituting because the rule is attached to `transpose` and mentions it in the `RHS` of the rule. Which arose because the `transpose` Id had a rule attached where the RHS of the rule also mentioned `transpose`. This call to seqRuleInfo was introduced in 4e7d56fde0f44d38bbb9a6fc72cf9c603264899d where it was explained > I think there are now *too many* seqs, and they waste work, but I don't have > time to find which ones. We also observe that there is the ominous note on `substRule` about making sure substExpr is called lazily. > {- Note [Substitute lazily] > ~~~~~~~~~~~~~~~~~~~~~~~~~~~ > The functions that substitute over IdInfo must be pretty lazy, because > they are knot-tied by substRecBndrs. > > One case in point was #10627 in which a rule for a function 'f' > referred to 'f' (at a different type) on the RHS. But instead of just > substituting in the rhs of the rule, we were calling simpleOptExpr, which > looked at the idInfo for 'f'; result <<loop>>. > > In any case we don't need to optimise the RHS of rules, or unfoldings, > because the simplifier will do that. Before `seqRuleInfo` was removed, this note was pretty much ignored in the `substSpec` case because the expression was immediately forced after `substRule` was called. Unfortunately it's a bit tricky to add a test for this as the failure only manifested (for an unknown reason) with a dwarf enabled compiler *AND* compiling with -g3. Fortunatley there is currently a CI configuration which builds a dwarf compiler to test this. Also, for good measure, finish off the work started in 840df33685e8c746ade4b9d4d0eb7c764a773e48 which renamed SpecInfo to RuleInfo but then didn't rename 'substSpec' to 'substRuleInfo'. Fixes #20112
* Bump process submoduleBen Gamari2021-08-031-0/+0
|
* Properly escape arguments in ghc-cabalZubin Duggal2021-08-031-3/+17
|
* Remove hschooks.c and -no-hs-main for ghc-binZubin Duggal2021-08-035-105/+3
|
* include README in hadrian.cabal Jens Petersen2021-08-031-0/+1
| | | [skip ci]
* 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
|