Merge upstream

[ci skip]
Merge branch 'master' into development
Expose Message and broaden the scope of polymorphic expect

Remove AbstractMessage and replace its forward and maybeHandleMessage
API with versions that operate directly on Message. Create Typeable
and Binary instances for Message and export the type from Process.hs
(though not the constructor). Provide functions for matching, wrapping
and unwrapping Message.
DP-57 DP-7 #resolve #comment merge branch expose-message into development
DP-20 #resolve #comment Optimise local message passing

We skip the transport layer altogether for local send and write directly
to the local NC control channel. Local sends do serialise the message
(to ensure HNF) but we pass the unencoded data along with a fingerprint.
Subsequent reads utilise unsafeCoerce if fingerprint comparison on the
types succeeds.
Link the node controller and node event listener threads

If either fails, the exception will be rethrown to the other thread. In
addition, when the NT listening loop ends normally (i.e., the endpoint
has been shut down) and control channel signal notifies the NC thread to
terminate as well - no more potential zombies.

DP-39 #resolve
Merge branch 'local-send' into development
Merge branch 'nc-linked-threads' into development
Need stm version 2.4 because of the use of TQueue

Spotted by Peter Robinson.
Add a simple 'process ring' benchmark
Add an erlang version of the ring benchmark
Need stm version 2.4 because of the use of TQueue

Spotted by Peter Robinson.
Merge branch 'ring-benchmarks' into development
Fix ProcessRing benchmarks
Allow full rtsopts for ProcessRing benchmark
Named send is intra-node, so we can use the optimised routing / encoding
Ensure the NC and event loop threads hold only weak refs to one another
Re-work linked shutdown between NC and listener threads

Using `throwTo` seems sensible, but holding on to a ThreadId can prevent
BlockedIndefinitely exceptions (such as BlockedIndefinitelyOnMVar) from
propagating. Instead we ensure that once the NC terminates, the endpoint
gets closed, and vice versa. The NC handles its termination signal with
throwIO, avoiding this problem.
Allow binary == 0.7.*
C.D.P.Internal.Primtives.mask does not work correctly if unmask is
called by a process other than the one that called mask. An example
of this behavior is in callLocal below. The expected behavior of test is this:

Wed May  8 22:50:01 UTC 2013 pid://127.0.0.1:8080:0:3: hi
Wed May  8 22:50:01 UTC 2013 pid://127.0.0.1:8080:0:4: hi
Wed May  8 22:50:01 UTC 2013 pid://127.0.0.1:8080:0:5: hi

Each say is emitted by a distinct process. However, the observed
behavior is given here:

Wed May  8 22:38:57 UTC 2013 pid://127.0.0.1:8080:0:3: hi
Wed May  8 22:38:57 UTC 2013 pid://127.0.0.1:8080:0:4: hi
Wed May  8 22:38:57 UTC 2013 pid://127.0.0.1:8080:0:3: hi

Note that the say called within callLocal thinks it is running
in the same process as its parent, even though there is a
spawnLocal between them.

This commit fixes this behavior.