Fix pcre cache to not fatal when full

Summary: So pcre cache can only hold 96x1024 items, when we hit full we raise an
error. From what I can see there isn't a good reason we can't just
continue.

If one is doing 98,304 unique regular expressions you probably don't
care about regular expression caching.

Since we're using AtomicHashArray we can't purge anything without adding
a lock and we'd probably want to do LRU rather than what PHP does which
is FIFO eviction.

Also changed the code to check Folly's full parameter rather than
relying on calling .size().

Reviewed By: @ptarjan

Differential Revision: D1168192
Optimize checks in iter_next_packed also

Summary: I realized I could play the same trick as D1340787 for
iter_next_packed.

Reviewed By: aravind

Differential Revision: D1343589
Create a CodeGenFixups class

Summary: Create a CodeGenFixups class, to hold temporary information that will eventually be put in global tables. Put m_pendingFixups, m_pendingCatchTraces and a newly created m_pendingJmpTransIDs there.

The goal is to have a single place to hold information that may need to be fixed up if we modify the generated code before committing it (eg by relocating it, or by peephole optimizations). Also, these are things that must not go into the global tables if we end up rolling back.

Reviewed By: @ottoni

Differential Revision: D1347532
Fix clang build

Summary: thats it

Reviewed By: @dariorussi

Differential Revision: D1348180
Get rid of SmashTarget

Summary: The SmashTarget is a short lived, malloced data block that gets passed
to handlePrimeCacheInit, telling it how to smash the call. The information it
contains is the address of the movq instruction that needs smashing, and the
return address of the handlePrimeCacheInit method.

We can find the return address by inspecting the stack, and then we can
pass in the offset from that to the movq instead of passing in the address
of a SmashTarget.

In addition to avoiding the malloced data, this has the nice effect of making
all the code position independent too.

Reviewed By: @mxw

Differential Revision: D1348201
Fix crash on missing trait in RepoAuthoritative mode

Summary: At some point we stopped checking up front that
traits exist in RepoAuthoritative mode. But we still assume
that Unit::lookupClass will find them, and crash if not.

This checks every trait, and fatals if it doesn't exist.

Reviewed By: @dariorussi

Differential Revision: D1348353
Fix for Xenon crash, change order of decRef between locals and $this

Summary: Making lifetime of $this longer so that a stack walk from Xenon can still find the class and a somewhat usable $this

Reviewed By: jan, mwilliams

Differential Revision: D1343247
added 'Z' format string for pack/unpack

Summary: Since PHP 5.5 there is a 'Z' format string for (un)pack with equivalent functionality to 'a'.

HHVM has not implemented this yet.

See: http://docs.hhvm.com/manual/en/function.pack.php
Closes #2713

Reviewed By: @ptarjan

Differential Revision: D1345185

Pulled By: @JoelMarcey
Add test for PHP subclass type strictness behavior

Summary: lolwut

Reviewed By: @ptarjan

Differential Revision: D1347668
Ignore /bin

Summary: Folder is generated by cotire
Closes #2755

Reviewed By: @fredemmott

Differential Revision: D1348999

Pulled By: @JoelMarcey
Truncate regions before type assert opcodes

Summary: analyze() was doing this but the tracelet selector wasn't. Luckily
it's a super simple fix. This was causing us to miss out on some type
information from hhbbc.

Reviewed By: ottoni, jdelong

Differential Revision: D1347717
Convert null_object/resource references

Summary: We've been using null_* when we really want to just return an
empty/new Object/Resource/String/Array. This is in preparation
for a codemod that will convert these sites to null_foo_value but gets
the short-term win. Handle Variant in a separate diff because it of the
semantics.

Reviewed By: @markw65

Differential Revision: D1344569
CMake: install headers under DESTDIR

Summary: The relatively new HHVM_INSTALL_HEADERS function has some special code
to recursively copy files to the target, using file(COPY ). However,
file(COPY) does not by default prefix with DESTDIR and would install the
headers into the system paths, instead of under the supplied destination
directory.

Change the function to prefix the target with $ENV{DESTDIR} to fix this.

This matters especially for downstream packagers, as packages usually
build by running "make install" using a DESTDIR, then packaging that
directory up. Without this, compilation would fail, as the build system
would attempt to install in a privileged system directory.
Closes #2777

Reviewed By: @fredemmott

Differential Revision: D1349240

Pulled By: @JoelMarcey
Remove CMake/FindLibEvent.cmake.bak

Summary: CMake/FindLibEvent.cmake.bak is presumably a backup file from an older
version of CMake/FindLibEvent.cmake that has been commited by accident
during the initial open-source release (commit c3f1ab2).

Remove it as it's obviously redundant.
Closes #2776

Reviewed By: @fredemmott

Differential Revision: D1349226

Pulled By: @JoelMarcey
Convert Variant references

Summary: Use init_null() when returning Variant, and uninit_null() when
returning Variant() to make intent more clear and save some work.

Reviewed By: @markw65

Differential Revision: D1344927
Kill AsyncFunctionWaitHandle::{get,set}PrivData()

Summary: Kill unused m_privData in AsyncFunctionWaitHandle. Does not save any memory
because of 16-byte alignment.

Reviewed By: @billf

Differential Revision: D1344989
Fix test/quick/redeclared_function.php.expectf

Summary: The path was too specific

Reviewed By: aravind

Differential Revision: D1349678
cut session_id() size by 1/2

Summary: We were converting it to ascii hex first, then converting that to the final encoding they ask for. Lets stay in binary until the final encoding.

Closes #1884

Reviewed By: @JoelMarcey

Differential Revision: D1347195
don't kill shutdown functions when you want a session one

Summary: Closes #2725

Reviewed By: @fredemmott

Differential Revision: D1347393
Some eta conversion cleanup

Summary: Saw it, didn't like it.

Reviewed By: @swtaarrs

Differential Revision: D1349390