Link against libpam if it's available

The logic looking at c-client's linkage.h file is too clever. (hah)
Just follow PHP's example and always link it when possible.

Closes #1181
Use hints instead of trace to order blocks in postorderWalk()

postorderWalk() chooses which successor blocks to visit based on
trace; it visits main->exit edges first, to bias towards visiting
them sooner.  (So they'll be later in reverse-postorder).
This diff uses block hints instead.  This will result in slightly
different order for if/then/else regions with an Unlikely arm, that
were entirely on the same trace.  But it should be equivalent for
main->exit edges since exit blocks are all marked Unlikely.

Reviewed By: @jdelong

Differential Revision: D1022275
Partial de-trace-ification of DCE

Some cleanup of DCE, attempting to get rid of IRTrace where
it's not needed.  A lot of DCE deals explicitly with traces so I'll
leave that for the another diff.

Reviewed By: @edwinsmith

Differential Revision: D1023480
Add an unsupported case in scalar array emission

If you don't run some of the optimization passes, sometimes
scalar arrays from UnaryOpExpression will have sub-members that are
other UnaryOpExpressions, which isn't handled here.  It looks like
getScalarValue is there for this.

Reviewed By: @edwinsmith

Differential Revision: D1017234
Make Fatal take only a single OA arg

This was a little more convenient for the bytecode
representation I'm using (it's nice but not critical that all opcodes
with subops only have a single subop).  Also hook up to assembler
while here.

Reviewed By: @alexmalyshev

Differential Revision: D1022933
A few bytecode spec tweaks (relating to FPI, cuf iters)

It's not explicitly listed, but we can't have Catch, Fault or
DV entry offsets inside of FPI regions, so I added that.  Also update
a little bit about Cuf iters.

Reviewed By: @edwinsmith

Differential Revision: D1019493
import mongo extension

This is the biggest extension on pecl. Most of their tests depend on a server implementation which I don't really want to package into our test infra yet.

Many of the tests don't pass, but I want to get this up for review with the passing tests since i think many of the changes are good.

Reviewed By: @paroski

Differential Revision: D979397
re-import zend headers

Had I been smarter when I started this project, I would have done this from the begining. It used to be a hodgepodge of some implementation in headers and others in .cpp. When I would import a new extension I had to fight importing all the new macros and function signatures, putting them in their right place or else I will get compile errors.

So, I spent today cleaning up this story. Now all headers are original Zend (codemodded with tabs to spaces) with any changes I needed to make wrapped in a `#ifdef HHVM`. That way if I ever want to re-import I can slice it and insert it easily. It also has the nice property that the old code is right there so you can compare at the glance what I am doing and what they are doing.

I updated the README to explain the file structure.

I talked to @jdelong and @markw65 about a good long-term solution. @jdelong things we should code to the API and not share any implementation, @markw65 prefers compile errors  but said link errors would be ok. He just doesn't think I should pull in all the implementations and force run-time errors since those would be hard to debug. I think having their `.h` files and our own `.cpp` is a good compromize for now.

Reviewed By: @paroski

Differential Revision: D983907
Native.h macro typo

Fix macro typo

Reviewed By: @JoelMarcey

Differential Revision: D1023850

Pulled By: @scannell
Remove dead hphpc options

Remove hphpc options that are no longer used

Reviewed By: @markw65

Differential Revision: D1023862
Re-implement GenerateDocComments

GenerateDocComments had inadvertently become a no-op. Restore
it.

Reviewed By: @markw65

Differential Revision: D1023934
Regionize and retranslate each function at once

This diff changes how region translation operates, with the goal of
improving code locality.  Instead of triggering retranslation at a
translation granularity, this diff changes things so that only
translations corresponding to the function-body entry trigger
retranslations.  The other translations still keep their profile
counters, which are used to guide region formation.

When an optimized retranslation is triggered for a function, a series
of regions is created for this function.  These regions ensure that
all profiling translations for this function (and control flow arcs
connecting them) are covered by the regions created.  The regions are
then translated consecutively in the TC, following an order that tries
to improve the locality of the generated code.

After a function has been regionized, any retranslation that is
triggered by new live types uses the tracelet JIT.

Reviewed By: @swtaarrs

Differential Revision: D1017506
Fix /stop command issued when hhvm can't bind port

When HHVM can't bind to a port it tries to shut down the
currently running instance using /stop on the admin port, but
RuntimeOption::ServerIP was blank (do we actually set this anywhere?)
and we weren't passing the admin password.

Reviewed By: @markw65

Differential Revision: D944849
Don't read NormalizedInstruction's inputs in IRTranslator

I'm planning on eliminating the inputs vector soon. Reading types from
it (instead of HhbcTranslator) can bypass guard relaxation, and the information
is all available elsewhere. This diff just includes the straightforward cases;
the more invasive bytecodes will come in separate diffs.

Reviewed By: @ottoni

Differential Revision: D965348
Add new dest types for LdRef and This, add support for weak type constraints

LdRef now removes any specialization from what we think is in the
inner type, to avoid having to guard on it again. This produces a value
specialized with the current context class. Weak type constraints go through
the process of finding the appropriate guard to constrain but don't actually
constrain the guard. They can be used to determine if we can use a specialized
type without having to add any additional guards, which I'll need to do in an
upcoming diff.

Reviewed By: @ottoni

Differential Revision: D1020843
Clean up Assert(Type|Loc|Stk), add filterAssertType

filterAssertType is used by some upcoming code to handle things like
assserting {InitNull|Obj<C>} when the known type is Obj. I also cleaned up how
we handle invalid types from static analysis. We used to replace the assert
instruction with a Fatal, but we can still end up generating bogus IR if we
continue translating. The best thing to do (for now) is to punt on the whole
trace, since there's no clear way to create well-formed IR for the whole thing.

Reviewed By: @jdelong

Differential Revision: D1020613
Clean up class property and global setting/getting code

This code was quite old and was using predicted types and strings
passed in from fields on NormalizedInstruction, which will be going away
soon. It's been changed to just use the information we already have available
in m_evalStack and rely on the optimizations/prediction support we have now. I
also fixed a bug where the name string wasn't being consumed on every path by
reworking who's responsible for destroying it.

Reviewed By: @jdelong

Differential Revision: D1020885
Stop using class names from NormalizedInstruction in emitAGet*

If the names are really constant, they should be available to
HhbcTranslator. If there are any cases where they're not available, we should
make them available.

Reviewed By: @jdelong

Differential Revision: D1020897
Move most of FPushCuf's work from IRTranslator to HhbcTranslator

This kind of logic doesn't belong in IRTranslator, especially since
it's a thin layer we'd like to eventually get rid of.

Reviewed By: @oyamauchi

Differential Revision: D1020911
Stop using Classes from NormalizedInstruction in emitFPushObjMethodD

This information is available in the IR so let's get it from there
instead of NormalizedInstruction. This is part of my crusade to minimize
IRTranslator's role and eliminate NormalizedInstruction.

Reviewed By: @ottoni

Differential Revision: D1020925