Fix flakey test/slow/ext_stream/stream_get_meta_data.php test

Port 50000 might be in use.  Try a few.

Reviewed By: @JoelMarcey

Differential Revision: D1235872
Support ArgDesc::Kind::Addr in cgCallHelper for Stack args

Now that FCallBuiltin can exceed 5 args, we can
potentially have any kind of arg pushing onto the stack.

test/slow/ext_openssl/ext_openssl.php and some others were
consistently hitting the ArgDesc::Kind::Addr for a 6th and
later arg under packedtv.

ARM's shuffleArgs() doesn't actually support stack args
atm, so we'll have to make it fall back to only
supporting the old 5 args.

Reviewed By: @edwinsmith

Differential Revision: D1235609
support for Stringish

Typechecker counterpart to {D1214064}: Stringish is
 implemented implicitly by any object with a __toString, and also has
 "string"s as a subtype

Reviewed By: @jwatzman

Differential Revision: D1215427
Silence warning when tryport hits a port in use

D1235872 was only half the fix.

Reviewed By: @JoelMarcey

Differential Revision: D1235956
Remove m_strongIterators from ArrayData; use a table on the side in TLS

This is very rare, so we do better putting it on the side.

The logic for the thread local table is a little bit unusual, because
I wanted to keep it as easy as a single compare to determine if an
array might need to update or free strong iterators.  Also one thing
about this scheme that seemed a little unfortunate at first is that it
slows down all array mutations on arrays of kinds supporting strong
iteration if any arrays in the program are being strong iterated.

I tried to fix both of those things of those by using a bit in the
array header that gets set if an array is ever strong iterated.  But
that increased dcache and dTLB misses compared to this version---a
hybrid (that checks TLS first and then checks the array header next)
might do better, but I think now the better route to that might just
be to eventually have more of the array kinds imply an array has never
been strong iterated, so fewer arrays will eventually be affected by
strong_iterators_exist() returning true.

Reviewed By: @edwinsmith

Differential Revision: D1225581
Consult Unit for get_defined_functions()

HNI functions don't show up in ClassInfo
so just make Unit the source of truth.

This is resurrecting a diff I tried before.

Reviewed By: @ptarjan

Differential Revision: D1232599
Port standard/variable to HNI

Introduce standard extension with children,
like `variable`, as sub-extensions off of it.
(Similar to how intl is organized into sub-extensions)

Leave var_dump() in the IDL for now as moving it breaks
a lot of tests and I'd like to address its issues independently.

Reviewed By: @ptarjan

Differential Revision: D1220973
Completely break Simplifier's dependency on IRBuilder

This makes Simplifier a standalone module, so it's now in shape to be
unit-tested sanely. The last thing to deal with was the calls to
IRBuilder::typeMightRelax, which I've replaced with a std::function.
The constructor now takes only IRUnit.

About the std::function: if I'm reading the implementation correctly (no
guarantees; reading libstdc++ source is no fun) then for sufficiently
small callable objects, no heap allocation happens. (This is certainly
the case in libc++). The sizeof the lambda I pass is 8, so if libstdc++
implements that optimization, it will definitely kick in. I considered
making std::function use smart::Allocator, but it turns out libstdc++
has not implemented that feature yet.

Reviewed By: @ottoni

Differential Revision: D1231776
Unit test for AbsDbl and jump fusion

Well, this is what it looks like. I did a few basic tests of jump
fusion because I've been going after that for ages and ages.

I had to create a new test-only opcode, which I called Conjure. It's
basically non-const DefConst; its purpose is to produce a value
of a given type that no optimization can see through.

Everyone I've talked to about my plans for unit testing the JIT has
mentioned needing some sort of assembler for HHIR, but I've always been
a little confused as to why that's needed. As this diff demonstrates,
it's entirely possible to create IR "in the laboratory" without anything
like an assembler. Is the way it's done here really that bad? Admittedly
the way I verify the output is a little clunky, but I don't immediately
see how having an IR assembler would make it significantly better.

Reviewed By: @bertmaher

Differential Revision: D1234437
Implement curl_reset

Fixes facebook/hhvm#2125
refs guzzle/guzzle#538

Reviewed By: @ptarjan

Differential Revision: D1234801
Fix HHBC assembler's FPIEnt::m_fpushOff generation

It was calculating the offsets using the current stack and the sizes of
previously pushed ActRecs. Turns out FuncEmitter::finish() already does
this.

Reviewed By: @jdelong

Differential Revision: D1236617
Fix Autocomplete of ID

D1195838 broke this. (My fault, I need to make a test harness and write some tests for this stuff)

The problem is when you're starting to type a global, it doesn't necessarily hit the dispatch_call part.

(There's no brackets typed yet)

This moves that code out of fun_type_of_id and adds it in both those call sites and one more.

Reviewed By: @jwatzman

Differential Revision: D1230498
Immutability fixes for immutable collections

HHVM was allowing immutable collections to be modified in some cases. This
diff fixes these bugs and adds tests.

Reviewed By: @elgenie

Differential Revision: D1213158
Fix typehint stuff for primitive types

This diff fixes issues with how typehints work for primitive types like int
and string. The fix works by reserving the names "HH\int", "HH\string", etc.
and to use the HH namespace auto-import mechanism so that users can simply
type "int" and "string" inside "<?hh" files (similar to what we do for the
collection classes). This also allows "<?php" files to use classes in the
global namespace whose names conflict with primitive types (ex. a class
named "string"), which is a compatibility win.

Reviewed By: @elgenie

Differential Revision: D1229462
Remove AttrVMEntry and maybe reduce some brach misses

Remove the logic introduced by D1054750. Async functions are now directly resumed by asio scheduler and this flow no longer goes thru Continuation's next()/send()/raise() methods. The remaining calls to these methods never reenter VM, so the extra runtime check introduced by D1054750 always fails.

Seems to reduce branch misses a bit by freeing CPU prediction resources related to this unnecessary branch.

Reviewed By: @ottoni

Differential Revision: D1229734
Unwind exceptions in eagerly executed async functions

Converge eager and resumed parts of async function bodies. Eliminate
try/catch in the eager part and move the logic that converts exceptions
to StaticExceptionWaitHandles to the unwinder.

Reviewed By: @jdelong

Differential Revision: D1229463
Increase widening limit for functions

A large function in www is iterating enough times that
invokes some widening operations, but it isn't actually in an
infinitely-growing type situation.  Just bump the limit for now.
(Eventually we want to make widening smarter, but let's not bother
until it matters.)

Reviewed By: @dariorussi

Differential Revision: D1234736
Config files: lean towards parsing something as an hdf instead of an ini

FB compatibility. Temporary, as we want to completely kill hdf files

Reviewed By: @jdelong

Differential Revision: D1234052
change Eval.JitEnableRenameFunc to mean: EnableRenameFunc

... and stop the quick tests from always passing it. The
 initialization of this option meant that the interpreter was
 inferring MayUseVV for *every single function*.

 The tests break down as follows:

 Uses fb_set_profile:
   - hphp/test/quick/Setprofile.php
   - hphp/test/quick/Setprofile_async.php
   - hphp/test/quick/Setprofile_generic.php
   - hphp/test/quick/setprofile-this.php
   - hphp/test/quick/surprise_throw.php

 Uses fb_rename_function:
   - hphp/test/quick/rename_dyn_function.php
   - hphp/test/quick/rename_dynamic.php
   - hphp/test/quick/rename_function.php
   - hphp/test/quick/cuf06.php
   - hphp/test/quick/cuf07.php

 Uses backtrace with args (impacted by VV):
   - hphp/test/quick/debug_backtrace.php

 Unclear, but results seem to change semantically (!):
   - hphp/test/quick/cuf.php

Reviewed By: @jdelong

Differential Revision: D1235985
Move ext_options to HNI and fold into the standard extension

As it says

Reviewed By: @ptarjan

Differential Revision: D1234642