add reporting crashes section to README.md
Add mapWithKey() and filterWithKey() APIs

This adds mapWithKey() and filterWithKey() APIs to all keyed collections
(Vector, Map, and StableMap). These APIs are similar to map() and filter().
The key difference is that these APIs pass both the key and the value to
the user callback.

Differential Revision: D939972
Make X64Assembler short-lived

This is a wide-ranging refactor. We should not have long-lived (i.e.
member) X64Assemblers anymore.

A couple of these changes are non-mechanical, and I'll point them out in
inline comments.

There are a couple things left to do:

- CodeGenerator still has member assemblers. We'll need to apply similar
  changes there, and it's just a ton of functions. I'm leaving that for
  a separate diff.

- This gets us closer to being able to remove the frontier(), base(),
  etc. member functions from X64Assembler, which will be the forcing
  function to finally separate CodeBlock concerns from assembler
  concerns.

Differential Revision: D950811
Move emitCall and surprise-flags checking

This is a pretty small thing, but better this way than as part of a
bigger diff.

One interesting thing here is that I'm now having to pass a FixupMap
into one of these stateless helpers, which raises the question of how,
in general, we're going to deal with helpers like this that need to
modify translator metadata (like the fixup map, SrcDB, debug info, ...).

I'm also cheating a bit inside emitCall, grabbing the global tx64
instance to possibly fetch a native trampoline. This is part of the same
problem: how can these stateless helpers cleanly affect global
translator state?

In this particular instance, it would have been easy to make the
fixup-map calls from the emitCheckSurpriseFlagsEnter callsites instead,
but I was uncomfortable with separating the actual assembly call from
the corresponding fixup-map entry.

I also opted to pass CodeBlocks into emitCheckSurpriseFlagsEnter,
instead of Asms, since it made the surrounding code cleaner.

Differential Revision: D954120
Document the H location code

Differential Revision: D953650
Rename vm/jit/trace.h to vm/jit/ir-trace.h to match the class name

Differential Revision: D954132
Fix segfault when debugger attempts to set breakpoints

I'm seeing a steady stream of core files from dev boxes with faults under TranslatorX64::addDbgGuards(). Inspecting some of the cores shows that we have a SrcKey with a FuncId which maps to a null Func*. This can happen if a Func is destroyed. Add a function to determine if a FuncId is valid, and use that to skip consideration of SrcKey's which are invalid.

Differential Revision: D954427
don't try to use mysql connection if connect fails

mysql extension was incompatibly trying to use a connection that was a failed result of mysql_real_connect() for other APIs which is unsupported by mysqlclient. Fixed that.

Closes #1021

Differential Revision: D955216
Optimize __invoke

__invoke calls were going to the interpreter---this adds a
translation that loads a Func* off of the Class, assuming it's
"normal".  An __invoke is considered non-normal if it is not on a
closure and defined static.  (PHP 5.5 gives a warning in this case,
but still runs the closure as expected.)

This was going to add 8 bytes to HPHP::Class, so I paid for that by
removing an unused hphp_hash_map in Class.  This bumps sizeof(Class)
down to 440.

Differential Revision: D952952
Move Class members around; fix an AtomicSmartPtr bug

HPHP::Class is a bit of a mess.  Regroup various members to
help see what the layout is a little better; mostly stop short of
trying to make the API clearer though.  Made ~Class private and
noticed that AtomicSmartPtr calls incorrectly calls delete from a few
places (the m_parent.reset() in releaseRefs(), for e.g.).  Change some
random junk in unit.h.

Differential Revision: D952969
Shrink IndexedStringMap by 8 bytes

There's 4 wasted bytes inside the FixedStringMap, which we
can reuse for IndexedStringMap's size.  Takes HPHP::Class down to 320
bytes.

Differential Revision: D953063
Fix position of optional user attributes on constructor promoted arguments

Custom attributes were inverted with visibility from 2nd arg on

Differential Revision: D945746
Use StringData::{i,}same in FixedStringMap comparisons

So it can use the inline word-at-a-time comparison thing, but
also just shares code.

Differential Revision: D952995
Tweak how the lexer recognizes XHP class names

Some developers reported that "$x=$y?:foo();" failed to parse correctly
when EnableXHP=1. The problem happens because the lexer is a little too
aggressive with recognizing XHP class names and it treats ":foo" as an XHP
class name, and so the statement fails to parse.

This diff tweaks the lexer so that "$x=$y?:foo();" parses correctly when
EnableXHP=1. This was achieved by changing the lexer so that in ambiguous
situations where there is no whitespace before ":foo" it will not treat
":foo" as an XHP class name. This change only affects static method calls,
static property access, and class constant access that use an XHP class
name as a base. Note that this change does not affect how parsing works
when EnableXHP=0.

This diff also updates the regex for WHITESPACE_AND_COMMENTS to support
single line comments that begin with '#'.

Differential Revision: D952602
Remove extra code related to continuations in local 0 (D842384)

As far as I can tell this is no longer needed as contination doesn't
live in local 0 any more (D842384, D865745).

Differential Revision: D956184
add gettext extension

Very straightforward. I think these zend headers are working. The hardest part was getting my importer to pull in that directory. I think I have to stop flattening them.

Differential Revision: D939269
Make array_combine empty arrays sane

array_combine with two empty arrays should return an empty
array. This was fixed in Zend a while ago (see
https://bugs.php.net/bug.php?id=34857 and
http://php.net/array_combine ). It can't be useful to anyone to have the
old behavior, and causes SEVs:
https://our.intern.facebook.com/intern/sevmanager/sev/467951399979540

Differential Revision: D949569
Small fix to the lexer rules for "async"

"async" should be able to be listed in any order with other method modifiers
such as "public", "final", etc. Make it so.

Differential Revision: D941131
Use <?hh in async function tests

Async functions are enabled only with hiphop syntax. Unbreak unit tests
by switching them from <?php to <?hh.

Differential Revision: D956897
Fix socket_sentto_recvfrom_ipv6_udp Zend compatibility

Change the default value for the port in socket_sendto/recvfrom
from 0 to -1.  A port is only required for AF_INET and AF_INET6 sockets,
and a port of 0 has special meaning, so use -1 to signify that a port
was not passed in as a function argument.

Differential Revision: D954831