Add skipped tests to the result set

Summary: Closes https://github.com/facebook/hhvm/pull/3333

Reviewed By: @LiraNuna

Differential Revision: D1470614

Pulled By: svcscm
use cmake variable to set linker flags

Summary: Putting static linking in C(XX) flags is total overkill, and CMake
provides a nice variable for these kinds of linker flags.

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

Reviewed By: @sgolemon

Differential Revision: D1467630

Pulled By: svcscm
Update Travis CI config so it runs ext_redis tests

Summary: * Declare a redis service, per
  <http://docs.travis-ci.com/user/database-setup/#Redis>
* Set the env var REDIS_TEST_HOST so hphp/test/slow/ext_redis/config.skipif
  doesn't skip the tests.

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

Reviewed By: @sgolemon

Differential Revision: D1467670

Pulled By: svcscm
Remove docs about call_user_func_async

Summary: They has been removed, remove doc about them.

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

Reviewed By: @sgolemon

Differential Revision: D1467623

Pulled By: svcscm
Move zend xsl test from flaky to bad

Summary: It's legitimately failing

Reviewed By: @LiraNuna

Differential Revision: D1471013
Expose extension API version in output of 'hhvm --version'

Summary: It's useful for packaging and configuration management scripts that want to
determine where dynamic extension files should be placed.

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

Reviewed By: sgolemon, ptarjan

Differential Revision: D1469518

Pulled By: svcscm
Flaky disk-space zend tests

Summary: Looks like these both create a disk_total_space

Reviewed By: @LiraNuna

Differential Revision: D1471055
Fix IRBuilder::startBlock

Summary: This function was merging the current FrameState with the block that was about to be started, which is only correct when translating traces. This function was also doing other things that didn't seem necessary (clearing CSE stuff and compatibility checks), which I removed. Finally, this function was doing some block-chaining that isn't correct in general and only seems to be needed for inlining. So I moved this to translateRegion. The end result is that IRBuilder::startBlock now only saves the state for the current block and the switches to the new block.

This diff also adds to Translator a pointer to the current region being translated, which is useful for debugging. This helped me find a bug in createBlockMaps that was causing an assert failure in the refcount validation.

Reviewed By: @bertmaher

Differential Revision: D1436362
Spelling errors in documentation

Summary: Title.

Reviewed By: @bertmaher

Differential Revision: D1465806
Prototype of general host health monitor.

Summary: 1. Extended the memory protector to a general system health monitor,
which takes multiple system metrics into account. The metrics that
are considered by the monitor can be added by creating corresponding
classes (implementing the IHealthMonitorMetric interface, see
'hphp/facebook/runtime/health-monitor/health-metrics.h'), and then
registering it to the health monitor.

2. The health monitor will periodically update all metrics and then
calculate a unified current system health level, then broadcast it
to all observers. Objects that implement IHostHealthObserver interface
can subscribe the system health level by registering themselves as
observers of the system health monitor.

3. Health monitor outputs are exposed to external systems by notifying
the "external-clients-shim" proxy. Currently, it is send to stats.kvp
on port 8088.

The display on Phabricator is a little messy:

— "hphp/util/health-monitor-types.h" is newly added, contents in it
(several interfaces) are abstracted out from job-queue.h and
memory-protector.h, but Phabricator recognizes it as “renamed and
modified from protector-policy.h”.

— Similar things happens to “hphp/facebook/runtime/health-monitor/external-clients-shim.h”
and “host-health-monitor.cpp”.

Reviewed By: @bertmaher

Differential Revision: D1458015
skipif tests should not be in good/

Summary: All of the skipped tests lived in good/ even though they were skipped because they are unsupported (win32, 32bit, etc)

Reviewed By: @ptarjan

Differential Revision: D1471420
Pass InliningDecider by reference in tracelet selector

Summary: We disable inlining and try again if the tracelet gets broken while
still inlining, but the InliningDecider was copied into RegionFormer. We need
to store a reference instead, so the change persists across calls to
RegionFormer::go().

Reviewed By: @mxw

Differential Revision: D1469299
Clean up handling of Obj types

Summary: - Type::operator& wasn't properly combining exact and sub Obj types
- NewInstanceRaw now returns an exact Obj type
- CustomInstanceInit doesn't take a Cls src so being DAllocObj was nonsense
- optimizedCallGetClass was doing different things depending on the opcode the
  object came from, and this was causing behavioral differences between
  inlining analysis and translation. I changed it to do something more generic
  that should be faster anyway, which allows restoring of an assert in
  selectTracelet. It can't be an always_assert like it used to until the
  remaining issues in prod are sorted out.

Reviewed By: @alexmalyshev

Differential Revision: D1469306
Use size_t for string length parameters which are checked against MaxSize

Summary: A common pattern is to reserve space with the ReserveString mode of the
String constructor and then to put data directly into the string buffer
with memcpy() etc. The reserve length was an int, which led to
truncation and exploitable integer overflow for many callers. Added four
test cases demonstrating exploitable heap overflows due to the use of
ReserveString.

There is generally very little performance benefit to using a smaller
type in an argument, since 64-bit alignment is used when passing
parameters on the stack, and 64-bit registers are reserved when passing
in registers. This is in contrast to object storage where there is a
clear rationale for the use of 32-bit types.

So:
* Use size_t for length in all variants of StringData::Make().
* In the version of StringData::Make() which takes a null-terminated
  string with implicit length, do not truncate the return value of
  strlen().
* Use size_t for length in reserve(), shrink() and escalate(), since
  these call the modified StringData::Make() and so can benefit from
  64-bit size checking.
* StringData::setSize() is the one exception; it still uses int, on the
  basis that it is non-throwing, and making it throw would probably mean
  making it  non-inline. In the four test cases, StringData::setSize()
  is called with a smaller size than the one used for the preceding
  StringData::Make(), so it is safe in those cases.

Also:
* Fix a bug in allocFlatForLen() where the length could overflow before
  it was checked against MaxSize. If len is approx. UINT_MAX-2, then
  uint32_t(sizeof(StringData)+len+1) would be a small integer less than
  StringData::MaxSize.
* Fix integer truncation in f_utf8_encode(). If the input string is
  slightly larger than 1GB, data.size()*4 would be a small positive
  integer. Casting to size_t allows the error to be trapped by
  StringData::Make().

Reviewed By: @edwinsmith

Differential Revision: D1431966
Fix heap overflow in sql_regcase() for input >1GB

Summary: Rewrote it using StringBuffer, since that seems to be the standard
way.

Reviewed By: @bertmaher

Differential Revision: D1434342
don't emit all the skipped tests for fbmake

Summary: This breaks phabricator having 5k skipped things clogging up our results.

Reviewed By: @bertmaher

Differential Revision: D1472058
fixed an error in the hphpize.cmake file

Summary: LIBDIR was repeated twice. The first one should have been PREFIX

Reviewed By: @ptarjan

Differential Revision: D1471149
gperftools include file don't find

Summary: google/profiler.h don't find

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

Reviewed By: @ptarjan

Differential Revision: D1470627

Pulled By: svcscm
Add LibGMP extension

Summary: I've recreated the PHP gmp extension with HNI.  I believe it to be working well, but this is the first extension I've written so any and all criticism of my C-code is encouraged.

This extensions supports all GMP functions, and constants, with the exception of gmp_random.

I have submitted a CLA in the past; it might be under "ian@ my github username" (CA -> .ca); I had to submit it a few times last time around, so hopefully it's properly on record this time; if it's not, let me know.

Cheers

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

Reviewed By: @ptarjan

Differential Revision: D1470423

Pulled By: @sgolemon
Print current approx typechecking position on SIGUSR1

Summary: When some code being typechecked causes pathological behavior
in the typechecker, it can be useful to figure out approximately where
in the codebase we are checking. Right now, this involves a lot of
one-off logging being manually added, so let's do something a little
more clever. Every time we typecheck an expression, record its position,
and then on SIGUSR1, print that out. The envisoned use case is to attach
to a runaway proccess with gdb, look at the backtrace, and kill it with
SIGUSR1 to try and figure out WTF is going on.

We may ultimately want to expand this into something more general,
notably including things other than typing, but this is good enough for
now -- the 3-4 cases of runaway workers I've seen have all been in
typing.

This also kills `Typing.debug` since it was only used in one place, was
potentially confusing with the new data I'm adding, and was of dubious
utility (blocking `hh_show` in server mode).

Reviewed By: @elgenie

Differential Revision: D1467911