summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Tweak unfolding defaultswip/mpickering-unfolding-discountsMatthew Pickering2017-04-031-2/+2
|
* configure.ac: fix NCG support in --target=Sergei Trofimovich2017-04-021-1/+1
| | | | | | | | | | | | | | | Before this change attempt to build a crosscompiler on registerised platform (--host=x86_64-pc-linux-gnu) targeting UNREG platform failed: $ ./configure --target=ia64-unknown-linux-gnu utils/genapply/../../includes/stg/MachRegs.h:608:2: error: #error Cannot find platform to give register info for The change is to check --target= for NCG availability, not --host=. Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* Update containers submodule to official 0.5.10.2David Feuer2017-04-021-0/+0
| | | | | | | | | | Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3406
* Add a perf test for deriving nullDavid Feuer2017-04-023-0/+32
| | | | | | | | | | | | | | | Deriving null even helps for a simple list-like type, presumably because we don't perform the static argument transformation. Adding this test before the null deriving patch should give a proper baseline. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3408
* testsuite: Fix GhciCurDir testBen Gamari2017-04-021-1/+2
| | | | This was horribly, horribly wrong.
* :cd affects the iserv process tooSimon Marlow2017-04-023-0/+13
| | | | | | | | | | | | Test Plan: validate Reviewers: angerman, austin, bgamari, erikd Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3395
* Report heap overflow in the same way as stack overflowSimon Marlow2017-04-0211-31/+35
| | | | | | | | | | | | | | | | | | | | | | | Now that we throw an exception for heap overflow, we should only print the heap overflow message in the main thread when the HeapOverflow exception is caught, rather than as a side effect in the GC. Stack overflows were already done this way, I just made heap overflow consistent with stack overflow, and did some related cleanup. Fixes broken T2592(profasm) which was reporting the heap overflow message twice (you would only notice when building with profiling libs enabled). Test Plan: validate Reviewers: bgamari, niteria, austin, DemiMarie, hvr, erikd Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3394
* FastMutInt: fix Int and Ptr sizes when crosscompilingSergei Trofimovich2017-04-022-10/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Similar to https://ghc.haskell.org/trac/ghc/ticket/13491 https://phabricator.haskell.org/D3122 SIZEOF_HSINT and SIZEOF_VOID_P are sizes of target platform. These values are usually not correct when stage1 is built. It means the code ```haskell newFastMutInt = IO $ \s -> case newByteArray# size s of { (# s, arr #) -> (# s, FastMutInt arr #) } where !(I# size) = SIZEOF_HSINT ``` would try to allocate only 4 bytes on 64-bit-host targeting 32-bit system. It does not matter in practice as newByteArray# implementation rounds up passed value to host's word size. But one day it might not. To prevent this class of problems in compiler/ directory 'MachDeps.h' contents is hidden when ghc-stage1 (-DSTAGE=1) is built. Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> Reviewers: austin, rwbarton, simonmar, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3405
* compiler/ghc.mk: fix GhcWithInterpreter=NO build failureSergei Trofimovich2017-04-021-5/+5
| | | | | | | | | | | | When GhcWithInterpreter=NO is set in mk/build.mk build fails as: $ inplace/bin/dll-split compiler/stage2/build/.depend-v-dyn.haskell "DynFlags" ... Reachable modules from DynFlags out of date Please fix compiler/ghc.mk, or building DLLs on Windows may break (#7780) Extra modules: ByteCodeTypes InteractiveEvalTypes Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* Stamp out space leaks from demand analysisReid Barton2017-04-013-4/+25
| | | | | | | | | | | | | | | | This reduces peak memory usage by ~30% on my test case (DynFlags), and (probably as a result of reduced GC work) decreases compilation time by a few percent as well. Also fix a bug in seqStrDmd so that demeand info is fully evaluated. Reviewers: simonpj, austin, bgamari Reviewed By: bgamari Subscribers: dfeuer, thomie Differential Revision: https://phabricator.haskell.org/D3400
* Optimise common cases of GHC.setProgramDynFlagsSimon Marlow2017-04-015-41/+94
| | | | | | | | | | | | | | | | | | * If the package flags haven't changed, don't do initPackages (which might take multiple seconds in extreme cases) * Provide a way to change the log_action without invalidating the summary cache. Test Plan: validate Reviewers: niteria, bgamari, austin, erikd, ezyang Reviewed By: bgamari Subscribers: mpickering, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3392
* Don't derive showListDavid Feuer2017-04-013-11/+3
| | | | | | | | | | | | | | | | | There's no obvious reason to derive the definition of `showList`, manually inlining the default definition. Let's just use the default definition in the usual manner. Garbage collect a few unused `RdrNames` from `PrelNames`: `showList`, `showList__`, and `/=`. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: RyanGlScott, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3403
* testsuite: Add regression test for #13474Ben Gamari2017-04-012-0/+14
|
* rts: print incorrect prev_what_nextSergei Trofimovich2017-04-011-1/+1
| | | | | | | | | | Moritz Angermann reports mysterious rts crash: A: link: internal error: schedule: invalid what_next field A: (GHC version 8.3.20170321 for arm_none_linux_android) This change prints actual prev_what_next value. Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* UNREG: ignore -fllvm (Trac #13495)Sergei Trofimovich2017-04-011-1/+1
| | | | | | | | | | | | | | | | | | Unregisterised GHC can only use C as a target backend (option used to be called -fvia-C). -fasm option was ignored with a warhing, but not -fllvm. jms noticed the failure when tried to use quick-cross build flavour. quick-cross enables -fllvm in makefile. "inplace/bin/ghc-stage1" ... -fllvm ghc-stage1: panic! (the 'impossible' happened) (GHC version 8.0.2 for powerpc-unknown-linux): LlvmCodeGen.Ppr: Cross compiling without valid target info. This change ignores -fllvm as well. Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* Remove Core Lint pass on occurrence analysis output (#13220)Reid Barton2017-03-312-8/+5
| | | | | | | | | | | | | | | It was expensive, as the simplifier runs for many iterations, and probably not very useful. Test Plan: harbormaster Reviewers: austin, bgamari, dfeuer Reviewed By: dfeuer Subscribers: dfeuer, thomie Differential Revision: https://phabricator.haskell.org/D3391
* askCc should be using the linker, not the compilerSimon Marlow2017-03-312-7/+8
| | | | | | | | | | | | | | | | | When GHCi tries to find a shared lib, it calls "gcc --print-file-name" to ask gcc where to find it. But since we're looking for libraries, we're really using the linker here, not the C compiler, so we should be respecting the values of -pgml and -optl rather than -pgmc and -optc. Test Plan: validate Reviewers: bgamari, niteria, austin, hvr, erikd Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3393
* testsuite: Update Windows allocations for T12234Ben Gamari2017-03-311-2/+3
|
* Fix space leaks in simplifier (#13426)Reid Barton2017-03-312-6/+14
| | | | | | | | | | | | | | | | | | | The Join points commit (8d5cf8bf) introduced a space leak somewhere in the simplifier. The extra strictness added in this commit fixes the leak. Unfortunately I don't really understand the details. Unfortunately, the extra strictness appears to result in more overall allocations in some cases, even while the peak heap size decreases in others. Test Plan: harbormaster Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3399
* Clean up coreView/tcView.Ben Gamari2017-03-3125-125/+212
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Core, Constraint should be considered fully equal to TYPE LiftedRep, in all ways. Accordingly, coreView should unwrap Constraint to become TYPE LiftedRep. Of course, this would be a disaster in the type checker. So, where previously we used coreView in both the type checker and in Core, we now have coreView and tcView, which differ only in their treatment of Constraint. Historical note: once upon a past, we had tcView distinct from coreView. Back then, it was because newtypes were unwrapped in Core but not in the type checker. The distinction is back, but for a different reason than before. This had a few knock-on effects: * The Typeable solver must explicitly handle Constraint to ensure that we produce the correct evidence. * TypeMap now respects the Constraint/Type distinction Finished by: bgamari Test Plan: ./validate Reviewers: simonpj, austin, bgamari Reviewed By: simonpj Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3316
* Refactor simplExpr (Type ty)Simon Peyton Jones2017-03-311-16/+38
| | | | | | | | | This small refactoring, provoked by comment:18 on Trac #13426, makes it so that simplExprF never gets a (Type ty) expression to simplify, which in turn means that calls to exprType on its argument will always succeed. No change in behaviour.
* Disable bogus lint checks about levity polimorphic coerionsJoachim Breitner2017-03-311-5/+1
| | | | | | | | | | | These checks, introduced in cea7141851ce653cb20207da3591d09e73fa396d hugely inflated build logs, which incapitated perf.haskell.org. According to Richard, the checks are useless and wrong, and that Ben plans to investigate. (https://phabricator.haskell.org/rGHCcea7141851ce653cb20207da3591d09e73fa396d#64647) Until that happens, I remove them from the code.
* Deriving for phantom and empty typesDavid Feuer2017-03-3013-168/+584
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make `Functor`, `Foldable`, and `Traversable` take advantage of the case where the type parameter is phantom. In this case, * `fmap _ = coerce` * `foldMap _ _ = mempty` * `traverse _ x = pure (coerce x)` For the sake of consistency and especially simplicity, make other types with no data constructors behave the same: * `fmap _ x = case x of` * `foldMap _ _ = mempty` * `traverse _ x = pure (case x of)` Similarly, for `Generic`, * `to x = case x of` * `from x = case x of` Give all derived methods for types without constructors appropriate arities. For example, ``` compare _ _ = error ... ``` rather than ``` compare = error ... ``` Fixes #13117 and #13328 Reviewers: austin, bgamari, RyanGlScott Reviewed By: RyanGlScott Subscribers: ekmett, RyanGlScott, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3374
* Typos in comments [ci skip]Gabor Greif2017-03-305-5/+5
|
* unique: fix UNIQUE_BITS crosscompilation (Trac #13491)Sergei Trofimovich2017-03-294-7/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The #13491 manifests best when we try to crosscompile from 32-bit (i386-linux) to 64-bit (powerpc64-linux) system: ./configure --target=powerpc64-unknown-linux-gnu The build fails at assembly time: "inplace/bin/ghc-stage1" ... -c rts/StgStartup.cmm /tmp/ghc19687_0/ghc_4.s: Assembler messages: /tmp/ghc19687_0/ghc_4.s:11:0: error: Error: unknown pseudo-op: `.l' | 11 | .L<\x00>4: | ^ That happens because UNIQUE_BITS is defined in terms of WORD_SIZE_IN_BITS macro: #define UNIQUE_BITS (WORD_SIZE_IN_BITS - 8) WORD_SIZE_IN_BITS is 64 bits (equals to target value) while ghc-stage1 is still running on i386-linux The fix is to stop relying on target macros and use host's 'sizeof (HsInt)' and 'finiteBitSize' way to determine unique layout. Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> Test Plan: build i386-to-powerpc64 crosscompiler Reviewers: rwbarton, austin, bgamari Reviewed By: bgamari Subscribers: RyanGlScott, thomie Differential Revision: https://phabricator.haskell.org/D3397
* Show valid substitutions for typed holesMatthías Páll Gissurarson2017-03-2910-10/+256
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The idea is to implement a mechanism similar to PureScript, where they suggest which identifiers in scope would fit the given hole. In PureScript, they use subsumption (which is what we would like here as well). For subsumption, we would have to check each type in scope whether the hole is a subtype of the given type, but that would require `tcSubType` and constraint satisfiability checking. Currently, `TcSimplify` uses a lot of functions from `TcErrors`, so that would require more of a rewrite, I will hold on with that for now, and submit the more simpler type equality version. As an example, consider ``` ps :: String -> IO () ps = putStrLn ps2 :: a -> IO () ps2 _ = putStrLn "hello, world" main :: IO () main = _ "hello, world" ``` The results would be something like ``` • Found hole: _ :: [Char] -> IO () • In the expression: _ In a stmt of a 'do' block: _ "hello, world" In the expression: do _ "hello, world" • Relevant bindings include main :: IO () (bound at test.hs:13:1) ps :: String -> IO () (bound at test.hs:7:1) ps2 :: forall a. a -> IO () (bound at test.hs:10:1) Valid substitutions include putStrLn :: String -> IO () (imported from ‘Prelude’ at test.hs:1:1-14 (and originally defined in ‘System.IO’)) putStr :: String -> IO () (imported from ‘Prelude’ at test.hs:1:1-14 (and originally defined in ‘System.IO’)) ``` We'd like here for ps2 to be suggested as well, but for that we require subsumption. Reviewers: austin, bgamari, dfeuer, mpickering Reviewed By: dfeuer, mpickering Subscribers: mpickering, Wizek, dfeuer, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3361
* Various patches to support android cross compilationMoritz Angermann2017-03-294-6/+10
| | | | | | | | | | | | | | | | | | | | - Better test for SHT_INIT_ARRAY than openbsd_HOST_OS This is actually bens patch: https://gist.github.com/bgamari/c846e6a5f2cd988716cd5e36c68d5bef - linux-android defines. - No need for -lpthread on OSAndroid However, I’m confused why we do not use the AC NEED_PTHREAD_LIB value here? - Use mmap on android - Support `none` vendor. Reviewers: austin, hvr, bgamari, erikd, simonmar Reviewed By: bgamari Subscribers: rwbarton, thomie, erikd Differential Revision: https://phabricator.haskell.org/D3356
* Check TargetPlatform instead of HostPlatform for leading underscoreMoritz Angermann2017-03-291-1/+3
| | | | | | | | | | Reviewers: austin, hvr, rwbarton, bgamari Reviewed By: rwbarton, bgamari Subscribers: rwbarton, thomie, erikd Differential Revision: https://phabricator.haskell.org/D3348
* Allow operators as record pattern synonym fieldsMatthew Pickering2017-03-293-2/+18
| | | | | | | | | | | | Fixes #13454 Reviewers: austin, bgamari, dfeuer Reviewed By: dfeuer Subscribers: RyanGlScott, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3379
* Print module when dumping rulesMatthew Pickering2017-03-297-26/+38
| | | | | | | | | | | | | It is sometimes hard to find where a rule is defined. Printing the module where it comes from will make it much easier to find. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3378
* Fixed error messages for RecursiveDo (#8501)Rupert Horlick2017-03-2915-992/+111
| | | | | | | | | | | | | | | | | Changes in a few different places to catch several different types of error related to RecursiveDo Signed-off-by: Rupert Horlick <ruperthorlick@gmail.com> Test Plan: Three test cases, with further tests in comments Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3271
* base: Check for path separators chars in openTempFile' template stringBen Gamari2017-03-291-2/+6
| | | | This fixes #13489.
* testsuite: More 32-bit performance changesBen Gamari2017-03-292-6/+6
|
* Fix scc001Simon Marlow2017-03-292-22/+22
|
* cg057: accept outputSimon Marlow2017-03-291-2/+3
|
* Fix ASSERT failure in TcErrorsSimon Peyton Jones2017-03-294-24/+23
| | | | | | | | | | | | This fixes Trac #13494, by improving commit e0ad55f894a8d85dcc099c33c63cfe3d4515d464 Author: Simon Peyton Jones <simonpj@microsoft.com> Date: Mon Mar 27 10:32:08 2017 +0100 Fix error-message suppress on given equalities which in turn was a fix to #13446
* Add a couple of HasDebugCallStack contextsSimon Peyton Jones2017-03-292-3/+3
| | | | Just for future (and past) debugging...
* Allow unbound Refl binders in a RULESimon Peyton Jones2017-03-297-45/+260
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Trac #13410 was failing because we had a RULE with a binder (c :: t~t) and the /occurrences/ of c on the LHS were being optimised to Refl, leaving a binder that would not be filled in by matching the LHS of the rule. I flirted with trying to ensure that occurrences (c :: t~t) are not optimised to Relf, but that turned out to be fragile; it was being done, for good reasons, in multiple places, including - TyCoRep.substCoVarBndr - Simplify.simplCast - Corecion.mkCoVarCo So I fixed it in one place by making Rules.matchN deal happily with an unbound binder (c :: t~t). Quite easy. See "Coercion variables" in Note [Unbound RULE binders] in Rules. In addition, I needed to make CoreLint be happy with an bound RULE binder that is a Relf coercion variable In debugging this, I was perplexed that occurrences of a variable (c :: t~t) mysteriously turned into Refl. I found out how it was happening, and decided to move it: * In TyCoRep.substCoVarBndr, do not substitute Refl for a binder (c :: t~t). * In mkCoVarCo do not optimise (c :: t~t) to Refl. Instead, we do this optimisation in optCoercion (specifically opt_co4) where, surprisingly, the optimisation was /not/ being done. This has no effect on what programs compile; it just moves a relatively-expensive optimisation to optCoercion, where it seems more properly to belong. It's actually not clear to me which is really "better", but this way round is less surprising. One small simplifying refactoring * Eliminate TyCoRep.substCoVarBndrCallback, which was only called locally.
* Zap Call Arity info in the simplifierJoachim Breitner2017-03-282-2/+10
| | | | | | | | | | | | | As #13479 shows, there are corner cases where the simplifier decides to not eta-expand a function as much as its call arity would suggest, but instead transforms the code that the call arity annotation becomes a lie. As the call arity information is only meant to be used by the immediatelly following simplifier run, it makes sense to simply zap the information there. Differential Revision: https://phabricator.haskell.org/D3390
* Make the test fail if compiled without -threadedSimon Marlow2017-03-281-0/+3
| | | | | | | | | | Test Plan: validate Reviewers: bgamari, austin, erikd Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3387
* Fix #13433Simon Marlow2017-03-281-4/+17
| | | | | | | | | | | | Summary: See comments for details. Test Plan: validate Reviewers: mpickering, bgamari, austin, erikd Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3386
* Spelling in comments only [ci skip]Gabor Greif2017-03-2810-14/+14
|
* Test Trac #13490Simon Peyton Jones2017-03-282-0/+13
|
* Complete the fix for #13441 (pattern synonyms)Simon Peyton Jones2017-03-286-21/+67
| | | | | | | | | | | | Do not attempt to typecheck both directions of an implicitly-bidirectional pattern synonym simultanously, as we were before. Instead, the builder is typechecked when we typecheck the code for the builder, which was of course happening already, even in both bidirectional cases. See Note [Checking against a pattern signature], under "Existential type variables".
* Fix #13458Richard Eisenberg2017-03-274-12/+30
| | | | | | | Core Lint shouldn't check representations of types that don't have representations. test case: typecheck/should_compile/T13458
* -fspec-constr-keen docs typos [skip ci]Matthew Pickering2017-03-271-2/+2
|
* Remove utterly bogus codeSimon Peyton Jones2017-03-271-6/+1
| | | | | | | | | | | | | | | | | | | | | | | | | The commit 6746549772c5cc0ac66c0fce562f297f4d4b80a2 Author: Richard Eisenberg <eir@cis.upenn.edu> Date: Fri Dec 11 18:19:53 2015 -0500 Add kind equalities to GHC. added this entirely bogus code to Simplify.simplLam: env' | Coercion co <- arg = extendCvSubst env bndr co | otherwise = env It's bogus because 'co' is an 'InCoercion', but a CvSubst should have only OutCoercions in it. Moreover, completeBind does the job nicely. This led to an ASSERT failure in an experimental branch; but I have not got a repro case that works on HEAD. But still, the patch deletes code and fixes a bug, so it must be good. The only mystery is why Richard added it in the first place :-). I hope I'm not missing anything. But it validates fine.
* Fix 'unsolved constraints' in GHCiSimon Peyton Jones2017-03-274-4/+15
| | | | | | | In initTc, if the computation fails with an exception, we should not complain about unsolved constraints. Fixes Trac #13466.
* Fix error-message suppress on given equalitiesSimon Peyton Jones2017-03-2713-75/+184
| | | | | | | | | | | | | | | | I'd got the logic slightly wrong when reporting type errors for insoluble 'given' equalities. We suppress insoluble givens under some circumstances (see Note [Given errors]), but we then suppressed subsequent 'wanted' errors because the (suppressed) 'given' error "won". Result: no errors at all :-(. This patch fixes it and - Renames TcType.isTyVarUnderDatatype to the more perspicuous TcType.isInsolubleOccursCheck In doing this I realise that I don't understand why we need to keep the insolubles partitioned out separately at all... but that is for another day.
* Fix explicitly-bidirectional pattern synonymsSimon Peyton Jones2017-03-273-11/+51
| | | | | | | | | | | This partly fixes Trac #13441, at least for the explicitly bidirectional case. See Note [Checking against a pattern signature], the part about "Existential type variables". Alas, the implicitly-bidirectional case is still not quite right, but at least there is a workaround by making it explicitly bidirectional.