Don't use Sweepable for APCLocalArray

Summary: Keep track of APCLocalArrays using a dedicated list in MemoryManager,
similar to how we track APC strings. This makes APCLocalArray not
use Sweepable, which devirtualizes it and reduces sizeof from 64 to 40.

Reviewed By: @jdelong

Differential Revision: D1669231

Signature: t1:1669231:1415548069:e617e85f2866d031f9dc313ccc69420d3d19f3ba
Add thread type and pagelets started functions

Summary: Caveat: I have close to no idea what I'm doing here. Don't
hesitate to tell me if everything is wrong, ugly, or will explode.

Add some very basic instrumentation around pagelet requests.
Currently we don't have any idea how many pagelets a request starts or
(AFAICT) a way to tell whether a request is a pagelet, besides looking
for PHP implementation details like parts of the request query string.

1) ##hphp_thread_type()## -- what kind of thread is this request running
in? Returns an int from ##enum class ThreadType## or -1 if we can't work
it out. There is an existing function (##getThreadTypeName()##,
https://fburl.com/65216334) but this returns strings with spaces, which
are a pain for dyno logs.

2) ##pagelet_server_tasks_started()## -- return the count of pagelets
started in this request. I didn't do this in PHP as there are already
two places in which we start pagelets (GraphBatchAsyncWorkItem and
PageletServerFuture) and two places in HHVM to start pagelets
(pagelet_server_task_start and fb_gen_pagelet). Instrumenting the server
is easier than making sure all the callsites in PHP track this.

I added both of these as functions and not access log parameters so we
can easily add them to xenon and other profilers.

Reviewed By: @bertmaher

Differential Revision: D1667021
Add pcntl_sigprocmask

Summary: fixes facebook/hhvm#4160

pthread_sigprocmask seems most correct given HHVM's model, however for both PHP-FastCGI and HHVM, the mask will leak cross-request

Reviewed By: @paulbiss

Differential Revision: D1667740

Signature: t1:1667740:1415399505:d7edad8e22ba9c8063800c98adf284ffe886f360
Use Func::destroy to clean up elements of the pseudomain cache

Summary: Funcs in the pseudomain cache are allocated by clone -- it seems like
they should be deallocated by destroy, rather than just deleted.  (ASAN
complains about the mismatch between malloc'ing the Func and deleting it.)

Reviewed By: @markw65

Differential Revision: D1668805

Signature: t1:1668805:1415417063:efd7495176f15d82660cd10037d5a0d54b52588c
Embed HNI in runtime_test

Summary: runtime_test currently only contains systemlib. We need to also include all the HNI extensions. This is blocking DateTime + collection HNI conversion.

Reviewed By: @sgolemon

Differential Revision: D1668323
get_defined_functions are all lowercase

Summary: Increases symfony from 98.68 to 98.82
Closes https://github.com/facebook/hhvm/pull/4192

Reviewed By: @JoelMarcey

Differential Revision: D1669234

Signature: t1:1669234:1415643321:87e1629b58ab39076cfd1d316bca152466b3dcf0
change is_object() to gettype() === 'object' in spl for incomplete_class

Summary: PHP accepts __php_incompatible_class in spl. But objects from that class fail is_object.

This puts symfony from 98.68 to 98.8 percent.

I don't like to do this...
Can we run perf on this? I don't know how bad it is.

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

Reviewed By: @JoelMarcey

Differential Revision: D1669230

Signature: t1:1669230:1415643326:4fdf2dd7aae73ae07abd66bb0efa2becb2d22e75
Bump package_version

Summary: Set to 3.5 on the master branch
Closes https://github.com/facebook/hhvm/pull/4178

Reviewed By: @JoelMarcey

Differential Revision: D1669146

Signature: t1:1669146:1415649436:23c7e004b34cc525b29d9897834de48bc43a0eb7
Fix build with OCaml 3.12

Summary: The build fails with ocaml 3.12 because we pass arguments to gcc in the -l <library> style, and ocaml 3.12 puts all the file arguments first and all the -something ones last, so it mangles the command line.

This fixes that issue by changing those to single-argument versions: -l<library>, -I<dir>, -L<library path>.

Github issue #4184

Reviewed By: @pathsny

Differential Revision: D1669106

Signature: t1:1669106:1415643437:1a452f8f8e584f5c63cdf08156bebad6f95fcedd
Fix readline request locals

Summary: readline was storing request local values in
global variables, leading to bizarre crashes when used
across multiple requests.

Reviewed By: @edwinsmith

Differential Revision: D1669798

Signature: t1:1669798:1415638941:c520bacb8b349a88f33a4bb0af2ae1abceeb7a10
Use a static string for the function name in zend_register_internal_class

Summary: The table out-lives the request, and request-local strings are not
safe to share.

Reviewed By: @markw65

Differential Revision: D1669627
format namespace use

Summary: The hack formatter currently only supports use statements of the form use namespace; This extends
it to support statements of the form use namespace as x;

Reviewed By: @jwatzman

Differential Revision: D1669866

Signature: t1:1669866:1415659133:563d3f046f41919df5444b156292b36475df674a
parse pass by reference and represent it in the AST

Summary: parameters that are passed by reference are marked as such.

Reviewed By: @jwatzman

Differential Revision: D1669930
adding support for assignment refs

Summary: Represents a reference of an expression in the ast and parses it.

Reviewed By: @jwatzman

Differential Revision: D1669949
Begin conversion for AT

Summary: This includes the easy rules. `ATcomposite` comes later.

Reviewed By: @ptarjan

Differential Revision: D1658636

Signature: t1:1658636:1415665510:30162e52baff059abb8e87c82e9a0c80836496b5
Delete unused type definitions.

Reviewed By: @jwatzman

Differential Revision: D1668494

Signature: t1:1668494:1415665198:2078557bc6e6e607fb61a99bf9cda242f3e93e46
add support for functions return by reference

Summary: Parses functions that return by reference, this is dropped during naming.

Reviewed By: @jwatzman

Differential Revision: D1669963
Drop FrameState's ref prediction if type grows to Gen.

Summary: Was hitting this with fixed-point. A value was Arr in one path, and
BoxedArr in the other, and we ended up with a state of
type=Gen,predict=BoxedArr. This later broke upon hitting a CheckLoc<Arr>
as we refined Gen -> Arr, but kept around the BoxedArr prediction.

Add the invariant to the field's comment and checkInvariants.

Reviewed By: @ottoni, @jdelong

Differential Revision: D1668687

Signature: t1:1668687:1415415982:3e94da4b41306ba74bbfc6c50a8f77331593f2e7
fix build issue

Summary: hack code fix

Reviewed By: @bhosmer

Differential Revision: D1671942

Signature: t1:1671942:1415673107:e96b5f045b0ae77ba7d7ff00865b3000df796dad
hh_format: understand async lambdas

Summary: With async lambdas, 'function' is not the only thing that can come after
 'async'. For formatting purposes, we parse a standard expression
 after async + space ... it just so happens that we'd expect a lambda
 to be there.

Reviewed By: @pikatchu

Differential Revision: D1671582

Signature: t1:1671582:1415668945:9d488abb437fe56184f56e8be16001a7f2066011