summaryrefslogtreecommitdiff
path: root/compiler
Commit message (Collapse)AuthorAgeFilesLines
* Allow RULES for seq, and exploit themsimonpj@microsoft.com2009-06-038-131/+230
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Roman found situations where he had case (f n) of _ -> e where he knew that f (which was strict in n) would terminate if n did. Notice that the result of (f n) is discarded. So it makes sense to transform to case n of _ -> e Rather than attempt some general analysis to support this, I've added enough support that you can do this using a rewrite rule: RULE "f/seq" forall n. seq (f n) e = seq n e You write that rule. When GHC sees a case expression that discards its result, it mentally transforms it to a call to 'seq' and looks for a RULE. (This is done in Simplify.rebuildCase.) As usual, the correctness of the rule is up to you. This patch implements the extra stuff. I have not documented it explicitly in the user manual yet... let's see how useful it is first. The patch looks bigger than it is, because a) Comments; see esp MkId Note [seqId magic] b) Some refactoring. Notably, I moved the special desugaring for seq from MkCore back into DsUtils where it properly belongs. (It's really a desugaring thing, not a CoreSyn invariant.) c) Annoyingly, in a RULE left-hand side we need to be careful that the magical desugaring done in MkId Note [seqId magic] item (c) is *not* done on the LHS of a rule. Or rather, we arrange to un-do it, in DsBinds.decomposeRuleLhs.
* Remove the unused remains of __decodeFloatIan Lynagh2009-06-021-8/+1
|
* Remove old GUM/GranSim codeSimon Marlow2009-06-022-8/+1
|
* Fix Trac #3265: type operators in type/class declarationssimonpj@microsoft.com2009-06-021-1/+25
| | | | | | | | | | | | | | | We should accept these: data a :*: b = .... or data (:*:) a b = ... only if -XTypeOperators is in force. And similarly class decls. This patch fixes the problem. It uses the slightly-nasty OccName.isSymOcc, but the only way to avoid that is to cach the result in OccNames which seems overkill to us.
* depend on mk/project.mk appropriatelySimon Marlow2009-05-291-3/+3
|
* Quote commands that we run, so they work if there are space in their pathsIan Lynagh2009-05-301-18/+18
| | | | | I've also added some missing $s to some makefiles. These aren't technically necessary, but it's nice to be consistent.
* fix pprDynamicLinkerAsmLabel for Mac OS X x86_64Austin Seipp2009-05-231-0/+4
|
* Implement -XMonoLocalBinds: a radical new flagsimonpj@microsoft.com2009-05-292-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new flag -XMonoLocalBinds tells GHC not to generalise nested bindings in let or where clauses, unless there is a type signature, in which case we use it. I'm thinking about whether this might actually be a good direction for Haskell go to in, although it seems pretty radical. Anyway, the flag is easy to implement (look at how few lines change), and having it will allow us to experiement with and without. Just for the record, below are the changes required in the boot libraries -- ie the places where. Not quite as minimal as I'd hoped, but the changes fall into a few standard patterns, and most represent (in my opinion) sytlistic improvements. I will not push these patches, however. == running darcs what -s --repodir libraries/base M ./Control/Arrow.hs -2 +4 M ./Data/Data.hs -7 +22 M ./System/IO/Error.hs +1 M ./Text/ParserCombinators/ReadP.hs +1 == running darcs what -s --repodir libraries/bytestring M ./Data/ByteString/Char8.hs -1 +2 M ./Data/ByteString/Unsafe.hs +1 == running darcs what -s --repodir libraries/Cabal M ./Distribution/PackageDescription.hs -2 +6 M ./Distribution/PackageDescription/Check.hs +3 M ./Distribution/PackageDescription/Configuration.hs -1 +3 M ./Distribution/ParseUtils.hs -2 +4 M ./Distribution/Simple/Command.hs -1 +4 M ./Distribution/Simple/Setup.hs -12 +24 M ./Distribution/Simple/UserHooks.hs -1 +5 == running darcs what -s --repodir libraries/containers M ./Data/IntMap.hs -2 +2 == running darcs what -s --repodir libraries/dph M ./dph-base/Data/Array/Parallel/Arr/BBArr.hs -1 +3 M ./dph-base/Data/Array/Parallel/Arr/BUArr.hs -2 +4 M ./dph-prim-par/Data/Array/Parallel/Unlifted/Distributed/Arrays.hs -6 +10 M ./dph-prim-par/Data/Array/Parallel/Unlifted/Distributed/Combinators.hs -3 +6 M ./dph-prim-seq/Data/Array/Parallel/Unlifted/Sequential/Flat/Permute.hs -2 +4 == running darcs what -s --repodir libraries/syb M ./Data/Generics/Twins.hs -5 +18
* Fix Trac #3259: expose 'lazy' only after generating interface filessimonpj@microsoft.com2009-05-293-30/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes an insidious and long-standing bug in the way that parallelism is handled in GHC. See Note [lazyId magic] in MkId. Here's the diagnosis, copied from the Trac ticket. par is defined in GHC.Conc thus: {-# INLINE par #-} par :: a -> b -> b par x y = case (par# x) of { _ -> lazy y } -- The reason for the strange "lazy" call is that it fools the -- compiler into thinking that pseq and par are non-strict in -- their second argument (even if it inlines pseq/par at the call -- site). If it thinks par is strict in "y", then it often -- evaluates "y" before "x", which is totally wrong. The function lazy is the identity function, but it is inlined only after strictness analysis, and (via some magic) pretends to be lazy. Hence par pretends to be lazy too. The trouble is that both par and lazy are inlined into your definition of parallelise, so that the unfolding for parallelise (exposed in Parallelise.hi) does not use lazy at all. Then when compiling Main, parallelise is in turn inlined (before strictness analysis), and so the strictness analyser sees too much. This was all sloppy thinking on my part. Inlining lazy after strictness analysis works fine for the current module, but not for importing modules. The fix implemented by this patch is to inline 'lazy' in CorePrep, not in WorkWrap. That way interface files never see the inlined version. The downside is that a little less optimisation may happen on programs that use 'lazy'. And you'll only see this in the results -ddump-prep not in -ddump-simpl. So KEEP AN EYE OUT (Simon and Satnam especially). Still, it should work properly now. Certainly fixes #3259.
* Fix Trac #3262: suppress name-shadow warning for _namessimonpj@microsoft.com2009-05-284-11/+12
| | | | | | | Adopt Max's suggestion for name shadowing, by suppressing shadowing warnings for variables starting with "_". A tiny bit of refactoring along the way.
* Improve printing of Orig RdrNamessimonpj@microsoft.com2009-05-284-30/+44
| | | | | | | | | | | In Tempate Haskell -ddump-splices, the "after" expression is populated with RdrNames, many of which are Orig things. We used to print these fully-qualified, but that's a bit heavy. This patch refactors the code a bit so that the same print-unqualified mechanism we use for Names also works for RdrNames. Lots of comments too, because it took me a while to figure out how it all worked again.
* Print more nicely in -ddump-splicessimonpj@microsoft.com2009-05-281-12/+16
| | | | | | | | | | | | When you say -ddump-splices, the "before" expression is now *renamed* but not *typechecked" Reason (a) less typechecking crap (b) data constructors after type checking have been changed to their *wrappers*, and that makes them print always fully qualified
* Fix Trac #3261: make default types play nice with -Werrorsimonpj@microsoft.com2009-05-281-6/+7
| | | | | | The trial-and-error for type defaults was not playing nicely with -Werror. The fix is simple.
* Adjust error message slightlysimonpj@microsoft.com2009-05-281-5/+5
|
* White space onlysimonpj@microsoft.com2009-05-281-3/+3
|
* Remove type-ambiguous (fromIntegral 0)::Int, replacing it with just 0simonpj@microsoft.com2009-05-281-1/+1
| | | | | | This unnecessary ambiguity has been there for ages, and is now rejected by -Werror, after fixing #3261
* Move getMainFun to TcRnDriver, trim DynFlags importssimonpj@microsoft.com2009-05-282-12/+7
|
* Comments onlysimonpj@microsoft.com2009-05-281-3/+3
|
* Comments about naming for data constructorssimonpj@microsoft.com2009-05-281-6/+6
|
* Remove dead code isHsVarsimonpj@microsoft.com2009-05-281-5/+1
|
* Comments onlysimonpj@microsoft.com2009-05-281-3/+11
|
* Fix Trac #3013: multiple constructors in a GADT declsimonpj@microsoft.com2009-05-282-11/+23
| | | | | | | | | Makes GADT syntax consistent by allowing multiple constructors to be given a single signature data T wehre A, B :: T C :: Int -> t
* Separate flags -XDeriveFunctor, -XDeriveFoldable, -XDeriveTraversablesimonpj@microsoft.com2009-05-282-10/+26
| | | | | | | See Trac #2953. This patch implements a distinct flag for each extended class that may be automatically derived. And I updated the user manual to reflect the fact that we can now derive Functor, Foldable, Traversable.
* Add a commentsimonpj@microsoft.com2009-05-281-0/+1
|
* Follow vreg/hreg patch in X86_64 NCGBen.Lippmeier.anu.edu.au2009-05-273-4/+2
|
* Follow vreg/hreg patch in PPC NCGBen.Lippmeier@anu.edu.au2009-05-269-62/+127
|
* Follow vreg/hreg patch in x86 NCGBen.Lippmeier@anu.edu.au2009-05-198-181/+262
|
* Don't try and coalesce RealReg->RealReg movesBen.Lippmeier@anu.edu.au2009-05-191-3/+7
|
* Split Reg into vreg/hreg and add register pairsBen.Lippmeier@anu.edu.au2009-05-1841-1042/+1521
| | | | | | | | | | | | | * The old Reg type is now split into VirtualReg and RealReg. * For the graph coloring allocator, the type of the register graph is now (Graph VirtualReg RegClass RealReg), which shows that it colors in nodes representing virtual regs with colors representing real regs. (as was intended) * RealReg contains two contructors, RealRegSingle and RealRegPair, where RealRegPair is used to represent a SPARC double reg constructed from two single precision FP regs. * On SPARC we can now allocate double regs into an arbitrary register pair, instead of reserving some reg ranges to only hold float/double values.
* SPARC NCG: Fix available regs for graph allocatorBen.Lippmeier@anu.edu.au2009-04-211-3/+3
|
* Fix Trac #3221: renamer warnings for deriving clausessimonpj@microsoft.com2009-05-273-23/+33
| | | | | | This patch arranges to gather the variables used by 'deriving' clauses, so that unused bindings are correctly reported.
* Template Haskell: allow type splicessimonpj@microsoft.com2009-05-279-92/+122
| | | | | | | | | | | | | | | | | | | | | At last! Trac #1476 and #3177 This patch extends Template Haskell by allowing splices in types. For example f :: Int -> $(burble 3) A type splice should work anywhere a type is expected. This feature has been long requested, and quite a while ago I'd re-engineered the type checker to make it easier, but had never got around to finishing the job. With luck, this does it. There's a ToDo in the HsSpliceTy case of RnTypes.rnHsType, where I am not dealing properly with the used variables; but that's awaiting the refactoring of the way we report unused names.
* Template Haskell: improve lifting for stringssimonpj@microsoft.com2009-05-273-11/+49
| | | | | | | | | | | | | | | | | | When you have a (\s::String -> ....[| s |]....), the string 's' is lifted. We used to get a chain of single-character Cons nodes, correct but lots and lots of code. This patch arranges to optimise that to a string literal. It does so in two places: a) In TcExpr, if we know that s::String, we generate liftString directly b) In DsMeta, if we find a list of character literals, we convert to a string. This catches a few cases that (a) does not There an accompanying patch in the template-haskell package, adding Language.Haskell.TH.Syntax.liftString
* Rename conDeclsNames to hsConDeclsNames, and export itsimonpj@microsoft.com2009-05-271-7/+7
|
* Comments about wiredInIdssimonpj@microsoft.com2009-05-271-8/+33
|
* Wibble some comments to avoid haddock parse errorsIan Lynagh2009-05-261-4/+5
|
* Remove legacy code that isn't used now that we require GHC >= 6.8Ian Lynagh2009-05-244-23/+0
|
* Be more precise about munging compiler/stage1/inplace-pkg-configIan Lynagh2009-05-241-1/+3
| | | | | | | We were removing ".$(ProjectPatchLevel)" from anywhere in the file. However, it included absolute paths, so if you untar a source tarball into its default directory name, e.g. "6.11.$(ProjectPatchLevel)", then the sed would break the paths.
* remove old todo commentSimon Marlow2009-05-201-1/+0
|
* Need to pass gcc -m64 on amd64 OSXIan Lynagh2009-05-201-2/+0
|
* When linking a shared library with --make, always do the link stepDuncan Coutts2009-05-191-1/+1
| | | | | | | | Without -shared, the default target is a binary and in that case it makes sense for --make to not try and link a binary when there is no Main module. But for a shared library the user already has to specify -shared and there's no reason a shared lib should contain any Main module or main function.
* Make -dynload sysdep mean to embed rpaths in shared libs as well as binariesDuncan Coutts2009-05-191-1/+7
| | | | | | | | Previously it only did it for binaries. This was presumably on the theory that the binary could specify the rpath for all the libs. However when it is the shared lib that is the final product (ie to link into a bigger project) then we need the rpaths for the shared lib to be self-contianed.
* Switch the default -dynload mode to SystemDependentDuncan Coutts2009-05-171-1/+1
| | | | | The previous default was Deployable though it was being overridden to Wrapper in the ghc shell script wrapper.
* Set the soname when creating a shared libDuncan Coutts2009-05-151-0/+1
| | | | | It's still possible to override it, just use -optl-Wl,-soname, eg: ghc -shared -dynamic foo.o -o libfoo.so -optl-Wl,-soname,libbar.so
* Keep C main separate from rts lib and link it in for standalone progsDuncan Coutts2009-05-151-0/+8
| | | | | | | | | | | | Previously the object code for the C main function lived in the rts lib, however this is a problem when the rts is built as a shared lib. With Windows DLLs it always causes problems while on ELF systems it's a problem when the user decides to use their own C main function rather than a Haskell Main.main. So instead we now put main in it's own tiny little static lib libHSrtsmain.a which we install next to the rts libs. Whenever ghc links a program (without -no-hs-main) then it also links in -lHSrtsmain. For consistency we always do it this way now rather than trying to do it differently for static vs shared libraries.
* Remove old Windows-only implementation of keeping main outside the rtsDuncan Coutts2009-05-141-9/+0
| | | | | | | | We now do it for all ways and for all platforms. This was a Windows-only version that only kept a separate Main.dyn_o for the dynamic linking case. It had to do that because Windows DLLs are stricter about unresolved symbols where as for ELF platforms we only run into the problem when we're not using a Haskell main function.
* Need to pass gcc -m64 on amd64 OSXIan Lynagh2009-05-201-1/+7
|
* Fix the unregisterised buildIan Lynagh2009-05-201-1/+2
|
* Build fix for amd64/OSXIan Lynagh2009-05-201-1/+1
|
* Need to pass gcc -m64 on amd64 OSXIan Lynagh2009-05-201-0/+2
|