summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* hadrian: Build debug rts with -O0 -g3 and disable rts strippingwip/hadrian-rts-debugMatthew Pickering2019-07-122-1/+6
| | | | Fixes #16920
* Add shake 0.18.3 to extra depsShayne Fletcher2019-07-121-0/+1
|
* Fix kind-checking for data/newtypesSimon Peyton Jones2019-07-124-31/+83
| | | | | | | | | | | | | | | | | | | | In one spot in kcConDecl we were passing in the return kind signature rether than the return kind. e.g. #16828 newtype instance Foo :: Type -> Type where MkFoo :: a -> Foo a We were giving kcConDecl the kind (Type -> Type), whereas it was expecting the ultimate return kind, namely Type. This "looking past arrows" was being done, independently, in several places, but we'd missed one. This patch moves it all to one place -- the new function kcConDecls (note the plural). I also took the opportunity to rename tcDataFamHeader to tcDataFamInstHeader (The previous name was consistently a source of confusion.)
* head.hackage: Run builds with -dcore-lintBen Gamari2019-07-111-0/+1
|
* head.hackage: Run build on head.hackage's master branchBen Gamari2019-07-111-1/+1
| | | | The GitLab CI infrastructure is now in the master branch.
* Allow reusing temporary object files generated by GHCi by writing to -odir ↵nineonine2019-07-118-5/+60
| | | | in case -fwrite-interface was specified (#16670)
* Don't typecheck too much (or too little) in DerivingVia (#16923)Ryan Scott2019-07-115-138/+191
| | | | | | | | | | | Previously, GHC would typecheck the `via` type once per class in a `deriving` clause, which caused the problems observed in #16923. This patch restructures some of the functionality in `TcDeriv` and `TcHsType` to avoid this problem. We now typecheck the `via` type exactly once per `deriving` clause and *then* typecheck all of the classes in the clause. See `Note [Don't typecheck too much in DerivingVia]` in `TcDeriv` for the full details.
* Special case a few common patterns in unionLists.Andreas Klebinger2019-07-111-1/+10
| | | | | | | In particular we very often pass one empty list and in these cases we want to avoid the overhead of computing `xs ++ []`. This should fix #14759 and #16911.
* Add regression test for old panic on inlining undeclared identifier (#495)Kevin Buhr2019-07-113-0/+15
|
* Fix erroneous float in CoreOptSimon Peyton Jones2019-07-096-7/+100
| | | | | | | | | | | The simple optimiser was making an invalid transformation to join points -- yikes. The fix is easy. I also added some documentation about the fact that GHC uses a slightly more restrictive version of join points than does the paper. Fix #16918
* hadrian/doc: Add some discussion of compilation stagesBen Gamari2019-07-092-0/+1010
| | | | | This documents some of the lore surrounding the nature and naming of GHC's stage numbers.
* T16804: adjust src spansEric Wolf2019-07-093-157/+161
|
* Add testcase T16804 for #16804Eric Wolf2019-07-096-0/+415
| | | | | slightly larger testcase for :type-at and :uses so we can see changes, if #16804 is done.
* Minor refactoring in CoreSimplÖmer Sinan Ağacan2019-07-091-3/+0
| | | | | | When `join_ids` is empty `extendVarSetList existing_joins join_ids` is already no-op, so no need to check whether `join_ids` is empty or not before extending the joins set.
* Testsuite tweaks and refactoringÖmer Sinan Ağacan2019-07-0910-19/+21
| | | | | | | | | | | | | | | | - Rename requires_th to req_th for consistency with other req functions (e.g. req_interp, req_profiling etc.) - req_th (previously requires_th) now checks for interpreter (via req_interp). With this running TH tests are skipped when running the test suite with stage=1. - Test tweaks: - T9360a, T9360b: Use req_interp - recomp009, T13938, RAE_T32a: Use req_th - Fix check-makefiles linter: it now looks for Makefiles instead of .T files (which are actually Python files)
* Hadrian: fix source-dist ruleAlp Mestanogullari2019-07-091-11/+53
| | | | | | | | | | | | | | | | | The first problem was that the list of files/dirs to embed or ignore was not up-to-date. The second problem was that the 'Cwd' option used when running the Tar builder in the source-dist rule didn't actually change the current directory and was therefore failing. Finally, the source-dist rule did not pre-generate Haskell modules derived from .x (alex) and .y (happy) files, like the Make build system does -- this is now fixed. We might be doing too much work for that last step (we seem to be building many things until we get to generating the source distribution), but extracting the distribution and running ./configure && hadrian/build.sh --flavour=quickest -j from there does work for me now.
* Hadrian: implement key-value settings for builder optionsAlp Mestanogullari2019-07-0911-40/+688
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | They take the general form `foo.bar.baz [+]= some values`, where `=` completely overrides the arguments for a builder and `+=` extends them. We currenly only support settings for updating the GHC and C compiler options, of the form: ``` {stage0, ..., stage3 or *}.{package name or *} .ghc.{c, hs, link, deps, toolargs or *}.opts {stage0, ..., stage3 or *}.{package name or *} .cc.{c, deps or *}.opts ``` The supported settings and their use is covered in the new section of `hadrian/doc/user-settings.md`, while the implementation is explained in a new Note [Hadrian settings]. Most of the logic is implemented in a new module, `Settings.Parser`, which contains key-value assignment/extension parsers as well as utilities for specifying allowed settings at a high-level, generating a `Predicate` from such a description or generating the list of possible completions for a given string. The additions to the `Settings` module make use of this to describe the settings that Hadrian currently supports, and apply all such key-value settings (from the command line and `<root>/hadrian.settings`) to the flavour that Hadrian is going to proceed with. This new setting system comes with support for generating Bash completions, implemented in `hadrian/completion.sh` and Hadrian's `autocomplete` target: > source hadrian/completion.sh > hadrian/build.sh stage1.base.ghc.<TAB> stage1.base.ghc.c.opts stage1.base.ghc.hs.opts stage1.base.ghc.*.opts stage1.base.ghc.deps.opts stage1.base.ghc.link.opts stage1.base.ghc.toolargs.opts
* testsuite: Fix #16818Ben Gamari2019-07-091-3/+10
| | | | | Renames performance metrics to include whether they are compile-time or runtime metrics.
* Deduplicate "unique subdir" code between GHC and CabalJohn Ericson2019-07-0911-69/+143
| | | | | | The code, including the generated module with the version, is now in ghc-boot. Config.hs reexports stuff as needed, ghc-pkg doesn't need any tricks at all.
* Remove most uses of TARGET platform macrosJohn Ericson2019-07-099-30/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These prevent multi-target builds. They were gotten rid of in 3 ways: 1. In the compiler itself, replacing `#if` with runtime `if`. In these cases, we care about the target platform still, but the target platform is dynamic so we must delay the elimination to run time. 2. In the compiler itself, replacing `TARGET` with `HOST`. There was just one bit of this, in some code splitting strings representing lists of paths. These paths are used by GHC itself, and not by the compiled binary. (They are compiler lookup paths, rather than RPATHS or something that does matter to the compiled binary, and thus would legitamentally be target-sensative.) As such, the path-splitting method only depends on where GHC runs and not where code it produces runs. This should have been `HOST` all along. 3. Changing the RTS. The RTS doesn't care about the target platform, full stop. 4. `includes/stg/HaskellMachRegs.h` This file is also included in the genapply executable. This is tricky because the RTS's host platform really is that utility's target platform. so that utility really really isn't multi-target either. But at least it isn't an installed part of GHC, but just a one-off tool when building the RTS. Lying with the `HOST` to a one-off program (genapply) that isn't installed doesn't seem so bad. It's certainly better than the other way around of lying to the RTS though not to genapply. The RTS is more important, and it is installed, *and* this header is installed as part of the RTS.
* Fix two more `#ifndef` for the linterJohn Ericson2019-07-091-2/+2
|
* Fix #16511: changes in interface dependencies should trigger recompilationPhuong Trinh2019-07-0911-32/+160
| | | | | | | If the union of dependencies of imported modules change, the `mi_deps` field of the interface files should change as well. Because of that, we need to check for changes in this in recompilation checker which we are not doing right now. This adds a checks for that.
* Use an empty data type in TTG extension constructors (#15247)Ryan Scott2019-07-0976-2129/+2211
| | | | | | | | | | | | | | | To avoid having to `panic` any time a TTG extension constructor is consumed, this MR introduces an uninhabited 'NoExtCon' type and uses that in every extension constructor's type family instance where it is appropriate. This also introduces a 'noExtCon' function which eliminates a 'NoExtCon', much like 'Data.Void.absurd' eliminates a 'Void'. I also renamed the existing `NoExt` type to `NoExtField` to better distinguish it from `NoExtCon`. Unsurprisingly, there is a lot of code churn resulting from this. Bumps the Haddock submodule. Fixes #15247.
* Add test for old issue w/ bad source locations for warnings in .lhs files (#515)Kevin Buhr2019-07-083-0/+28
|
* Bump Shake and copy instead of hard link from cloud cacheDavid Eichmann2019-07-082-1/+11
| | | | | | | | | This is important as in hard link mode shake makes all such files read only to avoid accidentally modifying cache files via the hard link. It turns out, many Hadrian rules attempt read access to such files and hence fail in the hard link mode. These rules could be refactored to avoid write access, but using copy instead of hard link a much simpler solution.
* Fix #16895 by checking whether infix expression operator is a variablenineonine2019-07-0514-11/+108
|
* More sensible SrcSpans for recursive pattern synonym errors (#16900)Ryan Scott2019-07-054-6/+26
| | | | | | | | Attach the `SrcSpan` of the first pattern synonym binding involved in the recursive group when throwing the corresponding error message, similarly to how it is done for type synonyms. Fixes #16900.
* Make all submodules have absolute URLsArtem Pelenitsyn2019-07-051-27/+27
| | | | | | | | | | | | | The relative URLs were a workaround to let most contributors fork from Github due to a weakness in the haskell.org server. This workaround is no longer needed. And relative submodule URLs are an impediment to forking which makes contributions harder than they should be. The URLs are chosen to clone from https, because this makes sure that anybody, even not a registered Gitlab user, can clone a fork recursively.
* Dont gather ticks when only striping them in STG.Andreas Klebinger2019-07-043-5/+11
| | | | | | | | | Adds stripStgTicksTopE which only returns the stripped expression. So far we also allocated a list for the stripped ticks which was never used. Allocation difference is as expected very small but present. About 0.02% difference when compiling with -O.
* Fix over-eager implication constraint discardSimon Peyton Jones2019-07-048-5/+98
| | | | | | | | Ticket #16247 showed that we were discarding an implication constraint that had empty ic_wanted, when we still needed to keep it so we could check whether it had a bad telescope. Happily it's a one line fix. All the rest is comments!
* rts: Fix -hT option with profiling rtsDaniel Gröber2019-07-041-4/+1
| | | | | | | | | | | In dumpCensus we switch/case on doHeapProfile twice. The second switch tries to barf on unknown doHeapProfile modes but HEAP_BY_CLOSURE_TYPE is checked by the first switch and not included in the second. So when trying to pass -hT to the profiling rts it barfs. This commit simply merges the two switches into one which fixes this problem.
* Add a missing zonk (fixes #16902)Simon Peyton Jones2019-07-044-10/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | In the eager unifier, when unifying (tv1 ~ tv2), when we decide to swap them over, to unify (tv2 ~ tv1), I'd forgotten to ensure that tv1's kind was fully zonked, which is an invariant of uUnfilledTyVar2. That could lead us to build an infinite kind, or (in the case of #16902) update the same unification variable twice. Yikes. Now we get an error message rather than non-termination, which is much better. The error message is not great, but it's a very strange program, and I can't see an easy way to improve it, so for now I'm just committing this fix. Here's the decl data F (a :: k) :: (a ~~ k) => Type where MkF :: F a and the rather error message of which I am not proud T16902.hs:11:10: error: • Expected a type, but found something with kind ‘a1’ • In the type ‘F a’
* Produce all DerivInfo in tcTyAndClassDeclsVladislav Zavialov2019-07-049-547/+561
| | | | | | | | | | | | | | | Before this refactoring: * DerivInfo for data family instances was returned from tcTyAndClassDecls * DerivInfo for data declarations was generated with mkDerivInfos and added at a later stage of the pipeline in tcInstDeclsDeriv After this refactoring: * DerivInfo for both data family instances and data declarations is returned from tcTyAndClassDecls in a single list. This uniform treatment results in a more convenient arrangement to fix #16731.
* gitlab: Reduce size of template headingsBen Gamari2019-07-042-6/+6
|
* Make printer untag when chasing a pointer in a RET_FUN frameSiddharth Bhat2019-07-041-1/+1
| | | | | This is to mimic what `Scav.c` does. This should fix a crash in the printer.
* Bump parsec submodule to 3.1.14.0Ben Gamari2019-07-041-0/+0
|
* Bump template-haskell version to 2.16.0.0Ryan Scott2019-07-034-4/+4
| | | | | | | Commit cef80c0b9edca3d21b5c762f51dfbab4c5857d8a debuted a breaking change to `template-haskell`, so in order to guard against it properly with CPP, we need to bump the `template-haskell` version number accordingly.
* gitlab-ci: Fix doc-tarball jobBen Gamari2019-07-032-2/+4
| | | | | | | Previously we used the deb9-debug job which used the `validate` build flavour which disabled `BUILD_SPHINX_PDF`. Fix this. Fixes #16890.
* Add support for SIMD operations in the NCGAbhiroop Sarkar2019-07-0345-246/+1512
| | | | | | | This adds support for constructing vector types from Float#, Double# etc and performing arithmetic operations on them Cleaned-Up-By: Ben Gamari <ben@well-typed.com>
* Hadrian: disable cloud build cache for symlinks #16800David Eichmann2019-07-021-0/+4
| | | | | This is a temporary workaround shake not supporting symlinks when using cloud/cached builds.
* Fix stage 1 warningsÖmer Sinan Ağacan2019-07-022-2/+6
|
* Add test for #16575Eric Wolf2019-07-024-0/+54
| | | | | just use the test to show the defective behaviour, so we can see the difference, when it gets fixed
* Fix #15843 by extending Template Haskell AST for tuples to support sectionsnineonine2019-07-0213-40/+201
|
* Apply suggestion to rts/linker/Elf.cBen Gamari2019-07-021-0/+3
|
* Apply suggestion to rts/linker/elf_got.cBen Gamari2019-07-021-0/+1
|
* No atomics on arm32; this will just yield stubs.Moritz Angermann2019-07-021-0/+2
| | | | | | | | | | | | | | | As such the internal linker will fail for them. The alternative would be to implement them as stubs in the linker and have them barf when called. > Not all operations are supported by all target processors. If a particular operation cannot be implemented on the target processor, a warning is generated and a call an external function is generated. The external function carries the same name as the built-in version, with an additional suffix ‘_n’ where n is the size of the data type. (https://gcc.gnu.org/onlinedocs/gcc/_005f_005fsync-Builtins.html)
* Lookup _GLOBAL_OFFSET_TABLE by symbol->addr when doing relocationsEdward Amsden2019-07-021-1/+1
|
* Add _GLOBAL_OFFSET_TABLE_ supportMoritz Angermann2019-07-022-5/+38
| | | | | | | This adds lookup logic for _GLOBAL_OFFSET_TABLE_ as well as relocation logic for R_ARM_BASE_PREL and R_ARM_GOT_BREL which the gnu toolchain (gas, gcc, ...) prefers to produce. Apparently recent llvm toolchains will produce those as well.
* rts: Assert that LDV profiling isn't used with parallel GCwip/memory-barriersBen Gamari2019-06-281-0/+3
| | | | | I'm not entirely sure we are careful about ensuring this; this is a last-ditch check.
* Correct closure observation, construction, and mutation on weak memory machines.Travis Whitaker2019-06-2831-56/+361
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Here the following changes are introduced: - A read barrier machine op is added to Cmm. - The order in which a closure's fields are read and written is changed. - Memory barriers are added to RTS code to ensure correctness on out-or-order machines with weak memory ordering. Cmm has a new CallishMachOp called MO_ReadBarrier. On weak memory machines, this is lowered to an instruction that ensures memory reads that occur after said instruction in program order are not performed before reads coming before said instruction in program order. On machines with strong memory ordering properties (e.g. X86, SPARC in TSO mode) no such instruction is necessary, so MO_ReadBarrier is simply erased. However, such an instruction is necessary on weakly ordered machines, e.g. ARM and PowerPC. Weam memory ordering has consequences for how closures are observed and mutated. For example, consider a closure that needs to be updated to an indirection. In order for the indirection to be safe for concurrent observers to enter, said observers must read the indirection's info table before they read the indirectee. Furthermore, the entering observer makes assumptions about the closure based on its info table contents, e.g. an INFO_TYPE of IND imples the closure has an indirectee pointer that is safe to follow. When a closure is updated with an indirection, both its info table and its indirectee must be written. With weak memory ordering, these two writes can be arbitrarily reordered, and perhaps even interleaved with other threads' reads and writes (in the absence of memory barrier instructions). Consider this example of a bad reordering: - An updater writes to a closure's info table (INFO_TYPE is now IND). - A concurrent observer branches upon reading the closure's INFO_TYPE as IND. - A concurrent observer reads the closure's indirectee and enters it. (!!!) - An updater writes the closure's indirectee. Here the update to the indirectee comes too late and the concurrent observer has jumped off into the abyss. Speculative execution can also cause us issues, consider: - An observer is about to case on a value in closure's info table. - The observer speculatively reads one or more of closure's fields. - An updater writes to closure's info table. - The observer takes a branch based on the new info table value, but with the old closure fields! - The updater writes to the closure's other fields, but its too late. Because of these effects, reads and writes to a closure's info table must be ordered carefully with respect to reads and writes to the closure's other fields, and memory barriers must be placed to ensure that reads and writes occur in program order. Specifically, updates to a closure must follow the following pattern: - Update the closure's (non-info table) fields. - Write barrier. - Update the closure's info table. Observing a closure's fields must follow the following pattern: - Read the closure's info pointer. - Read barrier. - Read the closure's (non-info table) fields. This patch updates RTS code to obey this pattern. This should fix long-standing SMP bugs on ARM (specifically newer aarch64 microarchitectures supporting out-of-order execution) and PowerPC. This fixes issue #15449. Co-Authored-By: Ben Gamari <ben@well-typed.com>