7985 Commits

Autor SHA1 Mensagem Data
Guilherme Ottoni 67e3047271 Fix rare race condition keeping track of prologue callers
profileSrcKey() compares the request number with
Eval.JitProfileRequests to decide whether or not the given SrcKey will
be generated in profiling mode.  As a result, using profileSrcKey() to
decide whether a given prologue was generated in profile mode or not
was innaccurate: a caller generated in an older request (<
JitProfileRequests) would expect the prologue to be a Proflogue (since
it was JITed beforehand), but the prologue could have been created by
a concurrent, newer request (> JitProfileRequests), which generated the
prologue in non-profiling mode.

This diff fixes the problem by directly checking if the prologue
address is in the profile code section to determine whether it's a
Proflogue or not.

Reviewed By: aravind

Differential Revision: D1141101
2014-01-28 09:17:43 -08:00
Bert Maher cdbc15f571 Remove an unused enum from TraceBuilder
It's unused

Reviewed By: @jdelong

Differential Revision: D1140914
2014-01-28 09:17:43 -08:00
bsimmers 41ec39a6ca Hide new assert behind a flag
DbgAssertRetAddr was useful when I was debugging a specific issue but
I think it's a bit excessive for general use. Don't emit it unless we ask for
extra asserts.

Reviewed By: @bertmaher

Differential Revision: D1140555
2014-01-28 09:17:42 -08:00
Jordan DeLong 1ce2c9cae3 Add simplifier case for BoxPtr
Reviewed By: @bertmaher

Differential Revision: D1136598
2014-01-28 09:17:42 -08:00
Jordan DeLong e4a04562a6 Remove partial non-working and not-enabled implementation of IncDecS
There's no case in ir-translator to get here, so this is dead
code.  It looks like it was maybe trying to use a LdMem as a guard, so
I'm not going to try to turn this on---we can implement it later.

Reviewed By: @bertmaher

Differential Revision: D1136590
2014-01-28 09:17:42 -08:00
Jordan DeLong 9fa3ca15f3 When using HNI return types in hhbbc type inference, include TInitNull
I didn't realize but of course they are generally
implied-nullable right now.  (I think we'll eventually want a way to
plumb the nullability through and require things like ?array if it can
be null.)  cc @Alite404Exception

Reviewed By: @dariorussi

Differential Revision: D1135647
2014-01-28 09:17:41 -08:00
Jordan DeLong dc8d03593b Fix a bug in constant propagation
I think this hasn't shown up yet because nothing has been
getting constprop'd with two inputs of different eval stack flavors.

Reviewed By: @dariorussi

Differential Revision: D1135575
2014-01-28 09:17:41 -08:00
Jordan DeLong 619e177992 Improve couldBeThisObj/mustBeThisObj for hhbbc minstr inference
A TODO was to look a the type of bases that aren't inside the
frame.  I did this, but then I realized neither of these changes can
kick in yet.  The couldBeThisObj needs support for unrelated object
types knowing they aren't related (#3343798), and the mustBeThisObj
will always say false if the base isn't in the FrameThis anyway,
because anything we know about a heap type must include InitNull at
least right now.

We might as well put this in as a test case for #3343798 though.  (And
I clarified some comments about how refs work, and fixed something
wrong with BaseR wrt this.)

Reviewed By: @dariorussi

Differential Revision: D1135320
2014-01-28 09:17:40 -08:00
Jordan DeLong abc1e26ee5 Make the JIT actually take advantage of hhbbc private property inference
The JIT wasn't really able to use the private property
information from HHBBC, because by the time we saw an AssertT opcode
the property was already extracted.

This diff changes the hphpcType in each class' property info to a new
RepoAuthType struct which can contain both the kind of information
hhbbc can provide as well as what hphpc can provide.  Sets the JIT up
to use it, and update prediction-opts to handle the hhbbc case (which
will now generate things like LdMem<Obj<Foo>|InitNull> instead of
LdMem<Cell>.)

A later diff will use the same RepoAuthType flag (plus the repo global
data) to fix the issue with unserialize() being able to break inferred
private property types.

Reviewed By: @ottoni

Differential Revision: D1135298
2014-01-28 09:17:40 -08:00
Jordan DeLong 8920673580 Enable private property inference
After D1132987 it seems to work.

Reviewed By: @dariorussi

Differential Revision: D1133202
2014-01-28 09:17:39 -08:00
Bert Maher 802dab3974 Move runtime helper from translator-x64 to translator-runtime
Some random cleanup I came across.

Reviewed By: @swtaarrs

Differential Revision: D1140317
2014-01-28 09:17:39 -08:00
Brandon Wamboldt b1090c3e04 Fix cURL tests by implementing server script
Many cURL extension tests require an HTTP server to be running
with a specific PHP file available.

Travis will now run this script using the built-in HHVM web server.

I've add skip files so if the user doesn't have the required environment
variable set it will skip the tests, just like PHP does.

Closes #1487

Reviewed By: @ptarjan

Differential Revision: D1117179

Pulled By: @scannell
2014-01-28 09:17:39 -08:00
Sean Cannella b54dff5b10 Add charset= support to PDO mysql DSN
Adds support for charset= in the PDO mysql DSN.

Closes #1309
Closes #1489

Reviewed By: @ptarjan

Differential Revision: D1137883
2014-01-28 09:17:38 -08:00
Ainsley Escorce-Jones 9d28061e71 json_decode() parity with PHP 5.4
Added depth as the optional third parameter, there is now no
fixed maximum depth for the JSON parser, default depth is still 512, if
a user specifies a larger depth limit then the various stacks are
resized.

JSON_BIGINT_AS_STRING is now supported alongside the FB collection
options.

Closes #1470
Closes #1496

Reviewed By: @ptarjan

Differential Revision: D1117099

Pulled By: @scannell
2014-01-28 09:17:38 -08:00
Sean Cannella 621b302b23 Revert "Implement ::class"
Reviewed By: ptarjan

This reverts commit 73975187358058e071bbfca5094bb0fc6e23ef86.
2014-01-28 09:17:37 -08:00
Paul Tarjan a94f25001c Implement ::class
Done mostly in the parser. There was one weird thing, traits have `self::CLASS` refer to themselves instead of the class that uses them. I had to do runtime support for `parent::CLASS` and `static::CLASS`.

Closes #1096

Reviewed By: @elgenie

Differential Revision: D1129169
2014-01-28 09:17:37 -08:00
Paul Tarjan eb2312a5de keep around rawPostData just incase someone reads from php://input
What do you think about this? Usually we keep it around anyways in a global variable (`$HTTP_RAW_POST_DATA`) but that is possible to turn off, so we need a fool-proof place to put it to support `php://input`. Before this diff, the code only gave the last packet of the header in libevent and asserted on fastcgi.

Thoughts? I think it is worth supporting as the php docs says

http://www.php.net/manual/en/ini.core.php#ini.always-populate-raw-post-data
... the preferred method for accessing the raw POST data is php://input.

Closes #1557

Reviewed By: afrind

Differential Revision: D1129130
2014-01-28 09:17:36 -08:00
Dario Russi 82906a26f5 remove runtime options for APC stats
Now that we removed the options from the config files we can remove the options in the code as well

Reviewed By: @jdelong

Differential Revision: D1135707
2014-01-28 08:05:54 -08:00
Eugene Letuchy 35971e45fa collections: support in_array() and array_search() builtins
... and remove utility functions rendered irrelevant

Reviewed By: @paroski

Differential Revision: D1137616
2014-01-28 08:05:53 -08:00
Alex Malyshev 39bc81c7b0 Don't use boost::to_upper
perf is showing that it's calling dynamic_cast, a lot.

Reviewed By: @jdelong

Differential Revision: D1136788
2014-01-28 08:05:53 -08:00
Emil Hesslow e77fc64dc7 Break out stuff to mysql_common so I can reuse it for mysqli
- This mostly just moves stuff around. The idea was to put everything that is f_mysql_ in ext_mysql and move everything else into mysql_common
- It also breaks up the query function into two parts because I need it for mysqli
  - Doing the query
  - And getting the result part

Reviewed By: @ptarjan

Differential Revision: D1106027
2014-01-28 08:05:53 -08:00
Fred Emmott c6c2fa766e Add assert to check for Array return types in IDL
'Array' ends up being KindOfObject, and leads to mysterious segfaults.

Reviewed By: @ptarjan

Differential Revision: D1136568
2014-01-28 08:05:52 -08:00
Owen Yamauchi 75e8e34ba7 Implement codegen for StLoc, Box, and CheckStk in ARM
There's one test case that's giving me fits in trying to implement Call,
and if we were just codegen'ing these opcodes, the problem would just go
away. So here they are.

StLoc happens to be third most frequent punt. CheckStk forced me to get
the jump-chaining machinery working, and it's surprisingly simple.

Reviewed By: @ottoni

Differential Revision: D1136517
2014-01-28 08:05:52 -08:00
aravind 4fda422743 Update NEWS for "Coolio"
Per title.

Reviewed By: @ptarjan

Differential Revision: D1136689
2014-01-28 08:05:51 -08:00
Arnaud GRANAL e03fc4652e pfsockopen returns incorrect connections
Persistent connections currently return a cached connection for (key = "hostname").
Expected behavior is to return a cached connection for (key = "hostname + port").
As a result, persistent connections write and read from the wrong socket if you have multiple connections to the same hostname but different port.

Redis hhvm implementation is affected by this bug (probably other modules too, but not MySQL at least, who uses its own socket cache handler).

Closes #1599

Reviewed By: ps

Differential Revision: D1135971

Pulled By: @scannell
2014-01-28 08:05:51 -08:00
Edwin Smith c5aa39b100 Convert Interval::children to intrusive singly linked list.
std::list is inconvenient for three reasons:
1. when splitting, we have to iterate to find the split position
even though we already have the interval we care about.
2. Loops that visit each split interval must do work for the
parent, then a separate loop for the child.
3. we never need the "prev" pointers

A plain 'next' pointer (aka intrusive singly-linked list) solves
all three problems.

Reviewed By: @bertmaher

Differential Revision: D1135956
2014-01-28 08:05:51 -08:00
Eugene Letuchy 4cc71b677f collections: support min() and max() builtins
Specifically, their one-argument form.

Reviewed By: @paroski

Differential Revision: D1137651
2014-01-28 08:05:50 -08:00
Eugene Letuchy c754019212 collections: support array_fill_keys ...
... and eliminate some single-use array util functions (of
 questionable utility)

Reviewed By: @paroski

Differential Revision: D1137568
2014-01-28 08:05:50 -08:00
Simon Welsh 6c214555e9 Convert ext/apache to HNI
Convert ext/apache to HNI

Closes #1607

Reviewed By: @ptarjan

Differential Revision: D1135889

Pulled By: @scannell
2014-01-28 08:05:45 -08:00
Simon Welsh 6076b94d6d Convert ext/ctype to HNI
Convert ext/ctype to HNI

Closes #1612

Reviewed By: @ptarjan

Differential Revision: D1135975

Pulled By: @scannell
2014-01-28 08:05:01 -08:00
Owen Yamauchi 40100fff5c Normalize ARM's link-register-saving convention
In trying to implement codegen for the Call opcode, I'm running into
problems with the differences between ARM and x64's calling conventions,
specifically with regard to how they save return addresses.

Until now, our ARM code hasn't been treating the link register (the
return address register) like it's supposed to be treated. The register
is technically caller-saved, but normal ARM programs (such as C programs
compiled by gcc) don't save and restore it around callsites. Instead,
non-leaf functions just save it at the very beginning and restore it
just before returning, simply as part of setting up and tearing down the
frame.

What this means for us is that we're now saving it on the stack
immediately on entry to the TC, since, viewed through the traditional
calling-convention lens, the entire TC is a non-leaf function. This
means that we no longer need to save/restore around host calls.

Reviewed By: @edwinsmith

Differential Revision: D1133438
2014-01-28 07:49:27 -08:00
seanc 1e23dec9f0 Split Travis slow/zend test runs further
Summary: This splits the larger Travis test runs roughly evenly to
increase the chance that the tests will pass before hitting the timeout.

Reviewed By: ptarjan
2014-01-22 13:53:44 -08:00
Drew Paroski c1d4b02110 Fix BaseMap::eraseNoCompact to decref string keys
Reviewed By: @elgenie

Differential Revision: D1137646
2014-01-22 12:47:54 -08:00
Bert Maher 9241f43016 Eliminate unused stubBlock() template function
It's unused.

Reviewed By: @swtaarrs

Differential Revision: D1136316
2014-01-22 12:47:54 -08:00
Dario Russi ed23d1a406 Normalize string wrt namespace when used in function or class context
Bytecodes that resolve strings to a class or a function need to normalize the string so it never starts with '\'

Reviewed By: @jdelong

Differential Revision: D1135085
2014-01-22 12:47:54 -08:00
Bert Maher f041b97bff Remove MethodLookup namespace
Namespace isn't needed now that we're using enum classes.

Reviewed By: @jdelong

Differential Revision: D1135968
2014-01-22 12:47:54 -08:00
Jordan DeLong 3009a5a45d Resize the static string table after argument parsing if the size was wrong
Also, change the default size to match cli.hdf, so we don't
do a resize on command line scripts.

Reviewed By: @edwinsmith

Differential Revision: D1126293
2014-01-22 12:47:54 -08:00
Jordan DeLong 2440764f5e Remove MetaInfo::Kind::NonRefCounted
This has been disabled since shortly after it was added,
since hphpc doesn't handle exception edges correctly and reports wrong
information.

Reviewed By: @swtaarrs

Differential Revision: D1135310
2014-01-22 12:47:53 -08:00
Jordan DeLong 13364a8234 Remove AssertStkVal/OverrideLocVal and HHBCTranslator::assertString
Dead after D1133071.  bsimmers said he never really liked
them anyway.

Reviewed By: @swtaarrs

Differential Revision: D1135305
2014-01-22 12:47:53 -08:00
Jordan DeLong 4d9f5d33ef Remove MetaInfo::Kind::String; seems to not kick in anymore
Quite a while back I perflabbed turning this off and saw red,
but I think it must've been noise.  I ran perflabs with an
always_assert(0) in applyInputMetaData here and it never triggered.

Reviewed By: @edwinsmith

Differential Revision: D1133071
2014-01-22 12:47:53 -08:00
Jordan DeLong 994c02283b Use raise_typehint_error for ?Foo hints
So we can use them in static analysis.  Requires a www change
for the error handler.

Reviewed By: @elgenie

Differential Revision: D1125242
2014-01-22 12:47:53 -08:00
Nicholas Ormrod 15de092f49 Removed duplicate #includes
Removed duplicate #includes.

Reviewed By: robbert

Differential Revision: D1136491
2014-01-22 12:47:53 -08:00
Surupa Biswas 80a9ae11b2 Warnings for incorrect params passed to ReflectionProperty get/setValue
Added warnings to match Zend behavior for incorrect number of arguments passed
and for not passing an object as the first parameter when reflecting on instance properties.

Reviewed By: @ptarjan

Differential Revision: D1135118
2014-01-22 12:47:53 -08:00
Jordan DeLong 446a61b422 Fix 86pinit bug in hhbbc relating to collection initializers
I thought 86pinit could only set private properties to
uncounted types, but there's also collection literals.  Merge in
TInitCell---in these classes all private properties initialized by
86pinit will end up as TCell for now, since they start as uninit in
the scalar initializer.  (Things with non-scalar initializers also
will be TInitCell.)  We'll make it do better later.

Reviewed By: @dariorussi

Differential Revision: D1135293
2014-01-22 12:47:52 -08:00
Jordan DeLong 329527e19f Change indentation in lookup_constraint, add task# for a TODO
Reviewed By: @dariorussi

Differential Revision: D1134307
2014-01-22 12:47:52 -08:00
Jordan DeLong d45bc155e5 Add some logging to the assertions about unique classes actually being unique
I've hit this once or twice, and I think it probably is a
race in hphpc or something (it is not consistent).  Just add some
logging to try to help debug next time.  (So far it's always
Ix-related closure classes that have AttrUnique but actually aren't in
the cores I've had.)

Reviewed By: @swtaarrs

Differential Revision: D1135290
2014-01-22 12:47:52 -08:00
Fred Emmott 2762e7b5a0 Support ReflectionClass::getConstructor() for old-style superclass constructors
Reviewed By: @ptarjan

Differential Revision: D1132467
2014-01-22 12:47:52 -08:00
Sean Cannella 700026adc7 Merge pull request #1614 from skyfms/master
Allow disabling hardware counters from cmake
2014-01-22 07:47:32 -08:00
Edwin Smith 55212b92e9 Rename Interval::info -> loc in xls.cpp
Leftover from the RegisterInfo->PhysLoc rename.

Reviewed By: @bertmaher

Differential Revision: D1135841
2014-01-22 05:30:57 -08:00
bsimmers e31c664c02 Disable flaky zend test
Reviewed By: @bertmaher

Differential Revision: D1135985
2014-01-22 05:30:51 -08:00