summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Second optimizationwip/T12919Ben Gamari2017-10-061-1/+5
|
* Quickly stub out optimization suggested by RichardBen Gamari2017-10-061-0/+50
|
* Make it compileBen Gamari2017-10-061-6/+2
|
* Fix #12919 by making the flattener homegeneous.Richard Eisenberg2017-09-2818-653/+1143
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changes a key invariant of the flattener. Previously, flattening a type meant flattening its kind as well. But now, flattening is always homogeneous -- that is, the kind of the flattened type is the same as the kind of the input type. This is achieved by various wizardry in the TcFlatten.flatten_many function, as described in Note [flatten_many]. There are several knock-on effects, including some refactoring in the canonicalizer to take proper advantage of the flattener's changed behavior. In particular, the tyvar case of can_eq_nc' no longer needs to take casts into account. Another effect is that flattening a tyconapp might change it into a casted tyconapp. This might happen if the result kind of the tycon contains a variable, and that variable changes during flattening. Because the flattener is homogeneous, it tacks on a cast to keep the tyconapp kind the same. However, this is problematic when flattening CFunEqCans, which need to have an uncasted tyconapp on the LHS and must remain homogeneous. The solution is a more involved canCFunEqCan, described in Note [canCFunEqCan]. This patch fixes #13643 (as tested in typecheck/should_compile/T13643) and the panic in typecheck/should_compile/T13822 (as reported in #14024). Actually, there were two bugs in T13822: the first was just some incorrect logic in tryFill (part of the unflattener) -- also fixed in this patch -- and the other was the main bug fixed in this ticket. The changes in this patch exposed a long-standing flaw in OptCoercion, in that breaking apart an AppCo sometimes has unexpected effects on kinds. See new Note [EtaAppCo] in OptCoercion, which explains the problem and fix. Also here is a reversion of the major change in 09bf135ace55ce2572bf4168124d631e386c64bb, affecting ctEvCoercion. It turns out that making the flattener homogeneous changes the invariants on the algorithm, making the change in that patch no longer necessary. This patch also fixes #14038, and hence #13910 and #13938.
* Fix #13391 by checking for kind-GADTsRichard Eisenberg2017-09-2811-9/+71
| | | | | | | The check is a bit gnarly, but I couldn't think of a better way. See the new code in TcTyClsDecls. test case: polykinds/T13391
* configure: Make sure we try all possible linkersBen Gamari2017-09-271-18/+41
| | | | | | | | | | | | | | | | | | | | Previously if we had both ld.lld and ld.gold installed but a gcc which didn't support -fuse-ld=lld we would fail when trying ld.lld and fall immediately back to plain ld. Now we will try ld.gold as well. This was brought to light by #14280, where using ld.bfd resulted in a broken stage2 compiler. Test Plan: Configure Reviewers: angerman, hvr, austin Reviewed By: angerman Subscribers: rwbarton, thomie, erikd GHC Trac Issues: #14280 Differential Revision: https://phabricator.haskell.org/D4038
* base: fdReady(): Ensure and doc that return values are always -1/0/1Niklas Hambüchen2017-09-271-2/+5
| | | | | | | | | | Reviewers: bgamari, austin, hvr, Phyx Reviewed By: Phyx Subscribers: Phyx, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D4010
* fdReady(): Fix some C -Wconversion warnings.Niklas Hambüchen2017-09-271-7/+8
| | | | | | | | | | | | | Btw, -Wconversion is off by default and not included in -Wall, -Wextra or -pedantic, so I used it temporarily with -optc-Wconversion. Reviewers: bgamari, austin, hvr Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3965
* Add TODO about getMonotonicNSec() wrapping that can no longer happen.Niklas Hambüchen2017-09-271-0/+5
| | | | | | | | | | | | | | | | Knowing this is important for followup commits, where we will subtract getProcessElapsedTime() values from each other, in a way that assumes that there is no wrapping every 49 days. Reviewers: bgamari, austin, erikd, simonmar, NicolasT Reviewed By: bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #14233 Differential Revision: https://phabricator.haskell.org/D3964
* Move check-ppr and check-api-annotations to testsuite/utilsBen Gamari2017-09-2713-45/+76
| | | | | | | | | | | | | | | | | These are needed by the testsuite and consequently must be shipped in the testsuite tarball to ensure that we can test binary distributions. See #13897. Test Plan: Validate Reviewers: austin Subscribers: snowleopard, rwbarton, thomie GHC Trac Issues: #13897 Differential Revision: https://phabricator.haskell.org/D4039
* TypofixesGabor Greif2017-09-2711-19/+19
|
* llvm-targets: drop soft-floatMoritz Angermann2017-09-272-5/+18
| | | | | | | | | | | | | | | | | | Summary: The llvm-targets file records `mattr` values, and while interrogating `clang` for the target, we might stumble upon `+soft-float-abi`, however ghc does not support full soft-float, and as such passing `+soft-float` to `llc` will result in segfaults for any function passing float registers F1, ... in the ARM Instruction Selection Pass. Reviewers: bgamari, austin Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D4030
* GHC_LLVM_TARGET: Keep android OSMoritz Angermann2017-09-271-0/+8
| | | | | | | | | | | | | | | Summary: Our usual GHC_CONVERT_OS macro, will turn any andoird* into android. This however drops the essential androideabi part. As such for the GHC_LLVM_TARGET we only convert the VENDOR, not the OS. Reviewers: bgamari, austin, hvr Reviewed By: bgamari Subscribers: rwbarton, thomie, erikd Differential Revision: https://phabricator.haskell.org/D4031
* Switch VEH to VCH and allow disabling of SEH completely.Tamar Christina2017-09-269-12/+127
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Exception handling on Windows is unfortunately a bit complicated. But essentially the VEH Handlers we currently have are running too early. This was a problem as it ran so early it also swallowed C++ exceptions and other software exceptions which the system could have very well recovered from. So instead we use a sequence of chains to for the exception handlers to run as late as possible. You really can't get any later than this. Please read the comment in the patch for more details. I'm also providing a switch to allow people to turn off the exception handling entirely. In case it does present a problem with their code. (Reverted and recommitted to fix authorship information) Test Plan: ./validate Reviewers: austin, hvr, bgamari, erikd, simonmar Reviewed By: bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #13911, #12110 Differential Revision: https://phabricator.haskell.org/D3911
* Revert "Switch VEH to VCH and allow disabling of SEH completely."Ben Gamari2017-09-269-127/+12
| | | | | | Reverting to fix authorship of commit. This reverts commit 1825cbdbdf08ed4bd6fd6794852596078953298a.
* rts: Throw proper HeapOverflow exception on allocating large arrayBen Gamari2017-09-263-36/+79
| | | | | | | | | | | | Test Plan: Validate, add tests Reviewers: simonmar, austin, erikd Reviewed By: simonmar Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D4021
* desugar: Catch levity polymorphism in unboxed sum expressionsBen Gamari2017-09-263-6/+18
| | | | Fixes #13929.
* base: fdReady(): Add note about O_NONBLOCK requirementNiklas Hambüchen2017-09-261-1/+5
| | | | | | | | | | Reviewers: bgamari, austin, hvr Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3962
* Switch VEH to VCH and allow disabling of SEH completely.Ben Gamari2017-09-269-18/+133
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Exception handling on Windows is unfortunately a bit complicated. But essentially the VEH Handlers we currently have are running too early. This was a problem as it ran so early it also swallowed C++ exceptions and other software exceptions which the system could have very well recovered from. So instead we use a sequence of chains to for the exception handlers to run as late as possible. You really can't get any later than this. Please read the comment in the patch for more details. I'm also providing a switch to allow people to turn off the exception handling entirely. In case it does present a problem with their code. Test Plan: ./validate Reviewers: austin, hvr, bgamari, erikd, simonmar Reviewed By: bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #13911, #12110 Differential Revision: https://phabricator.haskell.org/D3911
* rts: Silence missing __noreturn__ warningBen Gamari2017-09-261-1/+1
| | | | | | | | Reviewers: angerman, austin, erikd, simonmar Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D4034
* Rules: Show the binder type in the unbound template binder errorBen Gamari2017-09-261-1/+1
| | | | | | | | Reviewers: austin Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D4013
* Release console for ghci wrapperTamar Christina2017-09-266-8/+26
| | | | | | | | | | | | | | | | | | | | | | Summary: It seems the call that caused issues with the gcc wrapper before was needed for the ghci wrapper in order for the child process to be the one handling console events. This code slightly refactors the wrappers to make sure only ghci calls FreeConsole and nothing else. Test Plan: ./validate , open ghci.exe press ctrl+c Reviewers: RyanGlScott, austin, hvr, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie, erikd GHC Trac Issues: #14150 Differential Revision: https://phabricator.haskell.org/D4028
* TcInteract: Remove redundant import of TypeableBen Gamari2017-09-261-1/+1
|
* testsuite: Add test for #14272Ben Gamari2017-09-262-0/+9
| | | | | | | | | | Reviewers: austin Subscribers: rwbarton, thomie GHC Trac Issues: #14272 Differential Revision: https://phabricator.haskell.org/D4027
* PrelRules: Handle Int left shifts of more than word-size bitsBen Gamari2017-09-261-8/+14
| | | | | | | | | | | | | | | This should result in zero. Failing to realize this caused us to try to constant-fold via the normal path, resulting in #14272. Test Plan: Validate with coming tests Reviewers: austin, simonpj Subscribers: simonpj, rwbarton, thomie, hvr GHC Trac Issues: #14272 Differential Revision: https://phabricator.haskell.org/D4025
* rts: Inform kernel that we won't need reserved address spaceBen Gamari2017-09-261-0/+13
| | | | | | | | | | | | | | | | | | | | | Trac #14192 points out that currently GHC's two-step allocator results in extremely large coredumps. It seems like WebKit may have encountered similar issues and their apparent solution uses madvise(MADV_DONTNEED) while reserving address space to inform the kernel that the address space we just requested needs no backing. Perhaps this is used by the core dump logic to trim out uncommitted pages. Test Plan: Validate, try core-dumping a compiled executable Reviewers: austin, erikd, simonmar Reviewed By: simonmar Subscribers: rwbarton, thomie GHC Trac Issues: #14192, #14193 Differential Revision: https://phabricator.haskell.org/D3929
* primops: Add some notes regarding the meaning of the "type" fieldBen Gamari2017-09-261-0/+8
| | | | | | The overloading of "monadic" definitely deserved some explanation. [skip ci]
* StgCmmMonad: Remove unnecessary use of unboxed tuplesBen Gamari2017-09-262-55/+24
| | | | | | | | | | | | | | | The simplifier can simplify this without any trouble. Moreover, the unboxed tuples cause bootstrapping issues due #14123. I also went ahead and inlined a few definitions into the Monad instance. Test Plan: Validate Reviewers: austin, simonmar Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D4026
* Omit Typeable from the "naturally coherent" listSimon Peyton Jones2017-09-262-31/+70
| | | | | | | | | | | | | | | In doing something else (Trac #14218) I tripped over the definition of "naturally coherent" classes. This patch - Cocuments properly what that means - Removes Typeable from the list, because now we know what it meams, Typeable clearly doesn't belong. No regressions. (Actually the term "naturally coherent" seems a bit off. More like "invertible" or something. But I left it.)
* A bunch of typofixesGabor Greif2017-09-2654-68/+68
|
* testsuite: Expect T13168 to be broken on WindowsBen Gamari2017-09-251-1/+2
| | | | Spurious output pertaining to dynamic linking causes it to fail. See #14276.
* configure: Don't hard-code strip toolBen Gamari2017-09-253-1/+14
| | | | | | | | | | | | | | For reasons that I don't entirely understand we didn't previously detect `strip` using autoconf. This naturally broke during cross-compilation. How did this ever work? I have no idea. Test Plan: Try cross-compiling Reviewers: austin, hvr, angerman Subscribers: rwbarton, thomie, erikd Differential Revision: https://phabricator.haskell.org/D4008
* configure: Catch case where LLVM tools can't be foundBen Gamari2017-09-251-1/+3
| | | | | | | | | | | | | | Previously we didn't specify the prog-not-found value passed to AC_CHECK_TOOLS. Reported by @snowleopard in https://github.com/snowleopard/hadrian/issues/415. Test Plan: validate Reviewers: austin, hvr Subscribers: rwbarton, thomie, snowleopard, erikd Differential Revision: https://phabricator.haskell.org/D3992
* Use SIGQUIT for DWARF backtraces instead of SIGUSR2Ben Gamari2017-09-253-10/+21
| | | | | | | | Reviewers: austin, erikd, simonmar Subscribers: NicolasT, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3979
* Add NOINLINE pragma to builtinRulesBen Gamari2017-09-251-0/+3
| | | | | | | | | | | | | | | | | | | As mentioned in #14275, GHC will otherwise decide to produce unfoldings for this rather large binding, making recompilation more expensive than necessary. Since inlining is almost certainly not fruitful mark it as NOINLINE. [skip ci] Test Plan: Validate Reviewers: austin Subscribers: rwbarton, thomie GHC Trac Issues: #14275 Differential Revision: https://phabricator.haskell.org/D4023
* integer-gmp: Fix styleBen Gamari2017-09-251-6/+6
| | | | | | | | | | | | Just fix a few inconsistencies that I encountered. [skip ci] Reviewers: austin, hvr, goldfire Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D4024
* Include original process name in worker thread name (#14153)Echo Nolan2017-09-251-1/+22
| | | | | | | | | | | | | | | | | | | | Prior to this commit, worker OS thread were renamed to "ghc_worker" when spawned. This was annoying when reading debugging messages that print the process name because it doesn't tell you *which* Haskell program is generating the message. This commit changes it to "original_process_name:w", truncating the original name to fit in the kernel buffer if neccesary. Test Plan: ./validate Reviewers: austin, bgamari, erikd, simonmar Reviewed By: bgamari Subscribers: Phyx, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D4001
* Document Typeable's treatment of kind polymorphic tyconsBen Gamari2017-09-251-0/+53
| | | | | | | | | | | | | | Test Plan: Read it Reviewers: dfeuer, goldfire, austin, hvr Reviewed By: dfeuer Subscribers: rwbarton, thomie GHC Trac Issues: #14199 Differential Revision: https://phabricator.haskell.org/D3991
* Adds mingw64 to the valid GHC OSs.Moritz Angermann2017-09-261-0/+4
| | | | | | | | | | | | | | | Summary: This fixes hadrian#420 (https://github.com/snowleopard/hadrian/issues/420) specifically the "Unknown OS mingw64". Reviewers: austin, hvr, bgamari, Phyx Reviewed By: Phyx Subscribers: rwbarton, thomie, erikd Differential Revision: https://phabricator.haskell.org/D4016
* Fix the searching of target AR toolTamar Christina2017-09-262-7/+13
| | | | | | | | | | | | | | | | | | | | Summary: Ar was being checked twice prior to D3883 where I removed one of the checks because the converted path was being overridden after the check because of the second check for Ar. However the one in configure.ac was a target check so I'm changing the path check to a target check now. Test Plan: ./configure Reviewers: angerman, austin, hvr, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie, erikd GHC Trac Issues: #14274 Differential Revision: https://phabricator.haskell.org/D4020
* Ensure text mode when calling debug functionsTamar Christina2017-09-251-6/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Something seems to be changing stderr into binary mode, so when the `traceIO` is called, the C code that ultimately calls `vfprintf` is using a binary mode handle. This causes newlines not to be encoded properly. The patch ensures we're in text mode when writing the debug messages (% interleaving as it's not thread safe at all) and restores the previous mode when done. I'm slightly concerned about the performance implications of writing large dumps out in text mode, but I think the current behavior is not intended as I cannot see any of the printing code setting the mode of the std handles. Test Plan: ./validate Reviewers: austin, bgamari, erikd, simonmar Reviewed By: bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #14188 Differential Revision: https://phabricator.haskell.org/D4018
* Bump template-haskell to 2.13.0.0Ryan Scott2017-09-254-5/+5
| | | | | | | | | | | | | | | Summary: Now that `MonadIO` is a superclass of `Quasi`, it's a good time to bump the `template-haskell` version so that libraries can accommodate the change using CPP. Test Plan: ./validate Reviewers: bgamari, austin Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D4007
* Document how GHC disambiguates between multiple COMPLETE setsRyan Scott2017-09-252-1/+49
| | | | | | | | | | | | | | | | | | | | | Summary: Up until now, the knowledge of how GHC chooses which `COMPLETE` set to use in the presence of multiple applicable `COMPLETE` sets for a single data type constructor was only documented in the GHC wiki. But this really should be advertised to anyone who uses `COMPLETE` pragmas heavily, so per SPJ's advice in https://ghc.haskell.org/trac/ghc/ticket/14253#comment:10, this adds this wisdom to the GHC users' guide. Test Plan: Read it Reviewers: austin, bgamari Subscribers: mpickering, rwbarton, thomie GHC Trac Issues: #14253 Differential Revision: https://phabricator.haskell.org/D4005
* Fix solving of implicit parameter constraintsSimon Peyton Jones2017-09-259-103/+214
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Trac #14218 showed that we were not solving implicit-parameter constraints correctly. In particular, - A tuple constraint could "hide" an implicit-parameter wanted constraint, and that in turn could that we solved it from the wrong implicit-parameter binding. - As a special case the HasCallStack constraint (which is just short for (IP "callStack" CallStack), was getting mis-solved. The big change is to arrange that, in TcSMonad.findDict when looking for a dictionary, either when looking for a matching inert or solved dictionary, we fail for - Tuples that are hiding implicit parameters See Note [Tuples hiding implicit parameters] - HasCallStack constraints where we have not yet pushed on the call-site info See Note [Solving CallStack constraints] I also did a little refactoring * Move naturallyCoherentClass from Class to TcInteract, its sole use site. Class.hs seems like the wrong place. (And I also do not understand the reason that we need the eq/Coercible/ Typable stuff in this predicate, but I'll tackle that separately.) * Move the code that pushes call-site info onto a call stack from the "interact" part to the "canonicalise" part of the solver.
* Improve type-error reportingSimon Peyton Jones2017-09-2519-101/+129
| | | | | | | | | | | This patch does two things: * When reporting a hole, we now include its kind if the kind is not just '*'. This addresses Trac #14265 * When reporting things like "'a' is a rigid type varaible bound by ...", this patch arranges to group the type variables together, so we don't repeat the "bound by..." stuff endlessly
* Comments onlySimon Peyton Jones2017-09-251-1/+1
|
* Make pprQuotedList use fsep not hsepSimon Peyton Jones2017-09-251-1/+1
| | | | This just does wrapping on very long lists
* Deal with large extra-contraints wildcardsSimon Peyton Jones2017-09-257-15/+210
| | | | | | | | | | | | | | | For reasons explained in TcHsType Note [Extra-constraint holes in partial type signatures], if we had f :: (_) => blahs and the '_' was filled in by more than a 62-tuple of contraints, GHC crashed. The same Note explains the hacky solution I have adopted to evade this. Maybe there is some better way, but I couldn't see one that didn't involve a great deal of work. And the problem is a very narrow one! If the hack bites us we'll need to think again.
* don't allow AsmTempLabel in UNREG mode (Trac #14264)Sergei Trofimovich2017-09-241-0/+2
| | | | | | | | | | | | | AsmTempLabel is really a label that describes label in assembly output (or equivalent like LLVM IR). Unregisterised build does not handle it correctly. This change does not fix UNREG build failure in Ticket #14264 but reverts back to panic: pprCLbl AsmTempLabel Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* Revert "Typeable: Allow App to match arrow types"Herbert Valerio Riedel2017-09-245-88/+6
| | | | | | | | | This reverts commit cc6be3a2f23c9b2e04f9f491099149e1e1d4d20b. because it caused the regression #14270 which according to Richard probably doesn't have an easy fix. So this one goes back to the drawning board. This reopens #14236