summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* morewip/no-skolem-info2Simon Peyton Jones2022-03-244-65/+60
|
* Nasty wibble in Errors.hsSimon Peyton Jones2022-01-041-1/+16
|
* Completely refactor kcCheckDeclHeader_sigSimon Peyton Jones2022-01-0324-502/+484
| | | | | | | | | | | | | | | | | | | | | | | | This substantial commit refactors kcCheckDeclHeader_sig, which kept doing my head in. Plus, it wasn't right because it wasn't skolemising the binders as it decomposed the kind signature. The new story is described in Note [kcCheckDeclHeader_sig]. The code is considerably shorter than before (roughly 240 lines turns into 150 lines). It still has the same awkward complexity around computing arity as before, but that is a language design issue. See Note [Arity inference in kcCheckDeclHeader_sig] Other points * I added new type synonyms MonoTcTyCon and PolyTcTyCon, and used them to be clear which TcTyCons have "finished" kinds etc, and which are monomorphic. * I renamed etaExpandAlgTyCon to splitTyConKind, becuase that's a better name, and it is very useful in kcCheckDeclHeader_sig, where eta-expansion isn't an issue.
* Add commentMatthew Pickering2021-12-311-0/+2
|
* Apply 13 suggestion(s) to 3 file(s)sheaf2021-12-313-13/+37
|
* tidyMatthew Pickering2021-12-312-2/+2
|
* Add two tests from SamMatthew Pickering2021-12-315-0/+31
|
* tweaksMatthew Pickering2021-12-3016-57/+59
|
* Use correct substition functionMatthew Pickering2021-12-301-1/+1
|
* changesMatthew Pickering2021-12-3022-84/+197
|
* Fixes for DerivSkolMatthew Pickering2021-12-303-12/+29
|
* wip skol infoMatthew Pickering2021-12-308-35/+67
|
* Good improvementsMatthew Pickering2021-12-3012-140/+103
|
* Mark provendance of skolem infoMatthew Pickering2021-12-3023-190/+243
|
* remove traceMatthew Pickering2021-12-301-1/+0
|
* Add testMatthew Pickering2021-12-303-1/+8
|
* fixesMatthew Pickering2021-12-302-3/+4
|
* UpdatesMatthew Pickering2021-12-305-21/+32
|
* Add boot filesMatthew Pickering2021-12-302-0/+12
|
* review from richardMatthew Pickering2021-12-3016-84/+60
|
* WIP: No Skolem InfoMatthew Pickering2021-12-3030-252/+393
|
* RTS: Fix CloneStack.c when no table next to codePeter Trommler2021-12-292-2/+2
| | | | | | | | Function `lookupIPE` does not modify its argument. Reflect this in the type. Module `CloneStack.c` relies on this for RTS without tables next to code. Fixes #20879
* Cabal: Update submoduleMatthew Pickering2021-12-291-0/+0
| | | | Closes #20874
* Skip computing superclass origins for equalitiesRichard Eisenberg2021-12-281-4/+13
| | | | This yields a small, but measurable, performance improvement.
* Multiple Home UnitsMatthew Pickering2021-12-28334-1536/+3996
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Multiple home units allows you to load different packages which may depend on each other into one GHC session. This will allow both GHCi and HLS to support multi component projects more naturally. Public Interface ~~~~~~~~~~~~~~~~ In order to specify multiple units, the -unit @⟨filename⟩ flag is given multiple times with a response file containing the arguments for each unit. The response file contains a newline separated list of arguments. ``` ghc -unit @unitLibCore -unit @unitLib ``` where the `unitLibCore` response file contains the normal arguments that cabal would pass to `--make` mode. ``` -this-unit-id lib-core-0.1.0.0 -i -isrc LibCore.Utils LibCore.Types ``` The response file for lib, can specify a dependency on lib-core, so then modules in lib can use modules from lib-core. ``` -this-unit-id lib-0.1.0.0 -package-id lib-core-0.1.0.0 -i -isrc Lib.Parse Lib.Render ``` Then when the compiler starts in --make mode it will compile both units lib and lib-core. There is also very basic support for multiple home units in GHCi, at the moment you can start a GHCi session with multiple units but only the :reload is supported. Most commands in GHCi assume a single home unit, and so it is additional work to work out how to modify the interface to support multiple loaded home units. Options used when working with Multiple Home Units There are a few extra flags which have been introduced specifically for working with multiple home units. The flags allow a home unit to pretend it’s more like an installed package, for example, specifying the package name, module visibility and reexported modules. -working-dir ⟨dir⟩ It is common to assume that a package is compiled in the directory where its cabal file resides. Thus, all paths used in the compiler are assumed to be relative to this directory. When there are multiple home units the compiler is often not operating in the standard directory and instead where the cabal.project file is located. In this case the -working-dir option can be passed which specifies the path from the current directory to the directory the unit assumes to be it’s root, normally the directory which contains the cabal file. When the flag is passed, any relative paths used by the compiler are offset by the working directory. Notably this includes -i and -I⟨dir⟩ flags. -this-package-name ⟨name⟩ This flag papers over the awkward interaction of the PackageImports and multiple home units. When using PackageImports you can specify the name of the package in an import to disambiguate between modules which appear in multiple packages with the same name. This flag allows a home unit to be given a package name so that you can also disambiguate between multiple home units which provide modules with the same name. -hidden-module ⟨module name⟩ This flag can be supplied multiple times in order to specify which modules in a home unit should not be visible outside of the unit it belongs to. The main use of this flag is to be able to recreate the difference between an exposed and hidden module for installed packages. -reexported-module ⟨module name⟩ This flag can be supplied multiple times in order to specify which modules are not defined in a unit but should be reexported. The effect is that other units will see this module as if it was defined in this unit. The use of this flag is to be able to replicate the reexported modules feature of packages with multiple home units. Offsetting Paths in Template Haskell splices ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ When using Template Haskell to embed files into your program, traditionally the paths have been interpreted relative to the directory where the .cabal file resides. This causes problems for multiple home units as we are compiling many different libraries at once which have .cabal files in different directories. For this purpose we have introduced a way to query the value of the -working-dir flag to the Template Haskell API. By using this function we can implement a makeRelativeToProject function which offsets a path which is relative to the original project root by the value of -working-dir. ``` import Language.Haskell.TH.Syntax ( makeRelativeToProject ) foo = $(makeRelativeToProject "./relative/path" >>= embedFile) ``` > If you write a relative path in a Template Haskell splice you should use the makeRelativeToProject function so that your library works correctly with multiple home units. A similar function already exists in the file-embed library. The function in template-haskell implements this function in a more robust manner by honouring the -working-dir flag rather than searching the file system. Closure Property for Home Units ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ For tools or libraries using the API there is one very important closure property which must be adhered to: > Any dependency which is not a home unit must not (transitively) depend on a home unit. For example, if you have three packages p, q and r, then if p depends on q which depends on r then it is illegal to load both p and r as home units but not q, because q is a dependency of the home unit p which depends on another home unit r. If you are using GHC by the command line then this property is checked, but if you are using the API then you need to check this property yourself. If you get it wrong you will probably get some very confusing errors about overlapping instances. Limitations of Multiple Home Units ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ There are a few limitations of the initial implementation which will be smoothed out on user demand. * Package thinning/renaming syntax is not supported * More complicated reexports/renaming are not yet supported. * It’s more common to run into existing linker bugs when loading a large number of packages in a session (for example #20674, #20689) * Backpack is not yet supported when using multiple home units. * Dependency chasing can be quite slow with a large number of modules and packages. * Loading wired-in packages as home units is currently not supported (this only really affects GHC developers attempting to load template-haskell). * Barely any normal GHCi features are supported, it would be good to support enough for ghcid to work correctly. Despite these limitations, the implementation works already for nearly all packages. It has been testing on large dependency closures, including the whole of head.hackage which is a total of 4784 modules from 452 packages. Internal Changes ~~~~~~~~~~~~~~~~ * The biggest change is that the HomePackageTable is replaced with the HomeUnitGraph. The HomeUnitGraph is a map from UnitId to HomeUnitEnv, which contains information specific to each home unit. * The HomeUnitEnv contains: - A unit state, each home unit can have different package db flags - A set of dynflags, each home unit can have different flags - A HomePackageTable * LinkNode: A new node type is added to the ModuleGraph, this is used to place the linking step into the build plan so linking can proceed in parralel with other packages being built. * New invariant: Dependencies of a ModuleGraphNode can be completely determined by looking at the value of the node. In order to achieve this, downsweep now performs a more complete job of downsweeping and then the dependenices are recorded forever in the node rather than being computed again from the ModSummary. * Some transitive module calculations are rewritten to use the ModuleGraph which is more efficient. * There is always an active home unit, which simplifies modifying a lot of the existing API code which is unit agnostic (for example, in the driver). The road may be bumpy for a little while after this change but the basics are well-tested. One small metric increase, which we accept and also submodule update to haddock which removes ExtendedModSummary. Closes #10827 ------------------------- Metric Increase: MultiLayerModules ------------------------- Co-authored-by: Fendor <power.walross@gmail.com>
* Use POSIX-compliant egrep expression to fix T8832 on OpenBSDGreg Steuck2021-12-261-1/+1
|
* Fix typosKrzysztof Gogolewski2021-12-2546-72/+72
|
* Properly filter for module visibility in resolvePackageImportMatthew Pickering2021-12-237-3/+39
| | | | | | | | | | | | This completes the fix for #20779 / !7123. Beforehand, the program worked by accident because the two versions of the library happened to be ordered properly (due to how the hashes were computed). In the real world I observed them being the other way around which meant the final lookup failed because we weren't filtering for visibility. I modified the test so that it failed (and it's fixed by this patch).
* Make callerCC profiling mode represent entry counter flag.Andreas Klebinger2021-12-231-2/+3
| | | | Fixes #20854
* Mark T16525b as fragile on windowsMatthew Pickering2021-12-221-1/+1
| | | | See ticket #20852
* perf ci: Start searching form the performance baselineMatthew Pickering2021-12-221-3/+4
| | | | | | | | | | If you specify PERF_BASELINE_COMMIT then this can fail if the specific commit you selected didn't have perf test metrics. (This can happen in CI for example if a build fails on master). Therefore instead of just reporting all tests as new, we start searching downwards from this point to try and find a good commit to report numbers from.
* testsuite: Remove reqlib modifierMatthew Pickering2021-12-22123-7190/+6
| | | | | | | | | | | | | | | | | | | | The reqlib modifer was supposed to indicate that a test needed a certain library in order to work. If the library happened to be installed then the test would run as normal. However, CI has never run these tests as the packages have not been installed and we don't want out tests to depend on things which might get externally broken by updating the compiler. The new strategy is to run these tests in head.hackage, where the tests have been cabalised as well as possible. Some tests couldn't be transferred into the normal style testsuite but it's better than never running any of the reqlib tests. https://gitlab.haskell.org/ghc/head.hackage/-/merge_requests/169 A few submodules also had reqlib tests and have been updated to remove it. Closes #16264 #20032 #17764 #16561
* Fix panic trying to -ddump-parsed-ast for implicit fixityAlan Zimmerman2021-12-227-8/+185
| | | | | | | | | | | | | | A declaration such as infixr ++++ is supplied with an implicit fixity of 9 in the parser, but uses an invalid SrcSpan to capture this. Use of this span triggers a panic. Fix the problem by not recording an exact print annotation for the non-existent fixity source. Closes #20846
* ci: Fix master CIMatthew Pickering2021-12-221-1/+1
| | | | | I made a mistake in the bash script so there were errors about "$CI_MERGE_REQUEST_DIFF_BASE_SHA" not existing.
* Cmm: DynFlags to CmmConfig refactordoyougnu2021-12-2211-114/+175
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | add files GHC.Cmm.Config, GHC.Driver.Config.Cmm Cmm: DynFlag references --> CmmConfig Cmm.Pipeline: reorder imports, add handshake Cmm: DynFlag references --> CmmConfig Cmm.Pipeline: DynFlag references --> CmmConfig Cmm.LayoutStack: DynFlag references -> CmmConfig Cmm.Info.Build: DynFlag references -> CmmConfig Cmm.Config: use profile to retrieve platform Cmm.CLabel: unpack NCGConfig in labelDynamic Cmm.Config: reduce CmmConfig surface area Cmm.Config: add cmmDoCmmSwitchPlans field Cmm.Config: correct cmmDoCmmSwitchPlans flag The original implementation dispatches work in cmmImplementSwitchPlans in an `otherwise` branch, hence we must add a not to correctly dispatch Cmm.Config: add cmmSplitProcPoints simplify Config remove cmmBackend, and cmmPosInd Cmm.CmmToAsm: move ncgLabelDynamic to CmmToAsm Cmm.CLabel: remove cmmLabelDynamic function Cmm.Config: rename cmmOptDoLinting -> cmmDoLinting testsuite: update CountDepsAst CountDepsParser
* Mark `linkwhole` test as expected broken on OpenBSD per #20841Greg Steuck2021-12-211-0/+1
|
* Only use -ldl conditionally to fix T3807Greg Steuck2021-12-212-1/+7
| | | | | OpenBSD doesn't have this library and so the linker complains: ld.lld: error: unable to find library -ldl
* Use libc++ instead of libstdc++ on openbsd in addition to freebsdGreg Steuck2021-12-212-3/+6
| | | | | | | | This is not entirely accurate because some openbsd architectures use gcc. Yet we don't have ghc ported to them and thus the approximation is good enough. Fixes ghcilink006 test
* Give plugins a better interface (#17957)Sylvain Henry2021-12-2115-75/+91
| | | | | | | | | | | | Plugins were directly fetched from HscEnv (hsc_static_plugins and hsc_plugins). The tight coupling of plugins and of HscEnv is undesirable and it's better to store them in a new Plugins datatype and to use it in the plugins' API (e.g. withPlugins, mapPlugins...). In the process, the interactive context (used by GHCi) got proper support for different static plugins than those used for loaded modules. Bump haddock submodule
* Introduce -dlint flagBen Gamari2021-12-212-0/+30
| | | | | | As suggested in #20601, this is a short-hand for enabling the usual GHC-internal sanity checks one typically leans on when debugging runtime crashes.
* Rename -fcatch-bottoms to -fcatch-nonexhaustive-casesBen Gamari2021-12-215-10/+11
| | | | As noted in #20601, the previous name was rather misleading.
* rts: Add optional bounds checking in out-of-line primopsBen Gamari2021-12-211-0/+18
|
* codeGen: Introduce flag to bounds-check array accessesBen Gamari2021-12-2112-1/+242
| | | | | | | Here we introduce code generator support for instrument array primops with bounds checking, enabled with the `-fcheck-prim-bounds` flag. Introduced to debug #20769.
* testsuite: Ensure that -dcore-lint is not set for compiler performance testsMatthew Pickering2021-12-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This place ensures that the default -dcore-lint option is disabled by default when collect_compiler_stats is used but you can still pass -dcore-lint as an additional option (see T1969 which tests core lint performance). Fixes #20830 ------------------------- Metric Decrease: PmSeriesS PmSeriesT PmSeriesV T10858 T11195 T11276 T11374 T11822 T14052 T14052Type T17096 T17836 T17836b T18478 T18698a T18698b -------------------------
* Perf: avoid using (replicateM . length) when possibleSylvain Henry2021-12-174-8/+4
| | | | Extracted from !6622
* Demand: `Eq DmdType` modulo `defaultFvDmd` (#20827)Sebastian Graf2021-12-171-5/+35
| | | | | | Fixes #20827 by filtering out any default free variable demands (as per `defaultFvDmd`) prior to comparing the assocs of the `DmdEnv`. The details are in `Note [Demand type Equality]`.
* Binary: make withBinBuffer safeCheng Shao2021-12-171-5/+1
| | | | | | | With this patch, withBinBuffer will construct a ByteString that properly captures the reference to the BinHandle internal MutableByteArray#, making it safe to convert a BinHandle to ByteString and use that ByteString outside the continuation.
* Expand documentation for MulArrowT constructorMatthew Pickering2021-12-171-1/+3
| | | | Fixes #20812
* Fix documentation formatting in Language.Haskell.TH.CodeDoMatthew Pickering2021-12-171-0/+2
| | | | Fixes #20543
* Add regression test for T20189Matthew Pickering2021-12-173-0/+20
| | | | Closes #20189