ifdef checks around headers and template fix

Summary: 1. using _ as a prefix in a template is bad since that's reserved for implementations, in this case though it's hitting a _U define in windows headers

2. execinfo.h is not on windows (even cygwin)

3. compatibility.h will need to be added to a few places that will need wrappers hidden inside

Reviewed By: @sgolemon

Differential Revision: D1420852
Revert "Revert "Fix casting a DateTime to an array""

Summary: An FB test was incorrectly passing before this change; the change made the test correctly fail. Test has been fixed in D1453222.

Reviewed By: @bertmaher

Differential Revision: D1453287
SplFileObject: Don't seek beyond the files size

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

Reviewed By: @ptarjan

Differential Revision: D1435369

Pulled By: @JoelMarcey
Corrected the implementation of ReflectionMethod::invokeArgs

Summary: This diff corrects the implementation of ReflectionMethod::invokeArgs to match that of php5's.

Closes #1721

Reviewed By: @fredemmott

Differential Revision: D1278570
Fix ubuntu (probably newer gcc) folly check

Summary: use cxx check compiles not c check compiles for folly weak symbols check
this is failing on some os/gcc combinations

Reviewed By: @JoelMarcey

Differential Revision: D1456030
Simplify LdObjClass t1:Obj=C to Cls(C).

Summary: In the title. Needed to change emitVerifyCls as it was asserting that
it would never get a const, which isn't true anymore.

Reviewed By: @ottoni

Differential Revision: D1452815
Remove trigger_error() from deprecated lz4 functions

Summary: Too much error spew in prod.

Reviewed By: @bertmaher

Differential Revision: D1456178
Don't select backward edges in WholeCFG mode

Summary: The back end will no longer weasel out of back edges by creating
unasked-for side exits.  This is good in the long term but right now it creates
a lot more hard cases for WholeCFG mode.  So, let's modify the region selector
to only pick acyclic regions.  We'll lift the restriction in the future.

The algorithm is your standard depth-first search cycle detection; we maintain
a stack of things being visited, and any edge to something currently on the
stack is by definition a back edge.  This is much easier to express as a
recursive algorithm than as a worklist algorithm, so I converted it to that
style.

Reviewed By: @ottoni

Differential Revision: D1446071
Optimize calls to get_class($obj) when we know the exact type of $obj.

Summary: Also optimizes get_class(), which is just a non-fataling self::class.

Reviewed By: @elgenie

Differential Revision: D1389240
AwaitAllWaitHandle

Summary: AwaitAllWaitHandle waits on a collection of WaitHandles and returns when they've all been completed. it is a WaitHandle<void> and the caller must obtain results from the children waithandles.

Reviewed By: @jano

Differential Revision: D1399487
Fix block mapping for IRUnit entry

Summary: It was picking which region block corresponds to the unit entry based
on offset.  Just use the first block in the region, which is the
entry.

Reviewed By: @bertmaher

Differential Revision: D1456181
typechecker: infer untyped 'async function' returns 'Awaitable'

Summary: ... because like 'private', 'async function' is a property of
 the language that programmers should not need to explicitly
 reenforce. With this inference, the 'awaitable not being awaited'
 heuristics become even more valuable.

 Going down the road of inferring return types would normally be
 considered a slippery slope of cross-file effects, mutually reentrant
 type recalculation passes, and associated badness. However, in this
 case 'async function' as a language feature is explicitly localized
 to the function declaration, and subject to very very simple
 unification.

Reviewed By: @jwatzman

Differential Revision: D1455175
Fix potential segfault in ICUs error handling

Summary: `vsnprintf` returns the size of the string regardless of the buffer size.

Fixes #3118

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

Reviewed By: ptarjan, joelm

Differential Revision: D1447245

Pulled By: svcscm
ReflectionProperty::setValue throws an ReflectionException if unaccessible

Summary: Also changed `gettype() != 'object'` to `!is_object()`

Fixes #3128

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

Reviewed By: @ptarjan

Differential Revision: D1449439

Pulled By: svcscm
Finish Unit and UnitEmitter cleanup

Summary: - Clean up includes for unit{,-emitter}.{h,cpp}.
- Document and clean up UnitEmitter.
- Organize unit{,-emitter}.cpp.

Reviewed By: @jdelong

Differential Revision: D1445825
Additional cmake tweaks for cygwin

Summary: Fixes issues where
embed.rc does not exist (mark it as generated)
debug mode overflows pe/coff section limitations
an issue with cygwin, folly, and the way gcc + windows headers interact (adding an "internal" define makes headers behave)
force zend compat to not to work/turn on for cygwin

Reviewed By: @ptarjan

Differential Revision: D1455421
Add log when memory usage reached the MaxRSS

Summary: Our online system use linux container, now and then it may be killed because of memory leaks.
This log could be useful at this scenario.

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

Reviewed By: @JoelMarcey

Differential Revision: D1455316

Pulled By: svcscm
Fix name in cmake file

Summary: it's files not file

Reviewed By: @JoelMarcey

Differential Revision: D1458050
Convert ext/mysql to HNI

Summary: Part of #1480

Also includes the commit in #2024
Closes #2027

Reviewed By: ptarjan, joelm

Differential Revision: D1410521

Pulled By: @fredemmott
Don't use -Og for debug build, and add -ggdb

Summary: -Og is great in theory but in practice it produces binaries that aren't very
debuggable. Go back to -O0. -ggdb produces more expressive debug information.

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

Reviewed By: @bertmaher

Differential Revision: D1457844

Pulled By: @ptarjan