ghc.git
7 years agofix bug in previous commit, 65e46f144f3d8b18de7264b0b099086153c68d6c
Simon Marlow [Wed, 14 Nov 2012 10:12:56 +0000 (10:12 +0000)] 
fix bug in previous commit, 65e46f144f3d8b18de7264b0b099086153c68d6c

7 years agotypos in comments
Gabor Greif [Fri, 16 Nov 2012 10:26:50 +0000 (11:26 +0100)] 
typos in comments

7 years agoHaddoc fix
Ben Lippmeier [Wed, 14 Nov 2012 06:03:46 +0000 (17:03 +1100)] 
Haddoc fix

7 years agoComments and formatting to register allocator stats
Ben Lippmeier [Mon, 12 Nov 2012 04:28:03 +0000 (15:28 +1100)] 
Comments and formatting to register allocator stats

7 years agoComments and formatting to spill cost code
Ben Lippmeier [Mon, 12 Nov 2012 04:16:56 +0000 (15:16 +1100)] 
Comments and formatting to spill cost code

7 years agoComments and formatting to spill cleaner
Ben Lippmeier [Mon, 12 Nov 2012 04:10:51 +0000 (15:10 +1100)] 
Comments and formatting to spill cleaner

No functional changes.

7 years agoComments and formatting to register allocators
Ben Lippmeier [Mon, 12 Nov 2012 03:42:02 +0000 (14:42 +1100)] 
Comments and formatting to register allocators

No functional changes.

7 years agoDe-tabify register allocator code
Ben Lippmeier [Mon, 12 Nov 2012 02:50:34 +0000 (13:50 +1100)] 
De-tabify register allocator code

7 years agoRemove redundant configure check for timer_create
Ian Lynagh [Tue, 13 Nov 2012 23:21:41 +0000 (23:21 +0000)] 
Remove redundant configure check for timer_create

7 years agoFix FP_CHECK_TIMER_CREATE when cross-compiling
Ian Lynagh [Tue, 13 Nov 2012 23:13:13 +0000 (23:13 +0000)] 
Fix FP_CHECK_TIMER_CREATE when cross-compiling

If we are cross-compiling, we assume that if timer_create exists then
it works.

7 years agoRemove unused FPTOOLS_SHEBANG_PERL
Ian Lynagh [Tue, 13 Nov 2012 22:40:16 +0000 (22:40 +0000)] 
Remove unused FPTOOLS_SHEBANG_PERL

7 years agoRemove unused FP_PROG_SORT / SortCmd / SORT
Ian Lynagh [Tue, 13 Nov 2012 22:36:28 +0000 (22:36 +0000)] 
Remove unused FP_PROG_SORT / SortCmd / SORT

7 years agoSimplify BOOTSTRAPPING_GHC_INFO_FIELD
Ian Lynagh [Tue, 13 Nov 2012 22:30:42 +0000 (22:30 +0000)] 
Simplify BOOTSTRAPPING_GHC_INFO_FIELD

All supported bootstrapping compilers now have --info output,
so we can use that unconditionally.

7 years agoRemove unused FP_GEN_FO and FP_PROG_FOP configure macros
Ian Lynagh [Tue, 13 Nov 2012 22:24:12 +0000 (22:24 +0000)] 
Remove unused FP_GEN_FO and FP_PROG_FOP configure macros

7 years agoRemove unused FP_EVAL_STDERR configure macro
Ian Lynagh [Tue, 13 Nov 2012 22:16:15 +0000 (22:16 +0000)] 
Remove unused FP_EVAL_STDERR configure macro

7 years agoRemove unused FPTOOLS_GREENCARD configure macro
Ian Lynagh [Tue, 13 Nov 2012 22:14:08 +0000 (22:14 +0000)] 
Remove unused FPTOOLS_GREENCARD configure macro

7 years agoRemove the HAVE_SETITIMER_VIRTUAL configure test
Ian Lynagh [Tue, 13 Nov 2012 21:43:18 +0000 (21:43 +0000)] 
Remove the HAVE_SETITIMER_VIRTUAL configure test

We no longer actually use ITIMER_VIRTUAL anyway

7 years agoUpdate the "Special built-in functions" docs
Ian Lynagh [Tue, 13 Nov 2012 21:02:33 +0000 (21:02 +0000)] 
Update the "Special built-in functions" docs

In particular, avoid referring the user to GHC.Prim; they generally
ought to use GHC.Exts instead.

7 years agoRemove the nonexistent lazy primop, and follow move from GHC.Base to GHC.Magic
Ian Lynagh [Tue, 13 Nov 2012 20:47:10 +0000 (20:47 +0000)] 
Remove the nonexistent lazy primop, and follow move from GHC.Base to GHC.Magic

7 years agoRemove the inline primop
Ian Lynagh [Tue, 13 Nov 2012 19:43:50 +0000 (19:43 +0000)] 
Remove the inline primop

It's not really a primop, and GHC.Prim doesn't export it. It has a
definition in GHC.Magic.

7 years agoTell the compiler about alpha, mipseb and mipsel again; fixes #7339
Ian Lynagh [Tue, 13 Nov 2012 17:58:52 +0000 (17:58 +0000)] 
Tell the compiler about alpha, mipseb and mipsel again; fixes #7339

This reverts the compiler parts of

    commit 7b594a5d7ac29972db39228e9c8b7f384313f39b
    Author: David Terei <davidterei@gmail.com>
    Date:   Mon Nov 21 12:05:18 2011 -0800

    Remove registerised code for dead architectures: mips, ia64, alpha,
    hppa1, m68k

In particular, we want to know whether bewareLoadStoreAlignment should
return True or False for them.

It also reverts

    commit 3fc68b5c356b39b2b52a86d953367d0021c13262
    Author: Simon Marlow <marlowsd@gmail.com>
    Date:   Wed Jan 4 11:44:02 2012 +0000

    Remove missing archs (mipseb, mipsel, alpha) (#5734)

    It doesn't hurt to map these to ArchUnknown since we don't need to
    know anything specific about them, and adding them would be a pain
    (there are a bunch of places where we have to case-match on all the
    arches to avoid warnings).

7 years agoMerge branch 'master' of darcs.haskell.org:/srv/darcs//ghc
Ian Lynagh [Tue, 13 Nov 2012 16:25:36 +0000 (16:25 +0000)] 
Merge branch 'master' of darcs.haskell.org:/srv/darcs//ghc

7 years agoFix the OFFSET macro
Ian Lynagh [Tue, 13 Nov 2012 16:20:17 +0000 (16:20 +0000)] 
Fix the OFFSET macro

When offsetof is defined, we use that. This avoids "variably
modified at file scope" warnings/errors with recent gccs.

7 years agoDon't include a (void *) cast in BLOCK_ROUND_UP
Ian Lynagh [Tue, 13 Nov 2012 15:58:17 +0000 (15:58 +0000)] 
Don't include a (void *) cast in BLOCK_ROUND_UP

All uses of it cast the result anyway. However, DeriveConstants needs
it to not include the cast, as (void *) casts can't be used in constant
expressions.

7 years agoFix installing on Windows
Ian Lynagh [Tue, 13 Nov 2012 14:49:59 +0000 (14:49 +0000)] 
Fix installing on Windows

nus in #ghc ran into a problem where the wrong filepath was being
stripped.

7 years agoFix the Slow calling convention (#7192)
Simon Marlow [Tue, 13 Nov 2012 11:43:09 +0000 (11:43 +0000)] 
Fix the Slow calling convention (#7192)

The Slow calling convention passes the closure in R1, but we were
ignoring this and hoping it would work, which it often did.  However,
this bug seems to have been the cause of #7192, because the
graph-colouring allocator is more sensitive to having correct liveness
information on jumps.

7 years agoFix build on Windows
Ian Lynagh [Tue, 13 Nov 2012 00:35:58 +0000 (00:35 +0000)] 
Fix build on Windows

7 years agoMerge branch 'master' of darcs.haskell.org:/srv/darcs//ghc
Ian Lynagh [Tue, 13 Nov 2012 00:26:28 +0000 (00:26 +0000)] 
Merge branch 'master' of darcs.haskell.org:/srv/darcs//ghc

7 years agoAdd some more flags to includes_CC_OPTS
Ian Lynagh [Mon, 12 Nov 2012 23:29:09 +0000 (23:29 +0000)] 
Add some more flags to includes_CC_OPTS

Fixes build on OS X

7 years agoReplace mkDerivedConstants.c with DeriveConstants.hs
Ian Lynagh [Sat, 10 Nov 2012 23:28:58 +0000 (23:28 +0000)] 
Replace mkDerivedConstants.c with DeriveConstants.hs

DeriveConstants.hs works in a cross-compilation-friendly way. Rather
than running a C program that prints out the constants, we just compile
a C file which has the constants are encoded in symbol sizes. We then
parse the output of 'nm' to find out what the constants are.

Based on work by Gabor Greif <ggreif@gmail.com>.

7 years agoASSERT(HpAlloc==0) in the update code, to catch HpAlloc bugs
Simon Marlow [Mon, 5 Nov 2012 16:06:24 +0000 (16:06 +0000)] 
ASSERT(HpAlloc==0) in the update code, to catch HpAlloc bugs

7 years agoremove some unused variables
Simon Marlow [Mon, 5 Nov 2012 15:44:20 +0000 (15:44 +0000)] 
remove some unused variables

7 years agoa fix for checkTSO(): the TSO could be a WHITEHOLE
Simon Marlow [Mon, 5 Nov 2012 15:43:21 +0000 (15:43 +0000)] 
a fix for checkTSO(): the TSO could be a WHITEHOLE

7 years agoassert HpAlloc == 0
Simon Marlow [Mon, 5 Nov 2012 15:42:27 +0000 (15:42 +0000)] 
assert HpAlloc == 0

7 years agosome W_s should be P_s
Simon Marlow [Mon, 5 Nov 2012 15:41:54 +0000 (15:41 +0000)] 
some W_s should be P_s

7 years agohandle MO_Touch, and generate no code for it.
Simon Marlow [Mon, 12 Nov 2012 14:01:22 +0000 (14:01 +0000)] 
handle MO_Touch, and generate no code for it.

7 years agoreplaceLabels: null out the cml_cont field of CmmCall
Simon Marlow [Mon, 12 Nov 2012 14:01:01 +0000 (14:01 +0000)] 
replaceLabels: null out the cml_cont field of CmmCall

This fixes a CmmLint complaint when doing proc-point splitting.

7 years agoFix warnings
Simon Marlow [Mon, 12 Nov 2012 12:02:44 +0000 (12:02 +0000)] 
Fix warnings

7 years agoRemove OldCmm, convert backends to consume new Cmm
Simon Marlow [Mon, 12 Nov 2012 11:47:51 +0000 (11:47 +0000)] 
Remove OldCmm, convert backends to consume new Cmm

This removes the OldCmm data type and the CmmCvt pass that converts
new Cmm to OldCmm.  The backends (NCGs, LLVM and C) have all been
converted to consume new Cmm.

The main difference between the two data types is that conditional
branches in new Cmm have both true/false successors, whereas in OldCmm
the false case was a fallthrough.  To generate slightly better code we
occasionally need to invert a conditional to ensure that the
branch-not-taken becomes a fallthrough; this was previously done in
CmmCvt, and it is now done in CmmContFlowOpt.

We could go further and use the Hoopl Block representation for native
code, which would mean that we could use Hoopl's postorderDfs and
analyses for native code, but for now I've left it as is, using the
old ListGraph representation for native code.

7 years agoMerge branch 'master' of ssh://darcs.haskell.org/srv/darcs/ghc
Iavor S. Diatchki [Sat, 10 Nov 2012 20:25:24 +0000 (12:25 -0800)] 
Merge branch 'master' of ssh://darcs.haskell.org/srv/darcs/ghc

7 years agoAllow '-' to be used as an infix type constructor.
Iavor S. Diatchki [Sat, 10 Nov 2012 20:24:25 +0000 (12:24 -0800)] 
Allow '-' to be used as an infix type constructor.

7 years agoadd note about compilation safety to safe haskell docs
David Terei [Sat, 10 Nov 2012 00:33:36 +0000 (16:33 -0800)] 
add note about compilation safety to safe haskell docs

7 years agoGive an error if we can't find a suitable value for PRIdPTR
Ian Lynagh [Thu, 8 Nov 2012 21:51:02 +0000 (21:51 +0000)] 
Give an error if we can't find a suitable value for PRIdPTR

7 years agodefine own version of PRIdPTR on platform where its not available
Karel Gardas [Thu, 8 Nov 2012 21:04:44 +0000 (22:04 +0100)] 
define own version of PRIdPTR on platform where its not available

Note that PRIdPTR is considered as linux-ism so it's not available on platforms
like Solaris, although some other free Unix(-like) OSes apparently supports
it too.

7 years agoGive dynamic libraries, as well as programs, RPATHs
Ian Lynagh [Thu, 8 Nov 2012 21:46:46 +0000 (21:46 +0000)] 
Give dynamic libraries, as well as programs, RPATHs

Based on a patch from markwright in #3072.

7 years agoAdd a comment about why we use nextWrapperNum rather than a unique
Ian Lynagh [Thu, 8 Nov 2012 12:27:03 +0000 (12:27 +0000)] 
Add a comment about why we use nextWrapperNum rather than a unique

7 years agoMerge branch 'master' of darcs.haskell.org:/srv/darcs//ghc
Ian Lynagh [Thu, 8 Nov 2012 12:18:08 +0000 (12:18 +0000)] 
Merge branch 'master' of darcs.haskell.org:/srv/darcs//ghc

7 years agofix typo, courtesy of Jon Cave, thanks!
Gabor Greif [Thu, 8 Nov 2012 09:44:06 +0000 (10:44 +0100)] 
fix typo, courtesy of Jon Cave, thanks!

7 years agoanother typo
Gabor Greif [Wed, 7 Nov 2012 15:05:20 +0000 (16:05 +0100)] 
another typo

7 years agotypos
Gabor Greif [Wed, 7 Nov 2012 11:10:22 +0000 (12:10 +0100)] 
typos

7 years agoMerge branch 'master' of http://darcs.haskell.org/ghc
Simon Peyton Jones [Tue, 6 Nov 2012 16:26:57 +0000 (16:26 +0000)] 
Merge branch 'master' of darcs.haskell.org/ghc

7 years agoRefine the "kick-out" predicate for CTyVarEq
Simon Peyton Jones [Tue, 6 Nov 2012 16:12:39 +0000 (16:12 +0000)] 
Refine the "kick-out" predicate for CTyVarEq

Consider
   Work item:   k ~ *
   Inert item:  (a::k) ~ Int

Then we must kick out the inert item!  We weren't doing that,
something I discovered when fixing Trac #7384.

Discussed with Dimitrios, and we wrote a long comment
Note [Delicate equality kick-out] to explain.

7 years agoMake rewriteCtFlavor lazy in the coercion for Derived evidence
Simon Peyton Jones [Tue, 6 Nov 2012 16:03:11 +0000 (16:03 +0000)] 
Make rewriteCtFlavor lazy in the coercion for Derived evidence

I think I accidentally introduced this bug a month ago when
refactoring. It's a bit non-obvious, but since Derived constraints
have no evidence, we mustn't be strict in it.  Now there's a big
comment to prevent this bug happening again.

This fixes Trac #7384.

7 years agoFix the instantiation of data constructors in the GHCi debugger
Simon Peyton Jones [Tue, 6 Nov 2012 15:55:39 +0000 (15:55 +0000)] 
Fix the instantiation of data constructors in the GHCi debugger

This bug caused Trac #7386, because in the (rather tricky) "type
inference" (aka run time type reconstruction) done by the GHCi
debugger, we were failing to instantiate a data type family
correctly.  When that code was written we didn't *have* data
families.

I wrote Note [Constructor arg types] to explain the new scheme.

7 years agoComments only
Simon Peyton Jones [Tue, 6 Nov 2012 15:49:53 +0000 (15:49 +0000)] 
Comments only

7 years agoRemove getModuleDs; we now just use getModule
Ian Lynagh [Tue, 6 Nov 2012 11:19:07 +0000 (11:19 +0000)] 
Remove getModuleDs; we now just use getModule

7 years agoloadThreadState should set HpAlloc=0
Simon Marlow [Mon, 5 Nov 2012 14:49:05 +0000 (14:49 +0000)] 
loadThreadState should set HpAlloc=0

7 years agosmall optimisation: inline stmNewTVar()
Simon Marlow [Mon, 5 Nov 2012 10:42:23 +0000 (10:42 +0000)] 
small optimisation: inline stmNewTVar()

7 years agofix 'return' in cmm code when tablesNextToCode==False
Simon Marlow [Fri, 2 Nov 2012 12:09:35 +0000 (12:09 +0000)] 
fix 'return' in cmm code when tablesNextToCode==False

7 years agoSave R1/R2/.. across foreign calls
Simon Marlow [Fri, 2 Nov 2012 11:28:16 +0000 (11:28 +0000)] 
Save R1/R2/.. across foreign calls

7 years agotypo
Gabor Greif [Mon, 5 Nov 2012 11:56:43 +0000 (12:56 +0100)] 
typo

7 years agoAvoid putting uniqs in specconstr rules; part of #4012
Ian Lynagh [Fri, 2 Nov 2012 22:54:12 +0000 (22:54 +0000)] 
Avoid putting uniqs in specconstr rules; part of #4012

There's no need to have the uniq in the rule, but its presence can
cause spurious ABI changes.

7 years agoWhitespace only in basicTypes/Id.lhs
Ian Lynagh [Fri, 2 Nov 2012 22:38:27 +0000 (22:38 +0000)] 
Whitespace only in basicTypes/Id.lhs

7 years agoWhitespace only in specialise/SpecConstr.lhs
Ian Lynagh [Fri, 2 Nov 2012 22:29:50 +0000 (22:29 +0000)] 
Whitespace only in specialise/SpecConstr.lhs

7 years agoRemove an -fno-cse flag
Ian Lynagh [Fri, 2 Nov 2012 22:15:58 +0000 (22:15 +0000)] 
Remove an -fno-cse flag

There are no longer any GLOBAL_VARs in main/DriverMkDepend.hs.

7 years agoChange how dependency generation works; fixes #7381
Ian Lynagh [Fri, 2 Nov 2012 21:42:33 +0000 (21:42 +0000)] 
Change how dependency generation works; fixes #7381

We now do the initial dependency generation for the vanilla way
regardless of what way flags and hisuf/osuf flags are given. This
makes it easier to generate the right dependency info in the end.

7 years agoRemove unused function fmapM_maybe
Ian Lynagh [Fri, 2 Nov 2012 14:51:13 +0000 (14:51 +0000)] 
Remove unused function fmapM_maybe

7 years agoRefactoring: Make a HasModule class for getModule
Ian Lynagh [Fri, 2 Nov 2012 14:47:38 +0000 (14:47 +0000)] 
Refactoring: Make a HasModule class for getModule

7 years agoWhitespace only in typecheck/TcRnTypes.lhs
Ian Lynagh [Fri, 2 Nov 2012 13:59:23 +0000 (13:59 +0000)] 
Whitespace only in typecheck/TcRnTypes.lhs

7 years agoDon't use a unique in the stable name of a foreign export
Ian Lynagh [Fri, 2 Nov 2012 13:41:02 +0000 (13:41 +0000)] 
Don't use a unique in the stable name of a foreign export

These names end up in the ABI, and hence part of the ABI hash.
We don't want uniques in them so that we don't get spurious ABI
hash changes.

7 years agoWhitespace only in basicTypes/Name.lhs
Ian Lynagh [Fri, 2 Nov 2012 12:48:43 +0000 (12:48 +0000)] 
Whitespace only in basicTypes/Name.lhs

7 years agoDon't put uniqs in ghc wrapper function names; part of #4012
Ian Lynagh [Fri, 2 Nov 2012 03:45:15 +0000 (03:45 +0000)] 
Don't put uniqs in ghc wrapper function names; part of #4012

The wrapper functions can end up in interface files, and thus are
part of the ABI hash. But uniqs easily change for no good reason
when recompiling, which can lead to an ABI hash needlessly changing.

7 years agoMerge branch 'master' of darcs.haskell.org:/srv/darcs//ghc
Ian Lynagh [Thu, 1 Nov 2012 14:32:20 +0000 (14:32 +0000)] 
Merge branch 'master' of darcs.haskell.org:/srv/darcs//ghc

7 years agoFix popcnt calls
Ian Lynagh [Thu, 1 Nov 2012 14:13:05 +0000 (14:13 +0000)] 
Fix popcnt calls

We don't want to narrow the argument size before making the foreign
call: Word8 still gets passed as a Word-sized argument

7 years agoWhitespace only in codeGen/StgCmmPrim.hs
Ian Lynagh [Thu, 1 Nov 2012 14:12:31 +0000 (14:12 +0000)] 
Whitespace only in codeGen/StgCmmPrim.hs

7 years agoFix typos
Ian Lynagh [Thu, 1 Nov 2012 13:51:01 +0000 (13:51 +0000)] 
Fix typos

7 years agoFix bug in stg_enter_checkbh
Simon Marlow [Thu, 1 Nov 2012 13:02:57 +0000 (13:02 +0000)] 
Fix bug in stg_enter_checkbh

This was causing crashes in stm050(ghci), throwto001(ghci), and
possibly more.

7 years agoThe shape of StgTVar should not depend on THREADED_RTS
Simon Marlow [Thu, 1 Nov 2012 12:59:01 +0000 (12:59 +0000)] 
The shape of StgTVar should not depend on THREADED_RTS

By shear luck I think this didn't lead to any actual runtime crashes,
but it did cause some problems for debugging.

7 years agoAdd -fghci-hist-size=N to set the number of previous steps stored by :trace
Simon Marlow [Thu, 1 Nov 2012 08:51:12 +0000 (08:51 +0000)] 
Add -fghci-hist-size=N to set the number of previous steps stored by :trace

7 years agoTurn on -O2 for the RTS by default
Simon Marlow [Fri, 26 Oct 2012 10:12:49 +0000 (11:12 +0100)] 
Turn on -O2 for the RTS by default

Optimisation now makes a difference when compiling .cmm code, because
it enables the optimisation passes in CmmPipeline.  Recently validate
has not been optimising the .cmm code because it uses SRC_HC_OPTS=-O0,
which explains why I couldn't reproduce #7366 in validate (the bug
miscompiled rts/PrimOps.cmm).

7 years agoturn off cmm optimisation for the debug way
Simon Marlow [Wed, 31 Oct 2012 13:50:54 +0000 (13:50 +0000)] 
turn off cmm optimisation for the debug way

7 years agoFix bug in stg_ctoi_R1n (could cause GHCi crashes)
Simon Marlow [Wed, 31 Oct 2012 13:50:15 +0000 (13:50 +0000)] 
Fix bug in stg_ctoi_R1n (could cause GHCi crashes)

7 years agoA couple of W_s should be P_s (not an actual bug, I think)
Simon Marlow [Wed, 31 Oct 2012 13:49:36 +0000 (13:49 +0000)] 
A couple of W_s should be P_s (not an actual bug, I think)

7 years agoDon't clearNurseries() in parallel with -debug
Simon Marlow [Wed, 31 Oct 2012 12:38:06 +0000 (12:38 +0000)] 
Don't clearNurseries() in parallel with -debug

It makes sanity-checking fail.

7 years agoWhitespace only in nativeGen/NCGMonad.hs
Ian Lynagh [Thu, 1 Nov 2012 01:29:00 +0000 (01:29 +0000)] 
Whitespace only in nativeGen/NCGMonad.hs

7 years agoAdd notes about type-family overlap in GHCi (see Trac #7102)
Simon Peyton Jones [Wed, 31 Oct 2012 17:03:28 +0000 (17:03 +0000)] 
Add notes about type-family overlap in GHCi (see Trac #7102)

7 years agoMerge branch 'master' of darcs.haskell.org:/home/darcs/ghc
Simon Peyton Jones [Wed, 31 Oct 2012 16:15:46 +0000 (16:15 +0000)] 
Merge branch 'master' of darcs.haskell.org:/home/darcs/ghc

7 years agoWibble to recent changes to TcErrors
Simon Peyton Jones [Wed, 31 Oct 2012 16:15:32 +0000 (16:15 +0000)] 
Wibble to recent changes to TcErrors

7 years agoFix C macro bug that was causing some stack checks to erroneously succeed
Simon Marlow [Wed, 31 Oct 2012 11:18:36 +0000 (11:18 +0000)] 
Fix C macro bug that was causing some stack checks to erroneously succeed

7 years agoRetainer prof: immutable arrays are not retainers, and fix the docs
Simon Marlow [Tue, 30 Oct 2012 14:40:01 +0000 (14:40 +0000)] 
Retainer prof: immutable arrays are not retainers, and fix the docs

7 years agoMerge branch 'master' of http://darcs.haskell.org/ghc
Simon Peyton Jones [Wed, 31 Oct 2012 09:09:28 +0000 (09:09 +0000)] 
Merge branch 'master' of darcs.haskell.org/ghc

7 years agoDo not instantiate unification variables with polytypes
Simon Peyton Jones [Wed, 31 Oct 2012 09:08:39 +0000 (09:08 +0000)] 
Do not instantiate unification variables with polytypes

Without -XImpredicativeTypes, the typing rules say that a function
should be instantiated only at a *monotype*.  In implementation terms,
that means that a unification variable should not unify with a type
involving foralls.  But we were not enforcing that rule, and that
gave rise to some confusing error messages, such as
  Trac #7264, #6069

This patch adds the test for foralls.  There are consequences

 * I put the test in occurCheckExpand, since that is where we see if a
   type can unify with a given unification variable.  So
   occurCheckExpand has to get DynFlags, so it can test for
   -XImpredicativeTypes

 * We want this to work
      foo :: (forall a. a -> a) -> Int
      foo = error "foo"
   But that means instantiating error at a polytype!  But error is special
   already because you can instantiate it at an unboxed type like Int#.
   So I extended the specialness to allow type variables of openTypeKind
   to unify with polytypes, regardless of -XImpredicativeTypes.

   Conveniently, this works in TcUnify.matchExpectedFunTys, which generates
   unification variable for the function arguments, which can be polymorphic.

 * GHC has a special typing rule for ($) (see Note [Typing rule
   for ($)] in TcExpr).  It unifies the argument and result with a
   unification variable to exclude unboxed types -- but that means I
   now need a kind of unificatdion variable that *can* unify with a
   polytype.

   So for this sole case I added PolyTv to the data type TcType.MetaInfo.
   I suspect we'll find mor uses for this, and the changes are tiny,
   but it still feel a bit of a hack.  Well the special rule for ($)
   is a hack!

There were some consequential changes in error reporting (TcErrors).

7 years agoComments only
Simon Peyton Jones [Wed, 31 Oct 2012 08:54:33 +0000 (08:54 +0000)] 
Comments only

7 years agoClean some old files that we no longer generate
Ian Lynagh [Wed, 31 Oct 2012 00:50:18 +0000 (01:50 +0100)] 
Clean some old files that we no longer generate

Avoids problems for people with old files in their tree

7 years agoMerge branch 'master' of http://darcs.haskell.org/ghc
Ian Lynagh [Wed, 31 Oct 2012 00:25:55 +0000 (01:25 +0100)] 
Merge branch 'master' of darcs.haskell.org/ghc

7 years agoImprove touchy
Ian Lynagh [Wed, 31 Oct 2012 00:08:45 +0000 (01:08 +0100)] 
Improve touchy

It's now simpler, and it fails if something fails rather than just
printing an error message and continuing.

7 years agoChange how touchy sets the file time
Ian Lynagh [Tue, 30 Oct 2012 23:53:59 +0000 (00:53 +0100)] 
Change how touchy sets the file time

Also added a large comment about why we need it

7 years agoGet ride of the -fregs-liveness flag.
Geoffrey Mainland [Thu, 18 Oct 2012 15:53:25 +0000 (16:53 +0100)] 
Get ride of the -fregs-liveness flag.

With the new register allocation scheme, the LLVM back end must always use
liveness information.

7 years agoGenerate correct LLVM for the new register allocation scheme.
Geoffrey Mainland [Thu, 18 Oct 2012 14:43:27 +0000 (15:43 +0100)] 
Generate correct LLVM for the new register allocation scheme.

We now have accurate global register liveness information attached to all Cmm
procedures and jumps. With this patch, the LLVM back end uses this information
to pass only the live floating point (F and D) registers on tail calls. This
makes the LLVM back end compatible with the new register allocation strategy.

Ideally the GHC LLVM calling convention would put all registers that are always
live first in the parameter sequence. Unfortunately the specification is written
so that on x86-64 SpLim (always live) is passed after the R registers. Therefore
we must always pass *something* in the R registers, so we pass the LLVM value
undef.

7 years agoDraw STG F and D registers from the same pool of available SSE registers on x86-64.
Geoffrey Mainland [Fri, 5 Oct 2012 14:19:55 +0000 (15:19 +0100)] 
Draw STG F and D registers from the same pool of available SSE registers on x86-64.

On x86-64 F and D registers are both drawn from SSE registers, so there is no
reason not to draw them from the same pool of available SSE registers. This
means that whereas previously a function could only receive two Double arguments
in registers even if it did not have any Float arguments, now it can receive up
to 6 arguments that are any mix of Float and Double in registers.

This patch breaks the LLVM back end. The next patch will fix this breakage.