ghc.git
6 years agoemacs-friendly completion command for ghci; part of #5687. Patch from hvr.
Ian Lynagh [Sun, 7 Jul 2013 20:26:18 +0000 (21:26 +0100)] 
emacs-friendly completion command for ghci; part of #5687. Patch from hvr.

6 years agoFix segfault with STM; fixes #8035. Patch from errge.
Ian Lynagh [Sun, 7 Jul 2013 18:13:31 +0000 (19:13 +0100)] 
Fix segfault with STM; fixes #8035. Patch from errge.

6 years agoAvoid needlessly splitting a UniqSupply when extracting a Unique (#8041)
Patrick Palka [Wed, 26 Jun 2013 14:21:06 +0000 (10:21 -0400)] 
Avoid needlessly splitting a UniqSupply when extracting a Unique (#8041)

In many places, 'splitUniqSupply' + 'uniqFromSupply' is used to split a
UniqSupply into a Unique and a new UniqSupply. In such places we should
instead use the more efficient and more appropriate
'takeUniqFromSupply' (or equivalent).

Not only is the former method slower, it also generates and throws away
an extra Unique.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
6 years agoRemove spurious extra brace in LLVM metadata
Peter Wortmann [Thu, 4 Jul 2013 16:16:45 +0000 (17:16 +0100)] 
Remove spurious extra brace in LLVM metadata

This actually caused a segfault in the optimized stage 2 compiler due to
wrong TBAA data.

Signed-off-by: David Terei <davidterei@gmail.com>
6 years agoAlways have LLVM optimize globals
Peter Wortmann [Tue, 2 Jul 2013 22:42:27 +0000 (23:42 +0100)] 
Always have LLVM optimize globals

This pass is pretty cheap and eliminates the aliases generated by the LLVM
backend. This in turn is required for dynamic linking to work correctly,
as LLVM fails to properly attribute calls to aliased addresses.

Signed-off-by: David Terei <davidterei@gmail.com>
6 years agoFix llvm.prefetch instrinct for old LLVM versions
Peter Wortmann [Thu, 4 Jul 2013 16:15:27 +0000 (17:15 +0100)] 
Fix llvm.prefetch instrinct for old LLVM versions

Seems the last parameter to llvm.prefectch was added in LLVM 3.0.

Signed-off-by: David Terei <davidterei@gmail.com>
6 years agocopy the plugin's FastStringTable changes back into the host compiler
Nicolas Frisby [Fri, 5 Jul 2013 00:26:03 +0000 (19:26 -0500)] 
copy the plugin's FastStringTable changes back into the host compiler

6 years agoinclude FastString.string_table in CoreMonad.reinitializeGlobals
Nicolas Frisby [Wed, 3 Jul 2013 23:23:54 +0000 (18:23 -0500)] 
include FastString.string_table in CoreMonad.reinitializeGlobals

6 years agoComment out a leftover pprTrace
Gabor Greif [Wed, 3 Jul 2013 20:56:23 +0000 (22:56 +0200)] 
Comment out a leftover pprTrace

6 years agoMerge branch 'master' of http://darcs.haskell.org/ghc
Ian Lynagh [Wed, 3 Jul 2013 12:59:59 +0000 (13:59 +0100)] 
Merge branch 'master' of darcs.haskell.org/ghc

6 years agoChange the ranlib detection
Ian Lynagh [Tue, 2 Jul 2013 23:16:16 +0000 (00:16 +0100)] 
Change the ranlib detection

On Windows, the ranlib in the path may not be the right ranlib (it may
be the 32bit ranlib when we are making a Win64 compiler, or vice-versa).
Therefore we can't leave it up to libffi to detect the right ranlib, but
need to tell it which ranlib to use. This means that we need to find
ranlib even if we don't actually need it ourselves.

6 years agoDo not build dynamic libraries with the perf-llvm BuildFlavour.
Geoffrey Mainland [Tue, 2 Jul 2013 20:30:33 +0000 (21:30 +0100)] 
Do not build dynamic libraries with the perf-llvm BuildFlavour.

6 years agoFix Trac #8028.
Richard Eisenberg [Tue, 2 Jul 2013 20:07:07 +0000 (21:07 +0100)] 
Fix Trac #8028.

Check for an empty list of equations when converting
a closed type family from TH to an HsDecl.

6 years agoTrack haskeline Win64 fix
Ian Lynagh [Tue, 2 Jul 2013 15:47:37 +0000 (16:47 +0100)] 
Track haskeline Win64 fix

6 years agoFix bumpTickyLitBy[E] on Win64; fixes #7940
Ian Lynagh [Tue, 2 Jul 2013 14:48:08 +0000 (15:48 +0100)] 
Fix bumpTickyLitBy[E] on Win64; fixes #7940

A comment claimed that the ticky counters are unsigned longs, but
as far as I can see that isn't the case: They're already word-sized
values.

6 years agoFix build on Win64
Ian Lynagh [Tue, 2 Jul 2013 13:59:08 +0000 (14:59 +0100)] 
Fix build on Win64

gcc thought that fourthFloating could be used without being defined.
In actual fact it couldn't, but I've refactored the code so that it
can now see this.

6 years agoFix #7970, #2161, unfix #551
Simon Marlow [Tue, 2 Jul 2013 11:10:53 +0000 (12:10 +0100)] 
Fix #7970, #2161, unfix #551

Establish the reachability of threads before weak pointers.  Hence a
deadlocked thread can keep a weak pointer alive and prevent it from
being finalized early.  However, an reference from the finalizer of a
weak pointer will no longer prevent a thread from being considered
deadlocked (#551).  To keep the thread alive in that situation you
need to use a StablePtr.

See comments on #7970 and in the code for more details.

6 years agoMerge branch 'master' of ssh://darcs.haskell.org/srv/darcs/ghc
Richard Eisenberg [Fri, 28 Jun 2013 16:28:16 +0000 (17:28 +0100)] 
Merge branch 'master' of ssh://darcs.haskell.org/srv/darcs/ghc

6 years agoFix Trac #8018.
Richard Eisenberg [Fri, 28 Jun 2013 16:27:00 +0000 (17:27 +0100)] 
Fix Trac #8018.

Don't use the zonked-in-the-knot types to create a name for the axiom
in a closed type family.

6 years agoMerge TcSMonad.matchClass into TcInteract.matchClassInst
Simon Peyton Jones [Fri, 28 Jun 2013 12:13:21 +0000 (13:13 +0100)] 
Merge TcSMonad.matchClass into TcInteract.matchClassInst

Just a simple refactoring.  There was only one caller, and the
intermediate data type was not helping.

6 years agoMerge branch 'master' of ssh://darcs.haskell.org/srv/darcs/ghc
Richard Eisenberg [Fri, 28 Jun 2013 08:35:51 +0000 (09:35 +0100)] 
Merge branch 'master' of ssh://darcs.haskell.org/srv/darcs/ghc

6 years agoUpdate user's guide for kind inference for closed type families.
Richard Eisenberg [Thu, 27 Jun 2013 12:25:53 +0000 (13:25 +0100)] 
Update user's guide for kind inference for closed type families.

6 years agoFix stale comments around closed type families.
Richard Eisenberg [Thu, 27 Jun 2013 12:19:36 +0000 (13:19 +0100)] 
Fix stale comments around closed type families.

6 years agoFix Trac #7939, and add kind inference to closed type families.
Richard Eisenberg [Tue, 25 Jun 2013 16:42:47 +0000 (17:42 +0100)] 
Fix Trac #7939, and add kind inference to closed type families.

Now, all open type families have result kinds that default to
*. Top-level type families have all arguments default to *,
and associated type families have all arguments that are not
mentioned in the class header default to *. Closed type
families perform kind inference, but generalize only over
those kind variables that are parametric in their use.

This is all a little fiddly and specific, but it seems to follow
use cases. This commit also includes a large
Note [Kind-checking strategies] in TcHsType that helps keep all
of this straight.

6 years agoLLVM refactor cleanups
Peter Wortmann [Thu, 27 Jun 2013 13:53:03 +0000 (14:53 +0100)] 
LLVM refactor cleanups

Slightly more documentation, removed unused label map (huh),
removed MonadIO instance on LlvmM to improve encapsulation.

6 years agoMajor Llvm refactoring
Peter Wortmann [Wed, 26 Jun 2013 14:45:16 +0000 (15:45 +0100)] 
Major Llvm refactoring

This combined patch reworks the LLVM backend in a number of ways:

1. Most prominently, we introduce a LlvmM monad carrying the contents of
   the old LlvmEnv around. This patch completely removes LlvmEnv and
   refactors towards standard library monad combinators wherever possible.

2. Support for streaming - we can now generate chunks of Llvm for Cmm as
   it comes in. This might improve our speed.

3. To allow streaming, we need a more flexible way to handle forward
   references. The solution (getGlobalPtr) unifies LlvmCodeGen.Data
   and getHsFunc as well.

4. Skip alloca-allocation for registers that are actually never written.
   LLVM will automatically eliminate these, but output is smaller and
   friendlier to human eyes this way.

5. We use LlvmM to collect references for llvm.used. This allows places
   other than cmmProcLlvmGens to generate entries.

6 years agoUse full contents size for arrays
Peter Wortmann [Wed, 29 May 2013 16:55:12 +0000 (17:55 +0100)] 
Use full contents size for arrays

I am not quite sure at what point it makes sense to look at arrays as
pointers, but I ran into at least one use case that strongly suggested
doing it this way (calculating the actual size of structures, to be exact).

6 years agoRewrite ppLlvmBlock to use standard library "break"
Peter Wortmann [Wed, 26 Jun 2013 14:44:36 +0000 (15:44 +0100)] 
Rewrite ppLlvmBlock to use standard library "break"

6 years agoExtend globals to aliases
Peter Wortmann [Wed, 26 Jun 2013 14:43:45 +0000 (15:43 +0100)] 
Extend globals to aliases

Also give them a proper constructor - getGlobalVar and getGlobalValue
map directly to the accessors.

6 years agoUse SDoc for all LLVM pretty-printing
Peter Wortmann [Wed, 26 Jun 2013 14:49:10 +0000 (15:49 +0100)] 
Use SDoc for all LLVM pretty-printing

This patch reworks some parts of the LLVM pretty-printing code that were
still using Show and String. Now we should be using SDoc and Outputable
throughout. Note that many get*Name functions become pp*Name
here as a side-effect.

6 years agoIteration on dterei's metadata design
Peter Wortmann [Fri, 21 Jun 2013 16:23:00 +0000 (17:23 +0100)] 
Iteration on dterei's metadata design

- MetaArgs is not needed, as variables are already meta data

- Same goes for MetaVal - its only reason for existing seems to be to
  support LLVM's strange pretty-printing for meta-data annotations, and
  I feel that is better to keep the data structure clean and handle it in
  the pretty-printing instead.

- Rename "MetaData" to "MetaAnnot". Meta-data is still meta-data when it
  is not associated with an expression or statement - for example compile
  unit data for debugging. I feel the old name was a bit misleading.

- Make the renamed MetaAnnot a proper data type instead of a type alias
  for a pair.

- Rename "MetaExpr" constructor to "MetaStruct". As the data is much more
  like a LLVM structure (not array, as it can contain values).

- Fix a warning

6 years agoAdd ability to call functions with metadata as arguments to LLVM
David Terei [Wed, 19 Jun 2013 00:38:47 +0000 (17:38 -0700)] 
Add ability to call functions with metadata as arguments to LLVM
backend.

6 years agoRework LLVM metadata representation to be more accurate.
David Terei [Tue, 18 Jun 2013 23:28:42 +0000 (16:28 -0700)] 
Rework LLVM metadata representation to be more accurate.

6 years agoComments for Trac #7989
Simon Peyton Jones [Tue, 25 Jun 2013 13:16:29 +0000 (14:16 +0100)] 
Comments for Trac #7989

6 years agoImprove "No data constructor has all these fields" message (#7989)
Takano Akio [Mon, 17 Jun 2013 09:42:09 +0000 (18:42 +0900)] 
Improve "No data constructor has all these fields" message (#7989)

6 years agoFix typos
Gabor Greif [Tue, 25 Jun 2013 11:58:02 +0000 (13:58 +0200)] 
Fix typos

6 years agoMake noteMustPointToIt true of all non-top-level thunks
Simon Peyton Jones [Tue, 25 Jun 2013 10:56:59 +0000 (11:56 +0100)] 
Make noteMustPointToIt true of all non-top-level thunks

See Note [GC recovery].  To come: clean-up of StgCmmBind.cgRhs.

6 years agoDocument -XTypeOperators, which had escaped documentation altogether thus far
Simon Peyton Jones [Tue, 25 Jun 2013 08:59:42 +0000 (09:59 +0100)] 
Document -XTypeOperators, which had escaped documentation altogether thus far

6 years agoFurther fixes in RnNames, to make associated type exports work
Simon Peyton Jones [Tue, 25 Jun 2013 08:30:27 +0000 (09:30 +0100)] 
Further fixes in RnNames, to make associated type exports work

You ought to be able to say

  module M( C( T, foo ) where
    class C a where
      type T a
      foo :: a -> T a

i.e. with T in C's sub-item list.  This makes it so.

6 years agoUpdate the package database directory's timestamps when rebuilding the package cache.
Geoffrey Mainland [Mon, 24 Jun 2013 22:35:33 +0000 (23:35 +0100)] 
Update the package database directory's timestamps when rebuilding the package cache.

I was seeing many "WARNING: cache is out of date" errors during validation
claiming that my package cache was out of date. This patch eliminates those
errors by ensuring that when we rebuild the package cache, the modification time
of the directory containing the package database is set to be the same as the
modification time of the cache.

6 years agoWhite space and ordering only
Simon Peyton Jones [Mon, 24 Jun 2013 12:10:17 +0000 (13:10 +0100)] 
White space and ordering only

6 years agoAllow associated types as sub-names in an import list (Trac #8011)
Simon Peyton Jones [Mon, 24 Jun 2013 12:10:04 +0000 (13:10 +0100)] 
Allow associated types as sub-names in an import list (Trac #8011)

6 years agoMake sure that Pretty.text is inlined in stage 0,
Simon Peyton Jones [Fri, 21 Jun 2013 16:41:26 +0000 (17:41 +0100)] 
Make sure that Pretty.text is inlined in stage 0,
so that RULE text/str gets a chance to fire (Trac #7995).

And make sure that Outputable.text is inlined, so that the underlying
Pretty.text rule can fire.

The thing is that literal strings only turn into unpackCString#
in phase 1.

6 years agoTidy up the segmentation of mdo expressions
Simon Peyton Jones [Fri, 21 Jun 2013 16:38:09 +0000 (17:38 +0100)] 
Tidy up the segmentation of mdo expressions

When we changed 'rec' to *not* do segmentation of any kind,
I did it by meddling with the inner loop of grab in glomSegments.
But that is really hard to understand!

This patch lifts the test out to the top where is is clear.

6 years agoBreak loop in interface typechecking (fixes Trac #8002)
Simon Peyton Jones [Fri, 21 Jun 2013 16:36:10 +0000 (17:36 +0100)] 
Break loop in interface typechecking (fixes Trac #8002)

6 years agoRe-adjust whitespace
Ian Lynagh [Sun, 23 Jun 2013 11:54:17 +0000 (12:54 +0100)] 
Re-adjust whitespace

6 years agoAllow the GHCi messages to be overridden via the GHC API; fixes #7456
Ian Lynagh [Sun, 23 Jun 2013 11:49:42 +0000 (12:49 +0100)] 
Allow the GHCi messages to be overridden via the GHC API; fixes #7456

They now go through log_action. The existing severities all used
printDoc, which always adds a trailing newline, which we don't
want for the GHCi messages. I therefore added a new severity
SevInteractive, which doesn't add a newline.

6 years agoMerge branch 'master' of http://darcs.haskell.org/ghc
Ian Lynagh [Sat, 22 Jun 2013 21:31:30 +0000 (22:31 +0100)] 
Merge branch 'master' of darcs.haskell.org/ghc

6 years agoFix dynlib paths in the RTS too; part of #7833
Ian Lynagh [Sat, 22 Jun 2013 20:33:22 +0000 (21:33 +0100)] 
Fix dynlib paths in the RTS too; part of #7833

6 years agoFix the dynmaic library paths in the libs, as well as in the programs
Ian Lynagh [Sat, 22 Jun 2013 19:34:12 +0000 (20:34 +0100)] 
Fix the dynmaic library paths in the libs, as well as in the programs

Part of #7833

6 years agoAdd a work-around for #7978.
Geoffrey Mainland [Sat, 22 Jun 2013 19:23:24 +0000 (20:23 +0100)] 
Add a work-around for #7978.

This patch fixes profiling at the cost of losing cost centre accounting in a
very small number of cases. I am working on a better fix.

6 years agoRun "sh ./configure" rather than "sh configure"; part of #7992
Ian Lynagh [Sat, 22 Jun 2013 15:52:46 +0000 (16:52 +0100)] 
Run "sh ./configure" rather than "sh configure"; part of #7992

This fixes a bug with how configure re-execs itself.

6 years agoOn OS X, fix the path to the libffi dynlib; fixes #7833
Ian Lynagh [Sat, 22 Jun 2013 15:16:49 +0000 (16:16 +0100)] 
On OS X, fix the path to the libffi dynlib; fixes #7833

6 years agoFix build on OS X
Ian Lynagh [Sat, 22 Jun 2013 14:06:29 +0000 (15:06 +0100)] 
Fix build on OS X

6 years agoMerge branch 'master' of http://darcs.haskell.org/ghc
Ian Lynagh [Sat, 22 Jun 2013 12:50:59 +0000 (13:50 +0100)] 
Merge branch 'master' of darcs.haskell.org/ghc

6 years agoFix syntax in some code in the user guide; fixes #8007
Ian Lynagh [Sat, 22 Jun 2013 12:32:03 +0000 (13:32 +0100)] 
Fix syntax in some code in the user guide; fixes #8007

6 years agoThe help flag is --help, not -help; fixes #8005
Ian Lynagh [Sat, 22 Jun 2013 12:24:04 +0000 (13:24 +0100)] 
The help flag is --help, not -help; fixes #8005

6 years agoUse consistent dashes in the user guide
Ian Lynagh [Sat, 22 Jun 2013 12:21:40 +0000 (13:21 +0100)] 
Use consistent dashes in the user guide

We were using a mixture of "&ndash;&ndash;" and "--". We now
consistently use "--", which has the advantage that copy/pasting
flags will work.

6 years agoRemove extra dashes in a flag name in the user guide
Ian Lynagh [Sat, 22 Jun 2013 12:03:59 +0000 (13:03 +0100)] 
Remove extra dashes in a flag name in the user guide

6 years agoFix #8009 : Failure to compile on powerpc64-linux.
Erik de Castro Lopo [Sat, 22 Jun 2013 12:00:01 +0000 (22:00 +1000)] 
Fix #8009 : Failure to compile on powerpc64-linux.

Add definitions for stg_C_FINALIZER_LIST and n_capabilities.

6 years agoWhitespace only in HeaderInfo
Ian Lynagh [Fri, 21 Jun 2013 23:22:38 +0000 (00:22 +0100)] 
Whitespace only in HeaderInfo

6 years agoRevise implementation of overlapping type family instances.
Richard Eisenberg [Fri, 21 Jun 2013 12:54:49 +0000 (13:54 +0100)] 
Revise implementation of overlapping type family instances.

This commit changes the syntax and story around overlapping type
family instances. Before, we had "unbranched" instances and
"branched" instances. Now, we have closed type families and
open ones.

The behavior of open families is completely unchanged. In particular,
coincident overlap of open type family instances still works, despite
emails to the contrary.

A closed type family is declared like this:
> type family F a where
>   F Int = Bool
>   F a   = Char
The equations are tried in order, from top to bottom, subject to
certain constraints, as described in the user manual. It is not
allowed to declare an instance of a closed family.

6 years agoTypo in note
Gabor Greif [Wed, 12 Jun 2013 15:48:25 +0000 (17:48 +0200)] 
Typo in note

6 years agoEnsure gc_type is StgWord8.
Austin Seipp [Fri, 21 Jun 2013 05:21:21 +0000 (00:21 -0500)] 
Ensure gc_type is StgWord8.

Again, the range of gc_type is actually 1-3, which is technically
outside the range of rtsBool.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
6 years agoEnsure gc_thread->wakeup is of type StgWord8.
Austin Seipp [Fri, 21 Jun 2013 05:12:20 +0000 (00:12 -0500)] 
Ensure gc_thread->wakeup is of type StgWord8.

rtsBool is defined to only have two inhabitants, which are true (1) and
false (0)

But the wakeup flag is set to 4 possible values, outside the range of
rtsBool. This leads Clang to warn about tautological comparisons.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
6 years agoDon't use -finline-limit with Clang.
Austin Seipp [Fri, 21 Jun 2013 05:10:26 +0000 (00:10 -0500)] 
Don't use -finline-limit with Clang.

It's unsupported.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
6 years agoInitialize ptr to NULL to silence Clang warning.
Austin Seipp [Fri, 21 Jun 2013 04:56:07 +0000 (23:56 -0500)] 
Initialize ptr to NULL to silence Clang warning.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
6 years agoAdd release note blurb for Clang support.
Austin Seipp [Thu, 20 Jun 2013 23:25:22 +0000 (18:25 -0500)] 
Add release note blurb for Clang support.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
6 years agoDocument -fwarn-dodgy-imports changes in release notes. Trac #7167.
Austin Seipp [Thu, 20 Jun 2013 23:22:48 +0000 (18:22 -0500)] 
Document -fwarn-dodgy-imports changes in release notes. Trac #7167.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
6 years agoFix rts/package.conf.in ld-options for Clang.
Austin Seipp [Thu, 20 Jun 2013 22:06:23 +0000 (17:06 -0500)] 
Fix rts/package.conf.in ld-options for Clang.

Now with less Mac-breakage.

With this change, I can get a working stage1/stage2 compiler using
Clang 3.4svn, which can be used to link working executables!

Signed-off-by: Austin Seipp <aseipp@pobox.com>
6 years agoSupport QNXNTO for arm under LLVM
Stephen Paul Weber [Thu, 20 Jun 2013 01:22:45 +0000 (20:22 -0500)] 
Support QNXNTO for arm under LLVM

Signed-off-by: Austin Seipp <aseipp@pobox.com>
6 years agoFix #7661 regression.
David Terei [Thu, 20 Jun 2013 01:51:03 +0000 (18:51 -0700)] 
Fix #7661 regression.

Patch from singpolyma.

6 years agoRe-untabify rts/packages.conf.in
Austin Seipp [Wed, 19 Jun 2013 06:27:33 +0000 (01:27 -0500)] 
Re-untabify rts/packages.conf.in

Signed-off-by: Austin Seipp <aseipp@pobox.com>
6 years agoRevert "Fix rts/packages.conf.in ld-options for clang."
Austin Seipp [Wed, 19 Jun 2013 06:25:58 +0000 (01:25 -0500)] 
Revert "Fix rts/packages.conf.in ld-options for clang."

This reverts commit 991f285e681e8541632502d05d8a46de2d44b7bd.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
6 years agoRevert "Untabify rts/packages.conf.in"
Austin Seipp [Wed, 19 Jun 2013 06:25:57 +0000 (01:25 -0500)] 
Revert "Untabify rts/packages.conf.in"

This reverts commit ebf97ad146173afd9e094f4975aa33717ed3a11e.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
6 years agoRevert "Actually fix rts/packages.conf.in ld-options."
Austin Seipp [Wed, 19 Jun 2013 06:25:49 +0000 (01:25 -0500)] 
Revert "Actually fix rts/packages.conf.in ld-options."

This reverts commit 5dc74f385f1bbc9248ed950af255b946677c2ff9.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
6 years agoFix typo in header guard.
Austin Seipp [Wed, 19 Jun 2013 05:16:18 +0000 (00:16 -0500)] 
Fix typo in header guard.

Spotted by Clang.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
6 years agoActually fix rts/packages.conf.in ld-options.
Austin Seipp [Wed, 19 Jun 2013 04:09:34 +0000 (23:09 -0500)] 
Actually fix rts/packages.conf.in ld-options.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
6 years agoUntabify rts/packages.conf.in
Austin Seipp [Wed, 19 Jun 2013 03:24:52 +0000 (22:24 -0500)] 
Untabify rts/packages.conf.in

Signed-off-by: Austin Seipp <aseipp@pobox.com>
6 years agoFix rts/packages.conf.in ld-options for clang.
Austin Seipp [Wed, 19 Jun 2013 03:21:42 +0000 (22:21 -0500)] 
Fix rts/packages.conf.in ld-options for clang.

Technically, '-u' is an ld option, not a compiler option,
and clang considers this argument unused. Hence, we must
explicitly forward this to the linker.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
6 years agoFix many ASSERT uses under Clang.
Austin Seipp [Tue, 18 Jun 2013 23:45:31 +0000 (18:45 -0500)] 
Fix many ASSERT uses under Clang.

Clang doesn't like whitespace between macro and arguments.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
6 years agoSuppress some more warnings from Clang.
Austin Seipp [Tue, 18 Jun 2013 23:40:32 +0000 (18:40 -0500)] 
Suppress some more warnings from Clang.

It likes to think lambdas a la:

    foo $ \u -> ...

represent a kind of unicode extended literal.

It also gets confused when you have things like:

    ... thing ... {- comment ... (???) -}

where the (???) is mistaken as a trigraph.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
6 years agoUse assembler-with-cpp mode when running CPP.
Austin Seipp [Mon, 17 Jun 2013 11:12:08 +0000 (06:12 -0500)] 
Use assembler-with-cpp mode when running CPP.

This is needed because Clang is very strict about C99 macro rules, which
dictate that '#' in a body must have a token immediately following it for
string-ification. In practice we break this all the time, because we do
very weird stuff like:

    #define FOOBAR(xyz) \
    {-# SOME PRAGMA #-} \
    baz :: (xyz) \
    baz = ...

where the leading '#' in in the macro body clearly breaks this rule.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
6 years agoRemove redundant import, revealed by the fix to #7963
Simon Peyton Jones [Tue, 18 Jun 2013 09:55:15 +0000 (10:55 +0100)] 
Remove redundant import, revealed by the fix to #7963

6 years agoEmit addUsedRdrNames for the datacons in a standalone deriving (Trac #7969)
Simon Peyton Jones [Mon, 17 Jun 2013 21:45:28 +0000 (22:45 +0100)] 
Emit addUsedRdrNames for the datacons in a standalone deriving (Trac #7969)

6 years agoUse ideclImplicit to filter out only *implict* Prelude imports (Trac #7963)
Simon Peyton Jones [Mon, 17 Jun 2013 21:39:43 +0000 (22:39 +0100)] 
Use ideclImplicit to filter out only *implict* Prelude imports (Trac #7963)

The ideclImplicit flag didn't exist before, but it does now,
and it makes this code simpler and makes it easy to fix Trac #7963.

6 years agoWork-around clang weirdness by adding a newline.
Austin Seipp [Mon, 17 Jun 2013 10:36:29 +0000 (05:36 -0500)] 
Work-around clang weirdness by adding a newline.

I really wish this were a joke, but alas...

This gets me a working stage1 compiler on Linux with Clang with no
modifications. Unfortunately it won't get much farther than that for
various other reasons.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
6 years agoAdd some missing clang bits to the build system.
Austin Seipp [Mon, 17 Jun 2013 09:57:18 +0000 (04:57 -0500)] 
Add some missing clang bits to the build system.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
6 years agoRelease note blurb for Linker fixes.
Austin Seipp [Mon, 17 Jun 2013 01:19:54 +0000 (20:19 -0500)] 
Release note blurb for Linker fixes.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
6 years agoDetect linker information at runtime. Fixes Trac #6063
Austin Seipp [Sat, 4 May 2013 21:07:22 +0000 (16:07 -0500)] 
Detect linker information at runtime. Fixes Trac #6063

Previously, we did ./configure time checks to see if 'GNU ld' supported
certain options. If it does, we bake those options into the link step.
See Trac #5240.

Unfortunately, the linker we use at runtime can change for several
reasons. One is that the user specifies -pgml 'foo'. The other is if
/usr/bin/ld or whatnot changes from when GHC was built.  Those options
mentioned earlier are specific to GNU ld, but many systems support GNU
gold too. This is Trac #6063.

So we need to check at runtime what linker we're using. This is actually
a little bit complicated because we normally use the C compiler as our
linker. Windows and OS X are also special here.

Finally, this patch also unconditionally gives '--hash-size=31' and
'--reduce-memory-overheads' to the system linker if it's GNU ld. These
options have been supported for 8+ years from what I can see, and there
are probably a lot of other reasons why GHC would not work with such an
ancient binutils, all things considered.

See Note [Run-time linker info] in SysTools for details. There are
plenty of comments as well in the surrounding code.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
6 years agoFix ghci crash when the user code closes stdin
Ian Lynagh [Sat, 15 Jun 2013 20:54:22 +0000 (21:54 +0100)] 
Fix ghci crash when the user code closes stdin

Now that we share stdin with the program, we have to check for
handle-closed as well as EOF, as the program might have closed
stdin.

6 years agoOptimise lockClosure when n_capabilities == 1; fixes #693
Ian Lynagh [Sat, 15 Jun 2013 18:07:58 +0000 (19:07 +0100)] 
Optimise lockClosure when n_capabilities == 1; fixes #693

Based on a patch from Yuras Shumovich.

6 years agoWhitespace and braces only
Ian Lynagh [Sat, 15 Jun 2013 16:08:42 +0000 (17:08 +0100)] 
Whitespace and braces only

6 years agoAdd braces for clarity
Ian Lynagh [Sat, 15 Jun 2013 15:41:21 +0000 (16:41 +0100)] 
Add braces for clarity

6 years agoMaintain per-generation lists of weak pointers (#7847)
Takano Akio [Mon, 11 Mar 2013 09:51:05 +0000 (18:51 +0900)] 
Maintain per-generation lists of weak pointers (#7847)

6 years agoCheck for a weak pointer being dead before we do any allocation for it
Ian Lynagh [Sat, 15 Jun 2013 15:36:29 +0000 (16:36 +0100)] 
Check for a weak pointer being dead before we do any allocation for it

6 years agoAllow multiple C finalizers to be attached to a Weak#
Takano Akio [Thu, 18 Apr 2013 09:30:23 +0000 (18:30 +0900)] 
Allow multiple C finalizers to be attached to a Weak#

The commit replaces mkWeakForeignEnv# with addCFinalizerToWeak#.
This new primop mutates an existing Weak# object and adds a new
C finalizer to it.

This change removes an invariant in MarkWeak.c, namely that the relative
order of Weak# objects in the list needs to be preserved across GC. This
makes it easier to split the list into per-generation structures.

The patch also removes a race condition between two threads calling
finalizeWeak# on the same WEAK object at that same time.

6 years agoOptimization for takeMVar/putMVar when MVar left empty; fixes #7923
Ian Lynagh [Sat, 15 Jun 2013 12:19:21 +0000 (13:19 +0100)] 
Optimization for takeMVar/putMVar when MVar left empty; fixes #7923

We only need to apply the write barrier to an MVar when it acquires
a reference to live data; when the MVar is left empty in the case
of a takeMVar/putMVar, we can save a memory reference.

Patch from Edward Z. Yang.

6 years agoWhitespace only in rts/storage/SMPClosureOps.h
Ian Lynagh [Fri, 14 Jun 2013 21:02:56 +0000 (22:02 +0100)] 
Whitespace only in rts/storage/SMPClosureOps.h

6 years agoCleaning fixes, and other build system tweaks; part of #7941
Ian Lynagh [Fri, 14 Jun 2013 12:56:17 +0000 (13:56 +0100)] 
Cleaning fixes, and other build system tweaks; part of #7941