ghc-pkg: make sure info messages go to stdout and errors to stderr (#3818)
Tweak the HADDOCK_DOCS regex in validate

It's less precise now, but still good enough for what we need, and
this way we don't need to have literal tabs in the file.
Improve reporting of type-class errors

Inspired by suggestions on Trac #5858, the errors now
mention "potential instances".  Lots of refactoring
as usual, but localised.
Merge branch 'master' of http://darcs.haskell.org/ghc
Don't defer type errors when evaluating a GHCi expression

It is unhelpful here because the expression will get evaluated right
away anyway, thus emitting a redundant warning followed by an equivalent
runtime exception. If the expression were an ill-typed pure expression,
_three_ equivalent type errors would get emitted (due to the two-phase
typechecking done in 'Plan C')
Wrap quotes in an error message
Documentation update: Enumerations of Integers are subject to list fusion (#5670)
Merge branch 'master' of http://darcs.haskell.org/ghc
Typo in comment
In ghci, reload after :e. Patch from Paolo Capriotti. Fixes #5343
define TABLES_NEXT_TO_CODE in ghcautoconf.h (#5933)
Tweak to flag parsing (#5921)

-o2/Main.exe should be an invalid flag, not a linker input
fix _BTM field of closureFlags[], and document what it means (#5923)
Allow Any as an argument type to foreign prim functions

Real primops can take boxed arguments, and the Cmm code will receive the
pointer to the object on the Haskell heap, e.g. for unpackClosure#. To
be able to implement such a function in a "foreign prim" call, this
needs to be allowed as well. By only allowing Any here (instead of
arbitrary types), it is clearer that the function will not receive the
value in any marshalled form, but just the raw pointer. Haskell code
using such functions are likely to use unsafeCoerce# to turn a haskell
value into a value of type Any.
Fix closure_type_names, BLACKHOLE and BLOCKING_QUEUE were swapped
Add eventlog/trace stuff for capabilities: create/delete/enable/disable

Now that we can adjust the number of capabilities on the fly, we need
this reflected in the eventlog. Previously the eventlog had a single
startup event that declared a static number of capabilities. Obviously
that's no good anymore.

For compatability we're keeping the EVENT_STARTUP but adding new
EVENT_CAP_CREATE/DELETE. The EVENT_CAP_DELETE is actually just the old
EVENT_SHUTDOWN but renamed and extended (using the existing mechanism
to extend eventlog events in a compatible way). So we now emit both
EVENT_STARTUP and EVENT_CAP_CREATE. One day we will drop EVENT_STARTUP.

Since reducing the number of capabilities at runtime does not really
delete them, it just disables them, then we also have new events for
disable/enable.

The old EVENT_SHUTDOWN was in the scheduler class of events. The new
EVENT_CAP_* events are in the unconditional class, along with the
EVENT_CAPSET_* ones. Knowing when capabilities are created and deleted
is crucial to making sense of eventlogs, you always want those events.
In any case, they're extremely low volume.
Calculate the total memory allocated on a per-capability basis

In addition to the existing global method. For now we just do
it both ways and assert they give the same grand total. At some
stage we can simplify the global method to just take the sum of
the per-cap counters.
Change the presentation of parallel GC work balance in +RTS -s

Also rename internal variables to make the names match what they hold.
The parallel GC work balance is calculated using the total amount of
memory copied by all GC threads, and the maximum copied by any
individual thread. You have serial GC when the max is the same as
copied, and perfectly balanced GC when total/max == n_caps.

Previously we presented this as the ratio total/max and told users
that the serial value was 1 and the ideal value N, for N caps, e.g.

  Parallel GC work balance: 1.05 (4045071 / 3846774, ideal 2)

The downside of this is that the user always has to keep in mind the
number of cores being used. Our new presentation uses a normalised
scale 0--1 as a percentage. The 0% means completely serial and 100%
is perfect balance, e.g.

  Parallel GC work balance: 4.56% (serial 0%, perfect 100%)
Add new eventlog events for various heap and GC statistics

They cover much the same info as is available via the GHC.Stats module
or via the '+RTS -s' textual output, but via the eventlog and with a
better sampling frequency.

We have three new generic heap info events and two very GHC-specific
ones. (The hope is the general ones are usable by other implementations
that use the same eventlog system, or indeed not so sensitive to changes
in GHC itself.)

The general ones are:

 * total heap mem allocated since prog start, on a per-HEC basis
 * current size of the heap (MBlocks reserved from OS for the heap)
 * current size of live data in the heap

Currently these are all emitted by GHC at GC time (live data only at
major GC).

The GHC specific ones are:

 * an event giving various static heap paramaters:
   * number of generations (usually 2)
   * max size if any
   * nursary size
   * MBlock and block sizes
 * a event emitted on each GC containing:
   * GC generation (usually just 0,1)
   * total bytes copied
   * bytes lost to heap slop and fragmentation
   * the number of threads in the parallel GC (1 for serial)
   * the maximum number of bytes copied by any par GC thread
   * the total number of bytes copied by all par GC threads
     (these last three can be used to calculate an estimate of the
      work balance in parallel GCs)
Adjust the eventlog description header for the spark counter event

The EventLogFormat.h described the spark counter fields in a different
order to that which ghc emits (the GC'd and fizzled fields were
reversed). At this stage it is easier to fix the ghc-events lib and
to have ghc continue to emit them in the current order.