summaryrefslogtreecommitdiff
path: root/compiler
Commit message (Collapse)AuthorAgeFilesLines
...
* Make sure mergeWithKey is inlined and applied strictlyMatthew Pickering2021-04-082-6/+15
| | | | | | In the particular case of `DmdEnv`, not applying this function strictly meant 500MB of thunks were accumulated before the values were forced at the end of demand analysis.
* Make updTcRef force the resultMatthew Pickering2021-04-081-2/+1
| | | | | | This can lead to a classic thunk build-up in a TcRef Fixes #19596
* Use DmdEnv rather than VarEnv DmdEnvMatthew Pickering2021-04-081-1/+1
|
* Don't retain reference to whole TcLclEnv in SkolemTVMatthew Pickering2021-04-081-1/+2
|
* Stop retaining SimplEnvs in unforced UnfoldingsMatthew Pickering2021-04-082-4/+8
| | | | Related to #15455
* Change foldl' to inline when partially applied (#19534)James Foster2021-04-071-1/+1
| | | | | And though partially applied foldl' is now again inlined, #4301 has not resurfaced, and appears to be resolved.
* Remove dynamic-by-default (#16782)Sylvain Henry2021-04-071-12/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Dynamic-by-default was a mechanism to automatically select the -dynamic way for some targets. It was implemented in a convoluted way: it was defined as a flavour option, hence it couldn't be passed as a global settings (which are produced by `configure` before considering flavours), so a build system rule was used to pass -DDYNAMIC_BY_DEFAULT to the C compiler so that deriveConstants could infer it. * Make build system has it disabled for 8 years (951e28c0625ece7e0db6ac9d4a1e61e2737b10de) * It has never been implemented in Hadrian * Last time someone tried to enable it 1 year ago it didn't work (!2436) * Having this as a global constant impedes making GHC multi-target (see !5427) This commit fully removes support for dynamic-by-default. If someone wants to reimplement something like this, it would probably need to move the logic in the compiler. (Doing this would probably need some refactoring of the way the compiler handles DynFlags: DynFlags are used to store and to pass enabled ways to many parts of the compiler. It can be set by command-line flags, GHC API, global settings. In multi-target GHC, we will use DynFlags to load the target platform and its constants: but at this point with the current DynFlags implementation we can't easily update the existing DynFlags with target-specific options such as dynamic-by-default without overriding ways previously set by the user.)
* Make specialisation a bit more aggressiveSimon Peyton Jones2021-04-071-17/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The patch commit c43c981705ec33da92a9ce91eb90f2ecf00be9fe Author: Simon Peyton Jones <simonpj@microsoft.com> Date: Fri Oct 23 16:15:51 2009 +0000 Fix Trac #3591: very tricky specialiser bug fixed a nasty specialisation bug /for DFuns/. Eight years later, this patch commit 2b74bd9d8b4c6b20f3e8d9ada12e7db645cc3c19 Author: Simon Peyton Jones <simonpj@microsoft.com> Date: Wed Jun 7 12:03:51 2017 +0100 Stop the specialiser generating loopy code extended it to work for /imported/ DFuns. But in the process we lost the fact that it was needed only for DFuns! As a result we started silently losing useful specialisation for non-DFuns. But there was no regression test to spot the lossage. Then, nearly four years later, Andreas filed #19599, which showed the lossage in high relief. This patch restores the DFun test, and adds Note [Avoiding loops (non-DFuns)] to explain why. This is undoubtedly a very tricky corner of the specialiser, and one where I would love to have a more solid argument, even a paper! But meanwhile I think this fixes the lost specialisations without introducing any new loops. I have two regression tests, T19599 and T19599a, so I hope we'll know if we lose them again in the future. Vanishingly small effect on nofib. A couple of compile-time benchmarks improve T9872a(normal) ghc/alloc 1660559328.0 1643827784.0 -1.0% GOOD T9872c(normal) ghc/alloc 1691359152.0 1672879384.0 -1.1% GOOD Many others wiggled around a bit. Metric Decrease: T9872a T9872c
* One-Shotify GHC.Utils.Monad.State (#18202)Andreas Klebinger2021-04-051-1/+15
|
* fix sub-word literals in GHCiLuite Stegeman2021-04-051-9/+26
|
* Correct warning for deprecated and unrecognised flagsAlfredo Di Napoli2021-04-051-13/+3
| | | | | | | | | | Fixes #19616. This commit changes the `GHC.Driver.Errors.handleFlagWarnings` function to rely on the newly introduced `DiagnosticReason`. This allows us to correctly pretty-print the flags which triggered some warnings and in turn remove the cruft around this function (like the extra filtering and the `shouldPrintWarning` function.
* Introduce SevIgnore Severity to suppress warningsAlfredo Di Napoli2021-04-0526-172/+178
| | | | | | | | | | | | | | | | | | | | | | This commit introduces a new `Severity` type constructor called `SevIgnore`, which can be used to classify diagnostic messages which are not meant to be displayed to the user, for example suppressed warnings. This extra constructor allows us to get rid of a bunch of redundant checks when emitting diagnostics, typically in the form of the pattern: ``` when (optM Opt_XXX) $ addDiagnosticTc (WarningWithFlag Opt_XXX) ... ``` Fair warning! Not all checks should be omitted/skipped, as evaluating some data structures used to produce a diagnostic might still be expensive (e.g. zonking, etc). Therefore, a case-by-case analysis must be conducted when deciding if a check can be removed or not. Last but not least, we remove the unnecessary `CmdLine.WarnReason` type, which is now redundant with `DiagnosticReason`.
* Add special case to stripStgTicksTop for []Matthew Pickering2021-04-051-0/+2
| | | | | In the common case where the list of ticks is empty, building a thunk just applies 'reverse' to '[]' which is quite wasteful.
* Implement proposal 403: Lexer cleanupOleg Grenrus2021-04-051-7/+7
| | | | | This allows Other Numbers to be used in identifiers, and also documents other, already existing lexer divergence from Haskell Report
* Compute Severity of diagnostics at birthAlfredo Di Napoli2021-04-0124-444/+457
| | | | | | | | | | | | | | | | | | | | | This commit further expand on the design for #18516 by getting rid of the `defaultReasonSeverity` in favour of a function called `diagReasonSeverity` which correctly takes the `DynFlags` as input. The idea is to compute the `Severity` and the `DiagnosticReason` of each message "at birth", without doing any later re-classifications, which are potentially error prone, as the `DynFlags` might evolve during the course of the program. In preparation for a proper refactoring, now `pprWarning` from the Parser.Ppr module has been renamed to `mkParserWarn`, which now takes a `DynFlags` as input. We also get rid of the reclassification we were performing inside `printOrThrowWarnings`. Last but not least, this commit removes the need for reclassify inside GHC.Tc.Errors, and also simplifies the implementation of `maybeReportError`. Update Haddock submodule
* Add missing axiom exports for CharToNat/NatToCharVladislav Zavialov2021-04-011-0/+2
| | | | | | | When the CharToNat and NatToChar type families were added, the corresponding axioms were not exported. This led to a failure much like #14934
* Move the EPS into UnitEnvSylvain Henry2021-04-018-18/+20
|
* Move HPT in UnitEnvSylvain Henry2021-04-019-56/+76
|
* Move unit DBs in UnitEnvSylvain Henry2021-04-019-38/+56
| | | | | Also make the HomeUnit optional to keep the field strict and prepare for UnitEnvs without a HomeUnit (e.g. in Plugins envs, cf #14335).
* Properly initialise UnitEnvSylvain Henry2021-04-012-5/+25
|
* Encapsulate the EPS IORef in a newtypeSylvain Henry2021-04-017-42/+56
|
* Data.List specialization to []Oleg Grenrus2021-04-011-1/+4
| | | | | | | - Remove GHC.OldList - Remove Data.OldList - compat-unqualified-imports is no-op - update haddock submodule
* Avoid fundep-caused loop in the typecheckerSimon Peyton Jones2021-03-314-47/+140
| | | | | | | | | | | Ticket #19415 showed a nasty typechecker loop, which can happen with fundeps that do not satisfy the coverage condition. This patch fixes the problem. It's described in GHC.Tc.Solver.Interact Note [Fundeps with instances] It's not a perfect solution, as the Note explains, but it's better than the status quo.
* EPA : Rename AnnComment to EpaCommentAlan Zimmerman2021-03-315-88/+93
| | | | Follow-up from !2418, see #19579
* EPA : rename AnnAnchor to EpaAnchorAlan Zimmerman2021-03-3111-94/+94
| | | | Follow-up from !2418, see #19579
* EPA : rename 'api annotations' to 'exact print annotations'Alan Zimmerman2021-03-3119-170/+174
| | | | | | In comments, and notes. Follow-up from !2418, see #19579
* EPA : Rename ApiAnn to EPAnnAlan Zimmerman2021-03-3118-618/+618
| | | | | | Follow-up from !2418, see #19579 Updates haddock submodule
* EPA : Rename AddApiAnn to AddEpAnnAlan Zimmerman2021-03-3112-174/+173
| | | | | | | As port of the process of migrating naming from API Annotations to exact print annotations (EPA) Follow-up from !2418, see #19579
* The result kind of a signature can't mention quantified varsSimon Peyton Jones2021-03-312-9/+86
| | | | | | | | | | | | | | | | | | | | | This patch fixes a small but egregious bug, which allowed a type signature like f :: forall a. blah not to fail if (blah :: a). Acutally this only showed up as a ASSERT error (#19495). The fix is very short, but took quite a bit of head scratching Hence the long Note [Escaping kind in type signatures] While I was in town, I also added a short-cut for the common case of having no quantifiers to tcImplicitTKBndrsX. Metric Decrease: T9198 Metric Increase: T9198
* import Data.List with explicit import listOleg Grenrus2021-03-311-1/+1
|
* [armv7] PIC by default + [aarch64-linux] T11276 metric increaseMoritz Angermann2021-03-291-0/+1
| | | | | Metric Increase: T11276
* Allocate Adjustors and mark them readable in two stepsMoritz Angermann2021-03-291-4/+3
| | | | | | | | | This drops allocateExec for darwin, and replaces it with a alloc, write, mark executable strategy instead. This prevents us from trying to allocate an executable range and then write to it, which X^W will prohibit on darwin. This will *only* work if we can use mmap.
* Add `MessageClass`, rework `Severity` and add `DiagnosticReason`.wip/adinapoli-message-class-new-designAlfredo Di Napoli2021-03-2962-805/+913
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Other than that: * Fix T16167,json,json2,T7478,T10637 tests to reflect the introduction of the `MessageClass` type * Remove `makeIntoWarning` * Remove `warningsToMessages` * Refactor GHC.Tc.Errors 1. Refactors GHC.Tc.Errors so that we use `DiagnosticReason` for "choices" (defer types errors, holes, etc); 2. We get rid of `reportWarning` and `reportError` in favour of a general `reportDiagnostic`. * Introduce `DiagnosticReason`, `Severity` is an enum: This big commit makes `Severity` a simple enumeration, and introduces the concept of `DiagnosticReason`, which classifies the /reason/ why we are emitting a particular diagnostic. It also adds a monomorphic `DiagnosticMessage` type which is used for generic messages. * The `Severity` is computed (for now) from the reason, statically. Later improvement will add a `diagReasonSeverity` function to compute the `Severity` taking `DynFlags` into account. * Rename `logWarnings` into `logDiagnostics` * Add note and expand description of the `mkHoleError` function
* Replace - with negateOleg Grenrus2021-03-281-2/+2
| | | | It also failed to parse with HLint (I wonder how GHC itself handles it?)
* Add UnitId to Target recordFendor2021-03-286-20/+41
| | | | | | | | | | In the future, we want `HscEnv` to support multiple home units at the same time. This means, that there will be 'Target's that do not belong to the current 'HomeUnit'. This is an API change without changing behaviour. Update haddock submodule to incorporate API changes.
* Rename StrictSig to DmdSig (#19597)Sebastian Graf2021-03-2831-256/+256
| | | | | | | | | | | | | In #19597, we also settled on the following renamings: * `idStrictness` -> `idDmdSig`, `strictnessInfo` -> `dmdSigInfo`, `HsStrictness` -> `HsDmdSig` * `idCprInfo` -> `idCprSig`, `cprInfo` -> `cprSigInfo`, `HsCpr` -> `HsCprSig` Fixes #19597.
* Rubbish literals for all representations (#18983)Sebastian Graf2021-03-2626-375/+523
| | | | | | | | | | | | | | | | | This patch cleans up the complexity around WW's `mk_absent_let` by broadening the scope of `LitRubbish`. Rubbish literals now store the `PrimRep` they represent and are ultimately lowered in Cmm. This in turn allows absent literals of `VecRep` or `VoidRep`. The latter allows absent literals for unlifted coercions, as requested in #18983. I took the liberty to rewrite and clean up `Note [Absent fillers]` and `Note [Rubbish values]` to account for the new implementation and to make them more orthogonal in their description. I didn't add a new regression test, as `T18982` already contains the test in the ticket and its test output changes as expected. Fixes #18983.
* Bump Win32 to 2.13.0.0GHC GitLab CI2021-03-261-1/+1
| | | | Bumps Win32 submodule.
* Fix lint issueSylvain Henry2021-03-261-1/+1
|
* Use foldGet in getSymbolTableSylvain Henry2021-03-263-25/+50
| | | | | | | | | | | Implement @alexbiehl suggestion of using a foldGet function to avoid the creation of an intermediate list while reading the symbol table. Do something similar for reading the Hie symbol table and the interface dictionary. Metric Decrease: T10421
* Remove UniqSupply from NameCacheSylvain Henry2021-03-266-146/+113
| | | | | | | | | | | | | | | | | | | | | | | | | | | | As suggested by @alexbiehl, this patch replaces the always updated UniqSupply in NameCache with a fixed Char and use it with `uniqFromMask` to generate uniques. This required some refactoring because getting a new unique from the NameCache can't be done in pure code anymore, in particular not in an atomic update function for `atomicModifyIORef`. So we use an MVar instead to store the OrigNameCache field. For some reason, T12545 increases (+1%) on i386 while it decreases on other CI runners. T9630 ghc/peak increases only with the dwarf build on CI (+16%). Metric Decrease: T12425 T12545 T9198 T12234 Metric Increase: T12545 T9630 Update haddock submodule
* Refactor FinderCacheSylvain Henry2021-03-2619-316/+433
|
* Refactor NameCacheSylvain Henry2021-03-269-193/+178
| | | | | | | | * Make NameCache the mutable one and replace NameCacheUpdater with it * Remove NameCache related code duplicated into haddock Bump haddock submodule
* Refactor interface loadingSylvain Henry2021-03-267-281/+319
| | | | | | | | | | In order to support several home-units and several independent unit-databases, it's easier to explicitly pass UnitState, DynFlags, etc. to interface loading functions. This patch converts some functions using monads such as IfG or TcRnIf with implicit access to HscEnv to use IO instead and to pass them specific fields of HscEnv instead of an HscEnv value.
* Implement -Wmissing-kind-signaturesOleg Grenrus2021-03-256-10/+47
| | | | Fixes #19564
* EPA: Tidy up some GHC.Parser.Annotation commentswip/az/exactprint-tweak-parser-state-commentGHC GitLab CI2021-03-251-14/+33
| | | | | | This is a follow up from !2418 / #19579 [skip ci]
* EPA : Remove ApiAnn from ParsedModuleGHC GitLab CI2021-03-259-37/+20
| | | | | All the comments are now captured in the AST, there is no need for a side-channel structure for them.
* Add compiler linting to CIHécate2021-03-2529-135/+107
| | | | | This commit adds the `lint:compiler` Hadrian target to the CI runner. It does also fixes hints in the compiler/ and libraries/base/ codebases.
* Fix the binder-swap transformation in OccurAnalSimon Peyton Jones2021-03-242-53/+116
| | | | | | | | | | The binder-swap transformation needs to be iterated, as shown by #19581. The fix is pretty simple, and is explained in point (BS2) of Note [The binder-swap substitution]. Net effect: - sometimes, fewer simplifier iterations - sometimes, more case merging
* STG AST - Make ConstructorNumber always a field.Andreas Klebinger2021-03-243-11/+5
| | | | | | | | It's used by all passes and already used as a regular field. So I figured it would be both more consistent and performant to make it a regular field for all constructors. I also added a few bangs in the process.