break out hhvm request timeout / memout counters for psp vs non-psp

Summary: break out hhvm request timeout / memout counters for psp vs non-psp

Reviewed By: @bertmaher

Differential Revision: D1474528
Clean up some tracing and asserts

Summary: I added all of this while debugging various issues and figured it'd be
generally useful.

- Convert unwind.cpp to use ITRACE.
- Assert that spoff is correct on tracelet entry.
- Use visitStackElems to verify stack contents in checkFrame.
- Fix RBTrace codegen for code relocation by using rip-relative lea

Closes https://github.com/facebook/hhvm/pull/3219

Reviewed By: @bertmaher

Differential Revision: D1443194

Pulled By: @swtaarrs
make it possible to log per request if oom or timeout triggered in dynostats

Summary: make it possible to log per request if oom or timeout triggered in dynostats

Reviewed By: @bertmaher

Differential Revision: D1474569
Fix race condition in DebuggerProxy start/stop

Summary: hphpd is sometimes crashing while calling pollSignal() on an already
destructed DebuggerProxy from an AsyncFunc.  (This manifests as a pure
virtual call to ThriftBuffer::flushImpl()).

It looks like there's a potential race condition where we might stop the
proxy and clean it up after we've added it to the Debugger's map, but
before we've actually started it up.  Let's fix this and hope it fixes
the crash also.

Reviewed By: @markw65

Differential Revision: D1468019
Fix LowPtr load in codegen

Summary: Use emitLdLowPtr().

Reviewed By: @swtaarrs

Differential Revision: D1475166
Support stream wrappers in XML parser extensions, add external entity loader

Summary: * Support stream wrappers in SimpleXML, DOM and XMLReader input and
  output filenames.
* Rename libxml_input_buffer() to libxml_create_input_buffer().
* Implement userspace function libxml_set_streams_context(), was
  previously missing.
* Since the VM can now be re-entered during parsing, with libxml2 in the
  call stack with -fomit-frame-pointer, all XML parsing functions must
  be protected with SYNC_VM_REGS_SCOPED().
* In DOMDocument, don't do File::TranslatePath() on input filenames,
  since they can now be URLs, and translation is now redundant with that
  done by FileStreamWrapper.
* In simplexml_load_file(), call xmlReadFile() instead of
  f_file_get_contents(), so that the libxml default stream context is
  used. Almost fixes test/zend/bad/ext/libxml/tests/bug54440.php, except
  for a minor error handling issue that should be dealt with by GitHub
  PR #2376.
* In stream_context_create(), return a default stream context resource
  when the options fail validation, instead of returning false. This
  matches the PHP behaviour and makes
  hphp/test/zend/bad/ext/libxml/tests/bug63389.php pass.
* Move passing tests to hphp/test/zend/good
* Add test.xml, copied from PHP 5.6.0-dev, needed by a passing test.
* Add an external entity loader. This allows the use of "data:" and
  "compress.zlib:" in entities and URIs.

Since loading external entities exposes a number of security issues including
remote shell execution, it's disabled by default (except for the data: protocol
which isn't actually external). The new config option is documented in
doc/inconsistencies.

Closes: #2329
Closes: #2829

Reviewed By: @ptarjan

Differential Revision: D1468180
fixed using []s in ini settings

Summary: Ini setting arrays were not being incremented properly when the push back syntax was used i.e. extensions[] = "foo.so". The folly::dynamic isInt() function does not check if a type can be converted to an it only if it is currently an int. Unfortunately, there does not appear to be a way to test this other than trying to convert the string to an int and catching the error. It appears there are two options, either we catch the exception (what I implemented) or we just insert the new key as an int. The latter seems like a poor choice because when the setting is later Get()ed any user defined numerical offsets will conflict with our internal numbers and one of the two would dissapear.

Reviewed By: @ptarjan

Differential Revision: D1474402
Revert "Optimize APC objects and collections by defining an APCCollection class and increasing the number of APCObject vs serialized objects"

Summary: This reverts commit 9678712bfce1bdd3b607feb7dd2328410dc45331.

This is being reverted because it doesn't quite respect the behavior for
__sleep().

Reviewed By: alexanderm, bertrand, smith

Differential Revision: D1475357
Force OOM check on large smart allocations

Summary: smartEnlist is used to add large smart allocations that don't
fit within the slabs. When using jemalloc, we account for these using
the per-thread stats, but they don't show up in m_usage. This
effectively means if the largest blocks are on that path, until we are
using enough of tracked, slab-based object allocations to go over max
bytes (which could be a long time) jemalloc might have overflowed but
this is invisible to us.

Technically there is still a hole here, since something outside of the
memory manager could have overflowed jemalloc's per-thread accounting,
but this fixes one obvious source. #4836461 would help us seal it
entirely.

Reviewed By: @jasone

Differential Revision: D1475090
Fix lookupCnsU

Summary: Looking up constants with fallback was broken since the return value
would never be filled in.  This was breaking composer init.

Reviewed By: @markw65

Differential Revision: D1472130
Fix error for (Recursive)CachingIterator::ctor's param 1

Summary: Fixed the TODO

Was this from when HipHopSyntax wasn't available?
Closes https://github.com/facebook/hhvm/pull/3351

Reviewed By: @elgenie

Differential Revision: D1475170

Pulled By: svcscm
typechecker: cleaner variable names in sub_type

Summary: ... when both args have the same type and order matters,
 the names matter as well; ##ty1## and ##ty2## don't communicate
 much about their presumed subtype relationship.

Reviewed By: @jwatzman

Differential Revision: D1466669
typechecker: typing new static() [2/3]

Summary: Enforce "descendants of this class must have compatible
 `__construct` declarations", due to either properties of the
 class/`__construct` method, or due to the use of the
 `<<ConsistentConstruct>>` attribute.

Reviewed By: @jwatzman

Differential Revision: D1466669