7985 Commits

Autor SHA1 Mensagem Data
Herman Venter 40f82f5b6f Extract query parameter expressions from queries
Query expressions may contain sub expressions that can only be evaluated in the context of the query expression. These expressions effectively parameterize the query sent to the query engine (which typically runs out of process). Since query provider (which is distinct from the query engine) also runs in a separate context (albeit in the same thread) cannot evaluate these expressions in the right context, these expressions are replaced with references to compiler generated parameter variables in the expression tree sent to the query provider. When a query is evaluated, the values of the elided expressions are provided to the query method as additional arguments (the first argument being the expression tree). Note that the first elided expression is the receiver object for the query method call.

The extraction algorithm is a top down left to right traversal of the query AST that elides any expression which is not of a form that query processors are expected to be able to handle. The permitted forms are simple variables (that are bound to identifiers introduced by the query expression), constants, some unary operations, some binary operations, simple function calls and property accesses. If a sub expression of a permitted form is not itself permissible, it is replaced with a query parameter reference.

Reviewed By: @paroski

Differential Revision: D1124818
2014-01-17 01:40:53 -08:00
Paul Tarjan 0512e912e1 Don't use the Log.File in CLI
Right now we print both to stderr and the log file. Instead I think we should just ignore the option altogether in CLI mode. If we want to support that option we should support the INI setting http://www.php.net/manual/en/errorfunc.configuration.php#ini.error-log . The hdf option feels more like the apache log location than the php one.

Reviewed By: @jdelong

Differential Revision: D1085173
2014-01-17 01:40:53 -08:00
Joel Marcey 52de3ca164 Add Joomla CMS to the framework test runner
We have the Joomla framework, now let's add the CMS as well.

Reviewed By: @ptarjan

Differential Revision: D1128952
2014-01-17 01:40:52 -08:00
Emil Hesslow 470379e631 Fix for handling double backslashes
- The parser wasn't able to parse "as\\"

Reviewed By: @ptarjan

Differential Revision: D1128312
2014-01-17 01:40:52 -08:00
Emil Hesslow 7ee169a7eb New try to get in the ini parser stuff
- This rerevert D1116195 and D1116199
- It also fixes a problem when ini files contains junk. So instead of outputing junk on stdout it now fails parsing those files
- I also went re-run a bunch of tests that now passes.

Reviewed By: @ptarjan

Differential Revision: D1127923
2014-01-17 01:40:52 -08:00
Emil Hesslow 36eac72b6e Re-import ext/standard/tests/general_functions
tools/import_zend_test.py -z ~/php-src-PHP-5.5/ -o ext/standard/tests/general_functions

Reviewed By: @ptarjan

Differential Revision: D1127780
2014-01-17 01:40:52 -08:00
Kristaps Kaupe f2e996ade1 clang fixes
Fix a few clang warnings / errors.

Closes #1570

Reviewed By: @alexmalyshev

Differential Revision: D1128347

Pulled By: @scannell
2014-01-17 01:40:52 -08:00
Eugene Letuchy 53ffeac06d autoload: don't swallow fatals when autoloading
For a nonexistent class for which the autoloader map knows a file is
 present known, the autoload should behave the same way as if a
 require_once were made to that file and propagate any fatals that
 result. If on the other hand, the file for the class was unknown or
 the class was not successfully loaded (but there was no fatal), we
 continue to call the userspace-supplied faiure callback function.

Reviewed By: @ptarjan

Differential Revision: D1122740
2014-01-17 01:40:52 -08:00
Eugene Letuchy 4aeb3e599e collections: template vector::filter|map ...
... to allow versions with callbacks that take values only vs
 keys-and-values to reuse code.

Reviewed By: @jdelong

Differential Revision: D1127092
2014-01-17 01:40:52 -08:00
Eugene Letuchy 2097d7947d collections: share code between Map::->foo and ->fooWithKey
Hella templates for higher order collection functions:
 - map (+withKey)
 - filter (+withKey)
 - retain (+withKey)

Reviewed By: @jdelong

Differential Revision: D1126448
2014-01-17 01:40:51 -08:00
Eugene Letuchy 252f67b99b collections: add retain() and retainWithKey() to {Map|StableMap}
... the in-place mutating cousin of filter, retain takes a
 predicate callback for each entry in the map and uses the return
 value to determine whether to keep the element around.

 Deferring ##Vector## and ##Set## (easy).

Reviewed By: @jdelong

Differential Revision: D1121508
2014-01-17 01:40:51 -08:00
Fred Emmott 39a5e928aa Implement ReflectionParam::__toString
Used by Mockery to get type hint values. I'm submitting a diff to Mockery to make it use getTypehintText if available, but this should be implemented anyway.

Added two tests - one for confirming we're Zend-compatible (with .expect generated by Zend), the other for checking that non-null defaults work for basic-type typehints (which aren't supported by Zend)

Reviewed By: @ptarjan

Differential Revision: D1127714
2014-01-17 01:40:51 -08:00
javer 2091a8114d Fix memory leak in PDO::fetchAll()
Fix memory leak when fetching data using PDO::fetchAll().

Closes #1569

Reviewed By: @JoelMarcey

Differential Revision: D1128106

Pulled By: @scannell
2014-01-17 01:40:51 -08:00
Jordan DeLong 1c3aa1bf3d Abort when Repo::Repo fails instead of calling exit()
This can fail if we're out of file descriptors.  Calling exit
while other threads are still running leads to bad crashes in random
places, depending on the order that global destructors get run.
Instead let's always_assert with a message.

Reviewed By: @scannell

Differential Revision: D1125004
2014-01-17 01:40:51 -08:00
Antony Puckey ea14973c5e add getRemoteAddr to transport which defaults to empty string.
add getRemoteAddr to fastcgi transport to return the proper header. if no remoteAddr set it to the remoteHost ( libevent ) only set REMOTE_HOST if there is something in it as per php-src

Closes #1559

Reviewed By: @scannell

Differential Revision: D1126545

Pulled By: @ptarjan
2014-01-17 01:40:51 -08:00
Alex Malyshev b44e9c1889 Remove 'static' from function declared in a separate header
collectionDeepCopyBaseMap declared in ext_collections.h, but defined in
ext_collections.cpp. No idea why gcc doesn't catch it.

Reviewed By: @elgenie

Differential Revision: D1127006
2014-01-17 01:40:50 -08:00
bsimmers 60821e0166 Refactor TranslatorX64's CodeBlocks into a CodeCache module
I did this in preparation for something which ended up not working
out, but this could be worth keeping.

Reviewed By: @oyamauchi

Differential Revision: D1125965
2014-01-17 01:40:50 -08:00
Emil Hesslow 91c03c40a4 A bunch of different CSV fixes
- Do a bunch of small changes to make HHVM error when Zend does

Reviewed By: @ptarjan

Differential Revision: D970379
2014-01-17 01:40:50 -08:00
Sara Golemon 220a453220 Change docskel.php to use a local phpdoc checkout rather than svn.php.net
Runs MUCH faster this way.

Reviewed By: @ptarjan

Differential Revision: D1126413
2014-01-17 01:40:50 -08:00
Paul Tarjan 33dfe04716 time before sudo 2014-01-16 17:50:07 -08:00
Paul Tarjan b60492db9c See how long each step takes 2014-01-16 17:32:27 -08:00
ptarjan 5caac83428 remove folly files that were removed 2014-01-16 15:50:13 -08:00
ptarjan 08edc30657 update folly so there isn't two IOBuf.cpp files 2014-01-16 15:38:22 -08:00
mwilliams 7eb3262d3d Dont ignore errors from FT_Get_Glyph
"image" is left uninitialized if we do.

Reviewed By: @scannell

Differential Revision: D1126277
2014-01-14 11:42:01 -08:00
Joel Marcey 42795f08a5 Use Yaml for framework test runner configuration. Add github url to it too.
Yaml just seems cleaner and overall better for this type of configuration.

Decided to use a PHP YAML parser to avoid having to turn on EnableZendCompat explictly at the command line, particularly in open source.

So chose: https://github.com/mustangostang/spyc

Reviewed By: @ptarjan

Differential Revision: D1127123
2014-01-14 11:42:00 -08:00
Simon Welsh aa173f6ce8 Change ext/reflection from IDL to HNI
Change ext/reflection from IDL to HNI.

Also adds HNI support for HipHopSpecific through the
__HipHopSpecific user attribute. Code that wants to check for this
should use Func::getFuncInfo(mi) instead of Func::methInfo() (I only saw
Reflection using it).

Closes #1484

Reviewed By: @JoelMarcey

Differential Revision: D1124639

Pulled By: @scannell
2014-01-14 11:41:54 -08:00
Sean Cannella 9a35c755d3 Fix missing include in OSX
One more missing include on OSX in util/

Reviewed By: @alexmalyshev

Differential Revision: D1126910
2014-01-14 11:41:35 -08:00
Drew Paroski 7ded25076f Rename Set::difference() to Set::removeAll()
The difference method is confusingly named; its name does not imply that it
modifies the original Set. This diff renames "difference" to "removeAll" to
make it clearer. Eventually the difference() method will be removed after
all callers have been updated.

Reviewed By: @elgenie

Differential Revision: D1120227
2014-01-14 11:41:34 -08:00
Simon Welsh a464ad28e8 Convert ext/bzip2 to HNI
Adds error handling to the bzerr*() functions, allowing one of
the current bad tests to pass.

Closes #1547

Reviewed By: @sgolemon

Differential Revision: D1125459

Pulled By: @scannell
2014-01-14 11:41:27 -08:00
Antony Puckey f1fdcdd8ab Set HTTPS header appropriately in fastcgi
Check passed header values for HTTPS.

IIS sets this header to "off" so check for that and empty value before
using transport->setSSL().

Only change to lower case if the value is not empty for performance.

Closes #1546

Reviewed By: @ptarjan

Differential Revision: D1125440

Pulled By: @scannell
2014-01-13 15:58:06 -08:00
Simon Welsh 1914e07d21 Convert ext/phar to HNI
Closes #1548

Reviewed By: @sgolemon

Differential Revision: D1125469

Pulled By: @scannell
2014-01-13 15:57:58 -08:00
Edwin Smith 35a0406935 Rename hphp-value.cpp/h to typed-value
Since it defines class TypedValue

Reviewed By: @bertmaher

Differential Revision: D1125416
2014-01-13 15:20:10 -08:00
Paul Tarjan 9762e8fb56 fix fastcgi segfaults a better way
I think this is what julk originally wanted. He has a `m_keepConn` boolean that is set by `ConnectionFlags::KEEP_CONN` and if that is false, he calls this callback in both the error and the success case.

This doesn't segfault when the connection is abruptly closed by the requestor.

Closes #1522

Reviewed By: @scannell

Differential Revision: D1124995
2014-01-13 15:20:06 -08:00
Bert Maher 3b6d74078f Add FP, SP to hhirTracelet tracing
Adding this was pretty helpful for tracking down a stack
corruption bug.

Reviewed By: @swtaarrs

Differential Revision: D1125781
2014-01-13 15:20:03 -08:00
Jordan DeLong 73d02b43e9 Clean up a few TODOs relating to analyzing builtins in hhbbc
Some cases in class resolution that were happening for
builtins now won't (I checked).  They are mostly just "in principle"
possible now, and shouldn't really happen as far as I know aside from
one case: if you put "implements Foo" and Foo is actually a class.  I
can't get hphpc to mark AttrUnique on anything that would fail in
those places other than that.

Reviewed By: @edwinsmith

Differential Revision: D1125093
2014-01-13 15:19:56 -08:00
Jordan DeLong 2906fe6c98 Missing things in HHBBC representation: HNI types and isAsync
Now that HHBBC compiles systemlib, it needs to support
passing HNI-native function return types.  Also I apparently missed
isAsync only on the parse side (a newish test caught it).

I made native info a struct even though it only has one thing so
far---I think later we'll want the function pointer and a flag about
whether we can invoke it with constant arguments during compilation
time.

Reviewed By: @edwinsmith

Differential Revision: D1125080
2014-01-13 15:19:52 -08:00
Jordan DeLong d0a7b63495 Fix hhbbc issues with magic builtin interfaces (KeyedTraversable, etc)
After turning on hhbbc on systemlib, these interface names
are statically resolved, so it was assuming things like $x instanceof
Traversable is only true if $x is an object, and that an array
couldn't pass one of those parameter type hints.

Reviewed By: @dariorussi

Differential Revision: D1125061
2014-01-13 15:19:49 -08:00
Jordan DeLong d145f254e6 Use tbb::concurrent_hash_map for the Index dependency map
It was previously just a std::mutex around a
std::unordered_map, which seems to be a big source of contention after
putting systemlib is in the mix.

Reviewed By: @edwinsmith

Differential Revision: D1125048
2014-01-13 15:19:45 -08:00
Jordan DeLong a8111978fa Add support for "bumping" trace levels, use it to not trace systemlib in hhbbc
Use this so systemlib units will only be traced if the level
is higher than normal.

Reviewed By: @edwinsmith

Differential Revision: D1125039
2014-01-13 15:19:42 -08:00
Jordan DeLong cabe7cc3a7 Let systemlib units go through hhbbc
After the change to include systemlib in hphpc's static
analysis, I temporarily cut them out of whole_program in HHBBC.  The
problem was just that systemlib needs to end up merge only, but none
of hhbbc's output units are merge only.  Solve this with a special
case in emit.cpp for now.

This seems to make a ~2x slow down in how long the first analyze pass
takes hhbbc.  I think the reason is that now *tons* of things are
registering dependencies to common builtins that didn't use to
(e.g. idx)---it seems to be spending a lot of time on the single lock
there now.  (Will probably change it to tbb ...)

Reviewed By: @dariorussi

Differential Revision: D1125024
2014-01-13 15:19:39 -08:00
Jordan DeLong fd00ef394e Remove includes of util.h from .cpp files in hphp/util
Replace some uses with folly functions or boost.  I kept
string_vsnprintf in its own header for now.  We could probably move it
to folly/String.h (folly has stringPrintf and such, just no vararg
version), but on the other hand using va_list is not very encouraged
so maybe we should just leave it here for these legacy uses.

Reviewed By: @ptarjan

Differential Revision: D1124742
2014-01-13 15:19:32 -08:00
Jordan DeLong 7ccb4ef44f Remove includes of util.h from util/ headers
Few of them were using functions exported by util.h, they
were just using it to grab things like std::map.  Fixed some
downstream direct-includes.  Where trivial, used folly or boost
instead of Util::.

Reviewed By: @ptarjan

Differential Revision: D1124738
2014-01-13 15:19:28 -08:00
Jordan DeLong e26c7caf12 Move LogFileFlusher to its own header
Out of util.h.  For now, put drop_caches into
compatability.h, but that could easily turn into a blob-header also if
we're not careful.  Also made some style changes: make the virtual
private (virtual functions should rarely be protected), override
keyword, non-static member initializer, s/class/struct/.

Reviewed By: @edwinsmith

Differential Revision: D1124736
2014-01-13 15:19:25 -08:00
Jordan DeLong 63893eecb4 Remove s_file_mutex from util.cpp
Apparently dead.

Reviewed By: @bertmaher

Differential Revision: D1124735
2014-01-13 15:19:21 -08:00
Fred Emmott ee1e4278f0 HHVM MySQL corrections for bogus connections
Followup to https://github.com/facebook/hhvm/commit/76cab4dd67c3b20ad64927ada9bd71d0c4

Reviewed By: @ptarjan

Differential Revision: D1124285
2014-01-13 15:19:05 -08:00
bsimmers 624945ba03 Document TakeStack better, emit it in fewer situations
There was no obvious context for why it was being emitted in
simplifyLdStack, and we don't need to emit it if the new value is already from
a raw load.

Reviewed By: @edwinsmith

Differential Revision: D1114188
2014-01-13 15:19:01 -08:00
bsimmers 15a3e7b0d5 Print test commands when --verbose is present in test/run
Sometimes I want to see the command to run a test even if it's not
failing.

Reviewed By: @ptarjan

Differential Revision: D1114189
2014-01-13 15:18:57 -08:00
Bert Maher 3e52a380a2 Don't preemptively optimize away conditional jumps
There may be a stack adjustment needed.

Reviewed By: @ottoni

Differential Revision: D1124766
2014-01-13 15:18:50 -08:00
Owen Yamauchi ee2f2d18cb Implement codegen for LdLoc, IncRef, AssertType
LdLoc was the goal here (it was by far the most frequent punt). It's
really simple to implement, but it turned out that doing codegen for it
had a few cascading effects.

- We're now carrying registers across InterpOne calls, so switch to
  using cgCallHelper there.

- Using cgCallHelper for interp-one now requires cgCallHelper to support
  immediate arguments to helpers.

- IncRef and AssertType are now generated in such a way that we can't
  punt on them (even if you punt on them, they show up in
  hhbc-translator output).

Reviewed By: @edwinsmith

Differential Revision: D1120272
2014-01-13 10:11:11 -08:00
Daniel Sloof 42b810671f Fix valgrind issue in Github build
This fixes a JIT crash with VALGRIND=1.

Closes #1483

Reviewed By: @ptarjan

Differential Revision: D1117038

Pulled By: @scannell
2014-01-13 10:11:07 -08:00