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.
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.
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.
Track haskeline Win64 fix
Fix Trac #8028.

Check for an empty list of equations when converting
a closed type family from TH to an HsDecl.
Do not build dynamic libraries with the perf-llvm BuildFlavour.
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.
Merge branch 'master' of http://darcs.haskell.org/ghc
Comment out a leftover pprTrace
include FastString.string_table in CoreMonad.reinitializeGlobals
copy the plugin's FastStringTable changes back into the host compiler
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>
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>
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>
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>
Fix segfault with STM; fixes #8035. Patch from errge.
emacs-friendly completion command for ghci; part of #5687. Patch from hvr.
Docs for ghci completion command for ghci; part of #5687. Patch from hvr.
Alpha rename some functions for consistency
Fix build