I was seeing coercions like Nth 3 ((c2 -> c2) ; (c3 -> c4)) which made me realise that optCoercion was doing a bad job of the (relatively new) FunCo. In particular, opt_trans_rule needs a FunCo/FunCo case, to go with the TyConAppCo/TyConAppCo case. Easy. No behavioural change, some coercions will get smaller
Abandon typedefing the {Section,ObjectCode}FormatInfo structs
Summary: This is a follow-up to @angerman 's refactoring for ELF that happened with e5e8646 My previous commit a6675a9 corrected a typedef redefinition issue with GCC v4.4 (which is pervasive with RHEL 6). Now the problem has resurfaced. Instead of dancing after the different compiler's pipe, I decided to eliminate the typedefs altogether and refer to the struct namespace explicitly. Added a note to describe why typedefs are not applied on customisable structs. Reviewers: austin, bgamari, erikd, simonmar Subscribers: rwbarton, thomie, angerman Differential Revision: https://phabricator.haskell.org/D3527
Deal with exceptions in dsWhenNoErrs
Gracious me. Ever since this patch commit 3744578 Author: Jan Stolarek <jan.stolarek@p.lodz.pl> Date: Fri Jul 11 13:54:45 2014 +0200 Injective type families TcRnMonad.askNoErrs has been wrong. It looked like this askNoErrs :: TcRn a -> TcRn (a, Bool) askNoErrs m = do { errs_var <- newTcRef emptyMessages ; res <- setErrsVar errs_var m ; (warns, errs) <- readTcRef errs_var ; addMessages (warns, errs) ; return (res, isEmptyBag errs) } The trouble comes if 'm' throws an exception in the TcRn monad. Then 'errs_var is never read, so any errors are simply lost. This mistake was then propgated into DsMonad.dsWhenNoErrs, where it gave rise to Trac #13642. Thank to Ryan for narrowing it down so sharply. I did some refactoring, as usual.
Comments only, about Typeable/TypeRep/KindRep
Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #13320 Differential Revision: https://phabricator.haskell.org/D3532
We gave up on typedefing {Section,ObjectCode}FormatInfo structs but
MachO never got the memo.Add an Eq instance for UniqSet
I left that out by mistake, and it apparently breaks at least one existing plugin. Reviewers: christiaanb, austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3518
Pass -ffrontend-opt arguments to frontend plugin in the correct order
Previously they were passed in the reverse order that they're specified on the command line. Add a haddock to frontendPluginOpts in DynFlags.hs. Modify test frontend01 to cover the case of multiple -ffrontend-opt. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #13632 Differential Revision: https://phabricator.haskell.org/D3520
user-guide: fix links to compact region
There were broken links in users_guide for compact region. * Data-Compact -> GHC-Compact * compact-@LIBRARY_compact_VERSION@ -> ghc-compact-@LIBRARY_compact_VERSION@ This commit is for ghc-8.2 branch. Test Plan: build Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3521
Fix comment for compact region
There were old module names: * Data.Compact -> GHC.Compact * Data.Compact.Internal -> GHC.Compact This commit is for ghc-8.2 branch. Test Plan: build Reviewers: austin, bgamari, hvr, erikd, simonmar Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3522
Add regression test for #11616
The code in #11616 has been working for a while (ever since 8.0.1), so let's add a regression test for it to put the nail in the coffin. Test Plan: make test TEST=T11616 Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #11616 Differential Revision: https://phabricator.haskell.org/D3531
Fix markdown for new GitHub Flavored Markdown
Delete whitespace between brackets. Because Github Flavored Markdown was changed [1]. [1]: https://githubengineering.com/a-formal-spec-for-github-markdown/ Test Plan: build Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3534
Implement sequential name lookup properly
Previously we would run all the monadic actions and then combine their results. This caused problems if later actions raised errors but earlier lookups suceeded. We only want to run later lookups if the earlier ones fail. Fixes #13622 Reviewers: RyanGlScott, austin, bgamari, simonpj Reviewed By: simonpj Subscribers: simonpj, rwbarton, thomie GHC Trac Issues: #13622 Differential Revision: https://phabricator.haskell.org/D3515
hpc: Output a legend at the top of output files
Updates hpc submodule. Reviewers: austin, bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #11799 Differential Revision: https://phabricator.haskell.org/D3465
CoreTidy: Don't seq unfoldings
Previously we would force uf_is_value and friends to ensure that we didn't retain a reference to the pre-tidying template, resulting in a space leak. Instead, we now just reinitialize these fields (despite the fact that they should not have changed). This may result in a bit more computation, but most of the time we won't ever evaluate them anyways, so the damage shouldn't be so bad. See #13564.
Simon pointed out that the zonk of the tyConKinds was redundant as tycon kinds will never contain mutable variables. This allows us to remove tycon_kind. Add a few commments clarifying the need to bring TyCon binders into scope before typechecking bindings.
Add regression tests for #12947, #13640
Summary: Commit b4bdbe4 (the fix for #12156) wound up being the fix for #12947 and #13640 as well. This adds regression tests for the latter two tickets to keep them fixed. Test Plan: make test TEST="T12947 T13640" Reviewers: bgamari, austin Reviewed By: bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #12947, #13640 Differential Revision: https://phabricator.haskell.org/D3528
Add testsuite/timeout/TimeMe to .gitignore
Summary: If you run `make test` on a non-Windows OS from a fresh build, the testsuite will create an executable called `TimeMe` which `git` thinks is an untracked file. Let's add it to `.gitignore` to avoid polluting the list of untracked files. Test Plan: Run `make test`, check if `TimeMe` is in the `git` untracked files Reviewers: bgamari, austin Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3536
Add regression test for #13651
Commit eb55ec2 ended up fixing #13651, so let's add a regression test for it.
testsuite: add new test for desugar warnings/errors with -fno-code
Add a new (expect_broken) test T10600 that checks that the error: Top-level bindings for unlifted types aren't allowed: is thrown when compiling with -fno-code. This test currently fails because modules compiled with -fno-code aren't desugared. There are several other errors which can be thrown during desugaring that aren't tested for, discoverable by grepping for "errDs". Update .stderr files T8101 and T8101b. Presumably the compilation output has changed slightly since they were written. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #10600, #8101 Differential Revision: https://phabricator.haskell.org/D3533
base: Fix documentation for forkIOWithUnmask
forkIOUnmasked has been deprecated for several years now. Update reference to it. See #4858 and #5546.
There may be some subtlety I'm not seeing with the usage of center vs centre. Otherwise this makes it more consistent in the docs. There's one instance in 8.0.2-notes.rst, but I'm not sure if we want to modify it retroactively. Test Plan: harbormaster? Reviewers: bgamari, austin Reviewed By: bgamari Subscribers: rwbarton, thomie, simonmar Differential Revision: https://phabricator.haskell.org/D3548
OptCoercion: Ensure that TyConApps match in arity
Previously OptCoercion would potentially change the type of UnivCo coercions of the shape, ``` co :: TyCon arg1 ... argN ~ TyCon arg1' ... argN' ``` where the arities of the left and right applications differ. In this case we would try to zip the two argument lists, meaning that one would get truncated. One would think this could never happen since it implies we are applying the same TyCon to two different numbers of arguments. However, it does arise in the case of applications of the `Any` tycon, which arises from the typechecker (in `Data.Typeable.Internal`) where we end up with an `UnsafeCo`, ``` co :: Any (Any -> Any) Any ~ Any (Any -> Any) ``` Test Plan: Validate Reviewers: simonpj, austin, goldfire Reviewed By: simonpj Subscribers: rwbarton, thomie GHC Trac Issues: #13658 Differential Revision: https://phabricator.haskell.org/D3545
Optimize casMutVar# for single-threaded RTS
The single-threaded RTS shouldn't actually need to use CAS to implement `casMutVar#`; there are no other threads to coordinate with. Reviewers: austin, bgamari, erikd, simonmar Reviewed By: simonmar Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3544
This is two fold: - We did not catch all ARM_ARCH_6 defines. Specifically not `6K` and `6KZ`, which is what llvm seems to use these days for `arm-none-linux-gnueabihf` (e.g. the triple that's used for raspbian as well). Without it, ghc assums we want to compile against some armv7 system, which raspbian is not (it is armv6 for maximum compatibility across the pi family, compromising on using armv7 and up features). - We stop forcing the -m and -arch flags on macOS. This is troublesome, as compiling for a 32bit system (e.g. raspberry pi, on a x86_64 macOS system results in the `-m64` flag being passed to to clang as well, which in turn figures out that you likely want 64bit, and rewrites your taret from `arm-none-linux-gnueabihf` to `aarch64-none-linux-gnueabihf`, which is definetly not what you want. Reviewers: austin, hvr, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie, erikd Differential Revision: https://phabricator.haskell.org/D3546
Make XNegativeLiterals treat -0.0 as negative 0
Reviewers: austin, goldfire, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie, mpickering GHC Trac Issues: #13211 Differential Revision: https://phabricator.haskell.org/D3543
The problem originates in TcPat.find_field_ty but I don't know how to clearnly fix it. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #13644 Differential Revision: https://phabricator.haskell.org/D3535
Dataflow: use IntSet for mkDepBlocks
Using `IntSet` instead of `[Int]` is nicer since it gets rid of appending to a list (in the backward case) and folding over it is ordered. I also added a comment about how `mkDepBlocks` works since its behavior can be a bit surprising at first sight (it took me some time to see that it's doing the right thing ;) Signed-off-by: Michal Terepeta <michal.terepeta@gmail.com> Test Plan: ./validate Reviewers: austin, bgamari, simonmar Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3530
Treat banged bindings as FunBinds
This reworks the HsSyn representation to make banged variable patterns (e.g. !x = e) be represented as FunBinds instead of PatBinds, adding a flag to FunRhs to record the bang. Fixes #13594. Reviewers: austin, goldfire, alanz, simonpj Reviewed By: simonpj Subscribers: simonpj, rwbarton, thomie, mpickering Differential Revision: https://phabricator.haskell.org/D3525
Use mkSymCo in OptCoercion.wrapSym
Always use the smart constructor! Richard and I came across this omission when looking at something else.
Don't warn about variable-free strict pattern bindings
See Trac #13646 and the new Note [Pattern bindings that bind no variables]
Add regression test for Trac #13659
Make CallInfo into a data type with fields
Simple refactor, no change in behaviour
Reset cc_pend_sc flag in dropDerivedCt
I'd forgotten to reset this flag to True when dropping Derived constraints, which led to Trac #13662. Easily fixed.
Revert "CoreTidy: Don't seq unfoldings"
This reverts commit b3da6a6 as it reintroduces the original space leak.
Efficient membership for home modules
This changes the linear lookup in a list to an efficient lookup in an IntMap. The linear lookup effectively made the algorithm quadratic, which for a test case that I have (5000 modules) introduced significant slowdown. I ran 3 experiments to estimate the impact of this: "No-op", profiled, just `:load`: P146, `186s` "before", profiled, `:load` followed by 10x `:r`: P147, `315s` "after", profiled, `:load` followed by 10x `:r`: P148, `250s` Going by the math of `(250-186)/(315-186) = 50%` this is a 2x improvement on `:r`. Test Plan: ./validate Reviewers: simonmar, austin, bgamari Reviewed By: simonmar Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3562
Fix a performance bug in GhcMake.downsweep
Every time we encountered a non-home module during the downsweep, we were removing it from the finder cache. That meant we were searching the filesystem for every import, rather than once per downsweep. The fix is just to flush the finder cache before the downsweep, and repopulate it for home modules that haven't changed. Speeds up downsweep by about 25% on a large example I have. Test Plan: Harbourmaster Reviewers: bgamari, niteria, austin, erikd Reviewed By: bgamari, niteria Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3554
This is rather annoying. I'd prefer to have a stable release to use. However libffi-3.2.1 has been released November 12, 2014, and libffi-4 is TBD. See also libffi/libffi#296 The core reason for this change is that llvm changed the supported assembly to unified syntax, which libffi-3.2.1 does not use, and hence fails to compile for arm with llvm. For refence, see the following issue: libffi/libffi#191 Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie, snowleopard Differential Revision: https://phabricator.haskell.org/D3349
Do not hardcode the specific linker to use
This should be handled appropriately by a wrapper script around the compiler, if one wants to insist on the specific linker to be used. Otherwise this breaks if the used compiler fails to understand this directive. I believe that using a specific linker should be part of the compilers toolchain, we delegate to and not hardcoded here in ghc. Reviewers: dfeuer, erikd, hvr, austin, rwbarton, bgamari Reviewed By: bgamari Subscribers: snowleopard, davean, dfeuer, thomie, erikd Differential Revision: https://phabricator.haskell.org/D3351
When we load non absolute pathed .so's this usually implies that we expect the system to have them in place already, and hence we should not need to ship them. Without the absolute path to the library, we are also unable to open and send said library. Thus we'll do library shipping only for libraries with absolute paths. Reviewers: austin, bgamari, simonmar Reviewed By: simonmar Subscribers: simonmar, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3469