Merge pull request #791 from ptarjan/unused_var

fix unused variables in third-party
allow (clone)->bar() and (<xhp>)->bar()

People have asked for ##(new Foo)->bar()##, ##(clone Foo)->bar## and ##(<xhp>)->toString()##.
fix thrift for namespaces

Thrift doesn't autoload the class, it just does a ##lookupClass##. We need to normalize it so the lookup doesn't fail.

Closes #775
support IteratorAggregateClass

someone added this class but didn't really hook it up. This was breaking Symfony.
clean up SharedMap

This diff cleans up some of the mess in SharedMap. The existing way of accessing values in ShareMap is SharedMap -> SharedVariant -> ImmutableMap -> SharedVariant. This diff changes it so that the path is reduced to SharedMap -> ImmutableMap (with inlined SharedVariants).
(Likewise for VectorData)

The hashing scheme in ImmutableMap is left unchanged (chaining with ->next pointers, though we could change it to something similar to HphpArray).
Use r15 instead of r13 in generic return dec-refs

This avoids a bad interaction with LinearScan, which saves the return
value in r13 and r14 around GenericRetDecRefs.  Effectively, this diff
ends up saving a push, a pop, and some stack adjustment in
GenericRetDecRefs.
Inline CreateCont's with arguments.

Well, this was a lot easier than expected. Don't give up inlining Cont creation just because it takes args.
Remove edges when dce eliminates a whole block

If DCE eliminates a block that ends with a Jmp_, two things
can currently go wrong.  One is that linearscan will still inspect the
incoming edge to try to precolor jump destinations and fail an assert;
the other is that the type of the DefLabel destination may be too
relaxed.

This diff adds a new checkCfg invariant that all incoming edges to a
DefLabel are in the block list for the trace, and weakens the assert
in linearscan so things still work if DCE is turned off but a block
becomes unreachable.  Also changes dce's removeUnreachable to
reflowTypes if it removes an incoming edge.
Make LdClsCns not CSE-able

If you load the same class constant multiple times in a
tracelet, this will extend the lifetime of the LdClsCns, and reuse it
at sites past the CheckInit guard.  It can generate incorrect code if
the LdClsCns has a type more specialized than Cell (because if the
unlikely branch happens, later code will reuse the uninit value that
was loaded), and if the type is less specialized it keeps two GPRs
live longer than probably makes sense.
Fix an issue in the register allocator

An optimization I'm working on sent the register allocator a
CFG that looked like this:

  M0
  | \
  |  M1
  M3 | \
  |  |  E4
  |  M8
  | /
  M2
  |
  M5

The RPO was 0 1 8 4 3 2 5.

It assert-fails here because it visited E4 before M3, and it appears
this would incorrectly mark everything as free.

This diff changes the register allocator to skip all non-main-trace
blocks during the first pass over the CFG.  Then each exit block is
visited.
add SplHeap, SplMaxHeap, and SplMinHeap

closes #505
Fix a fallthrough bug in TranslatorX64::smash

If smash is told to generate a forward jump to a target less
than 7 bytes away, it nops out the intermediate region.  It's
currently impossible for this to cause any issues (as far as I know),
but technically there can be other instructions in there.  I hit this
by randomizing the layout of blocks in codegen---if you place a block
consisting of only a short backward jump immediately after the block
containing the main trace exit, and then a fallthrough-ish translation
occurs, smash will nop out the short-jump block.
indent function docblocks
Use uppercase for RuntimeOption static methods.

Main style for static functions is UpperCase.
Don't use RAND_bytes() under valgrind.

The results are marked uninitialized and trigger spew.
Fix a bug with debug_backtrace during an unwind

The change to stop zeroing locals during RetC was too
aggressive---we stopped doing it during unwinding also.  When
unwinding, we need to zero locals and $this because another
destructing object may still run debug_backtrace, and we won't have
the *pc == OpRet{C,V} trick to tell us to ignore the junk.
Fix a bug in codegen block order; add a step to choose the order

Codegen had a bug where if you emit a block in astubs that
has a getNext() which is also in astubs, it would omit the jump.
However, it might visit another block in a first, which is allowed to
put code in astubs.  Generally the block order was just defined by the
order that happened to be in the block list by the time we get there.

Change it to emit blocks in the RPO defined by sortCfg for now, after
partitioning them into groups for a and astubs.  This fixes the bug,
and at least makes codegen use a defined order.  We later will
probably want to see about whether we may be able to avoid more jumps
with smarter layout.
Fix crash/hang in Parser::newClosureName

The parser was updating a static std::map without a lock.
It looks like this is supposed to be local to a file anyway,
so add the map as a member of ParserBase.
Extend the type system of the JIT (Type class) to allow for specialized Class instead of just Type::Obj

Allow RuntimeType to specify a more specific Type (by adding a Class*) and transfer that Class* to Type. Extended API to allow discovering when a Type is a subclass of Type::Obj
Keep track of predecessors all the time.

Use a struct wrapping from and to Block* pointers to represent
control flow edges, keeping a predecessor list up to date whenever
edges are updated.  This subsumes EdgeData, which was only used
to track jumps that pass values.