For small responses this was ok, since sending the data didn't take much time. For large requests, they would get truncated without this.
I checked for leaks by printing in the FastCGIConnection constructor and destructor and making sure they match up.
Closes#1631
Reviewed By: @simpkins
Differential Revision: D1147016
Previously: ==580== ERROR: AddressSanitizer: attempting free on address which was not malloc()-ed: 0x604400212103
We were recursively freeing the node, including the attribute nodes - however, libxml2 doesn't malloc them separately - all we needed to do was unlink and free the root.
This fixes a fatal in PHPUnit's test suite.
Reviewed By: @ptarjan
Differential Revision: D1144722
If a valid handler is passed in, but wasn't registered, we'd just remove the last one:
- find_if() would return ::end()
- erase() treats that to mean erase the last one
Behavior in the new test was:
- correctly remove 'b'
- incorrectly remove 'a' when asked to remove 'b' again
- segfault when asked to remove 'b' a third time
Reviewed By: @ptarjan
Differential Revision: D1145531
Bug #64458 fixed an off by one error when decoding TXT records
that resulted with garbage at the end of the string returned.
Reviewed By: @scannell
Differential Revision: D1146140
Add a new config param, Server.FileSocket. When
Server.FileSocket
is set it will be used inplace of a network socket for the primary
server. This uses a new parameter to ServerOptions, m_useFileSocket,
to toggle between treating the address as a socket path or a network
address.
To initialize a socket connection thrift expects the socket file to not
exist. To support this the 'something nice' retry in startServer will
unlink an existing socket only if fuser claims it is unused.
Server.EvilShutdown enables unlinking the socket regardless of current
users.
Closes#1594
Reviewed By: @ptarjan
Differential Revision: D1135876
Pulled By: @sgolemon
If you do `parent::class` in a pseudomain you end up in this case. Zend gives this message in that case
Reviewed By: @elgenie
Differential Revision: D1140116
Conflicts:
hphp/compiler/analysis/emitter.cpp
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
Some fastcgi documentation doesn't tell you to pass all the params, only a handful. Even the official docs say this http://wiki.nginx.org/HttpFastcgiModule I think we should support the mode where we don't know the document root, jsut the absolute filename. I've already had to help 2 people in github with this issue so I think it is prevelant
Reviewed By: @scannell
Differential Revision: D1125309
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
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#1470Closes#1496
Reviewed By: @ptarjan
Differential Revision: D1117099
Pulled By: @scannell
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
I'm only 95% convinced that this is the cause of a sandcastle crash.
We're not calling transCounterAddr with sequential translation ids
anymore (apparently) so it's possible that we need to allocate more than
one chunk of new counters.
I ran a sandcastle with this fix applied and it didn't crash, but the
crash wasn't 100% before, so you never know.
Reviewed By: @ottoni
Differential Revision: D1142512
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
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
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
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
PHP_VERSION_ID is now 504999 which is > all Zend versions which
makes using it for comparisons of less than 5.5/5.6/etc. impossible.
Closes#1603
Reviewed By: @sgolemon
Differential Revision: D1135461
* parse all the fastcgi headers at once
* uppercase the key instead of using case insensitive. This won't return the original casing, but HTTP is case insensitive anyways, so it shouldn't matter *cross fingers*
* stop generating a vector in the header map and do it at readtime
* use `unordered_map`
Reviewed By: @jdelong
Differential Revision: D1128430
Making APC strings and APC array with proper shape uncouted and truly shared in APC, saving on copy and ref count
Reviewed By: @jdelong
Differential Revision: D1114228
I have wanted to break up run.php into its own files and refactor things a bit. So I am now doing that.
Note that the frameworks directory now contains the PHP for individual frameworks and that framework_downloads will contain the actual github code for the frameworks
During refactoring, I found some interesting new issues:
1. The recent changes to reflection (ext_reflection-classes.php, etc.) have caused my test finder to hiccup for cases where I find the tests with reflection. This may be bad code on my part; but I am not sure. Right now it seems the issues are coming with IsSubclassOf, but this is just a guess. I am trying to come up with a repo case.
2. The percentage of Magento2 has dropped into the upper 80% range. And this is due to some namespace fatals that are occurring. We need to dig into that. Note, that we are using a more recent git hash for Magento2 (instead of the August one as before) and they added more namespace support during that time. We are also seeing a drop in Drupal as well, but not to the same degree.
@ptarjan, this diff does not make the abstract Framework class public yet. That can be done in a subsequent diff :-)
Reviewed By: @ptarjan
Differential Revision: D1133446
If we pop the stack after ContEnter, it creates a
LdStack/TakeStack that keeps an SSATmp live across a call, which
(rightfully) causes an assertion to fail later.
This isn't a problem if we have refcount opts or dce on, since those
passes will remove the TakeStack, but it would still be good to have
our IR correct in the absence of optimization.
Reviewed By: @swtaarrs
Differential Revision: D1134125
Some optimizations rely on being able to insert code on all exit
edges, so anything that can throw much have a catch block. This diff adds a
runtime check for that and fixes all cases I hit in local and prod testing.
Reviewed By: @edwinsmith
Differential Revision: D1132380
This diff eliminates all exit traces from the jit, turning them into
regular old Unlikely blocks in the main trace. IRTrace is still around and we
have one per IRUnit; I'm planning on eliminating it in a separate
diff. IRTrace's BlockList is gone, so now we just store a pointer to the entry
Block and walk the cfg from there.
Reviewed By: @edwinsmith
Differential Revision: D1128179
... perhaps it will work better in repo mode if the test-installed error
handler always throws an exception, instead of relying on the return
value.
Reviewed By: @jdelong
Differential Revision: D1133463
Already made the corresponding change in flib. This
is more consistent with mb_substr() and more consistent with
a typed world -- fb_utf8_substr()'s return value will pass
typehints for strings, for example.
Reviewed By: @alokmenghrajani
Differential Revision: D493517
It's quite advantageous to be able to support int|float as a
typehint without introducing support for full-blown unions. To make
that equivalence happen, a bit of runtime support is necessary
Reviewed By: @jdelong
Differential Revision: D1128502
DecRefStack is the #2 punt. This involved a surprising amount of code.
Decreffing is hard, apparently.
Reviewed By: @edwinsmith
Differential Revision: D1131799
For now. As is it can infer incorrect property types since
it isn't set up to look at the closure bodies.
Reviewed By: @dariorussi
Differential Revision: D1132987
Type assertions were allocating new DynLocations every time
we encountered them, which breaks getOutputUsage (it uses DynLocation
pointer equality to track the flow of values). When encountering
assertions, it also wasn't doing the optimization that we have in
applyInputMetaData to eliminate earlier predictions on the same
location. Finally, this diff finishes the support for optional object
types (fixes inlining and object property accesses in these
situations).
Reviewed By: @swtaarrs
Differential Revision: D1128602
Fix a long-standing issue that could segfault the VM in
RepoAuthoritative mode (not in practice in www, since our error
handler always throws in this case). To do this, adds a Repo global
metadata blob that we can use to communicate whatever global
compilation information we want to the runtime (I've wished we had
this for a few things in the past).
Reviewed By: @edwinsmith
Differential Revision: D1125218
Looking at the JIT's output with HHBBC on, I noticed guards
in tracelets that only do RetC weren't going away. This is because I
forgot to tell the interpreter that return opcodes read locals, so the
assert opcodes weren't being added.
Reviewed By: @swtaarrs
Differential Revision: D1125188
I think for us to get anything from private property
inference, we have to be able to assert these types and rely on
tracelet guards to remove the nulls.
Reviewed By: @dariorussi
Differential Revision: D1125172
A really small thing we needed to have the recently added
is_opt() and unopt() things to do. Before it would just push TObj.
Now we can push the type with the possible null removed (since we'd
fatal if it was null).
Reviewed By: @dariorussi
Differential Revision: D1125107
We could do better for object types, but probably not worth
the effort yet until there's more conversion.
Reviewed By: @edwinsmith
Differential Revision: D1125101
- Added -i option to include only certain tests to be executed.
- Print the norepo reason next to skipped message for tests with .norepo
file
Closes#1582
Reviewed By: @ptarjan
Differential Revision: D1131390
Pulled By: @scannell
in expression String::FromChar(i + em.basechar)
we casted "i + em.basechar" to char and therefore we got some
collisions of keys in translation table.
This diff uses more appropriate String::FromCStr as keys
Reviewed By: @ptarjan
Differential Revision: D1125958
- gets decrefed in frame_free_locals_helper_inl
- matches the behavior in the other non-error paths
- bsimmers is going to look at LookupCns - Uncounted is probably incorrect
Reviewed By: @swtaarrs
Differential Revision: D1130546
These instructions never actually have an exit edge. Their flags in ir.h
indicate as much, as well as all of the places where they're gen()'ed.
All that code in code-gen was just cluttering up the place.
Reviewed By: @jdelong
Differential Revision: D1129774
This is the #3 punting opcode. The top two are Call and DecRefStack;
Call is in the works but proving to be rather nontrivial, and
DecRefStack is also going to be slightly tricky. This one, on the other
hand, is super simple.
Reviewed By: @edwinsmith
Differential Revision: D1129534
Implemented support for extension version check in phpversion()
following Zend compatibility. Updated all extensions on HHVM to match
versions on PECL and php-src master branch.
Closes#1506
Reviewed By: @JoelMarcey
Differential Revision: D1117334
Pulled By: @scannell
We should let the region selector decide whether or not to merge
profiling translations connected by an unconditional jump into a
longer trace. So don't eagerly trace through unconditional jumps in
profiling mode.
Reviewed By: @edwinsmith
Differential Revision: D1128517
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
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
- 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
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
... 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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
This gets the native-call machinery working on ARM. I tried hard to
avoid copypasta, but unfortunately I think some amount of it is
inevitable.
I've only converted one of the simplest possible opcodes (ConvIntToStr)
for now, because I've knowingly punted on some stuff for now, most
notably arguments passed on the stack. This diff gets the basics in
place; in future diffs I'll convert more opcodes and iron out the issues
that arise.
- shuffleArgs(), like SpillStack, is another one of those annoying cases
where most of the logic is platform-independent but there are several
instruction-emitting calls buried deep down.
- I moved ArgDesc and ArgGroup into their own file, which was fairly
smooth, especially now that PhysReg isn't x64-specific.
- I split out Immed from asm-x64.h because it's not x64-specific and
ArgDesc depends on it.
Reviewed By: @edwinsmith
Differential Revision: D1121726
This was added many moons ago for static content perf. Basically we scanned whatever was on disk and made a map of all the file extensions we wanted to serve. We also allow files to be loaded from disk if `EnableStaticContentFromDisk` is set (which is default on).
Having this was bad for fastcgi since `SourceRoot` doesn't even make sense there.
Reviewed By: @jdelong
Differential Revision: D1124447
when using mod_fastcgi SCRIPT_NAME is the Action instead of the actual document you want
this commit uses PATH_TRANSLATED - DOCUMENT_ROOT
tested with:
apache+mod_fastcgi
apache+mod_proxy_fcgi
nginx with no PATH_TRANSLATED header
nginx with this as PATH_TRANSLATED: fastcgi_param PATH_TRANSLATED $document_root$fastcgi_script_name;
Reviewed By: @scannell
Differential Revision: D1114124
Make iterNext and iterNextK super specialized helpers and invoke via indirect call instead of call to single helper
Reviewed By: @paroski
Differential Revision: D1084030
We are moving away from unused stats and start moving the stats to a more sensible infrastructure
Reviewed By: @jdelong
Differential Revision: D1110559
This is actually a partial implementation because DateFormatter
is tightly bound to IntlCalendar (and its children).
Rather than make a massive hard-to-review diff,
I've implemented most of the DateFormater bits here
and will finish them off with a followup IntlCalendar diff.
Reviewed By: @ptarjan
Differential Revision: D1119360
In practice, this is a bit surprising behavior for code in
<?hh mode that also uses namespaces.
Reviewed By: @dariorussi
Differential Revision: D1120068
This message is breaking composer installing things with enormous regexes. I tried to change the default error level but @markw65 didn't like that and we need to do something, so I guess lets not emit this if EHHS is off.
Closes#1347
Reviewed By: @markw65
Differential Revision: D1118365
I noticed various fields weren't being initialized there while
investigating a failure with the region JIT that seems related to
uninitialized memory. This doesn't fix the failure, but seems worth
fixing anyway.
Reviewed By: @scannell
Differential Revision: D1123322
ReflectionFunction::getStaticVariables returns both use vars
and closure static locals. In zend, if there are name conflicts
between the two sets, things get weird (see task #3499967). Also, in
zend, the value of the static is computed at closure allocation time,
which means calling this on an unevaluated closure gives the static's
value. For us, the closure has to be invoked to execute a
StaticLocInit (prior to that, the 86static_foo property is
KindOfUninit, so we'd raise the notice @elynde hit).
This changes things to not raise when reading properties (only the
statics could be uninit), and strip the 86static_ prefix, which is
closer to what zend shows. But we're still a bit different...
Reviewed By: @ptarjan
Differential Revision: D1120161
Zend currently throws:
Warning: finfo::file(): The invalid fileinfo object.
when trying to do something on an unserialised object. I consider this a
bug in Zend and there doesn't appear to be any tests covering that
behaviour.
This currently segfaults when deconstructing the unserialised object in
HHVM.
Closes#1527
Reviewed By: @ptarjan
Differential Revision: D1123430
Pulled By: @scannell
- m_tz and m_time/tz_info are only relevant if m_time->zone_type == 3
- if zone_type == 1, m_time->z is the only relevant thing
- however, there can still be something completely irrelevant in tz_info - and format() was using this to find the offset
- call offset() instead of asking the tz_info for it
Closes#1406
Reviewed By: @ptarjan
Differential Revision: D1120967
Typedefs weren't being normalized, so checks that should have
worked, didn't.
Closes#1526
Reviewed By: @gabelevi
Differential Revision: D1123427
Pulled By: @scannell
This fixes an error with inconsistent types being used for the 'name'
parameter when registering a libdwarf callback against newer versions
of libdwarf (versions where the 'name' parameter is a const char*).
I verified that this compiles with the latest version of libdwarf.
Closes#1525
Reviewed By: @alexmalyshev
Differential Revision: D1122805
Pulled By: @scannell
When running call_user_func(array('C', 'parent::doesntExist')), Zend
runs C::__call if it exists and if the parent of C also has a
__call method. We were just checking C.
Closes#1471
Reviewed By: @ptarjan
Differential Revision: D1121885
This is basically just moving things around to make the API
more obvious and conform to our general coding style.
Reviewed By: @edwinsmith
Differential Revision: D1121410
Array::lval is almost identical; it just requires that
AccessFlags::Key be passed where string-integer keys can be created
(e.g., dynamic object properties).
Reviewed By: @markw65
Differential Revision: D1121403
Move all the frameworks away from just specific git hashes to a master, develop (or equivalent) branch.
We start off with specific git hashes for the branch, but now there is a --latest and --reset option that gets the latest source for that branch and updates our new frameworks.json file with the latest hash.
I will do a --reset after this diff is approved to get new .expect files, etc.
Reviewed By: @ptarjan
Differential Revision: D1099135
Added templates for two new statement types. Added serialization support. Added references to these types to the generator scripts.
Reviewed By: @elgenie
Differential Revision: D1118441
* clang doesn't like that a lambda without a return type can return
either T or const T
* Template function was declared as non-static but defined as static
* Unused variables on findPassFP
Reviewed By: @jdelong
Differential Revision: D1121470
Converts ID to pointer, wasn't checking the pointer was valid. Warnings are already raised by the lookup function.
These appear to all be functions that don't exist in Zend. Based behavior on existing code when returning bools, libmysql documentation when returning ints.
Closes#1297Closes#1295Closes#1296Closes#1294
Reviewed By: @ptarjan
Differential Revision: D1120382
3 crashes fixed :)
- don't try and write 0 bytes. this makes no sense, and assert-fails for some URIs, including PlainFile
- Take ownership of m_uri
- libxml2 owns what was m_uri_output. Don't double-free.
Closes#1293
Reviewed By: @markw65
Differential Revision: D1119825
Added new function CopyServerParams in http-protocol which uses the new transport function getServerParams that adds any transport specific SERVER variables ie: FASTCGI_PARAMS to the _SERVER array
Closes#1437Closes#1511
Reviewed By: @sgolemon
Differential Revision: D1120838
Pulled By: @scannell
thanks to the awesome @andralex we not longer have to hook into the thing that was inside an ifdef. This should fix lots of problems in the OSS build.
Basically we are now relying on the implicit copy constructor of `char *` to `ZendExtension` to register the extension.
Reviewed By: @sgolemon
Differential Revision: D1119700
... this allows ExtCollectionObjectData to move out of
object-data.h and resolves inconsistency between `BaseVector` and its
cousins `BaseMap` and `BaseSet`. This diff is just a copy-paste: no
changes were made in the added lines.
Reviewed By: @paroski
Differential Revision: D1120174
The prologue we're binding to may change while the thread waits for the write lease, so read the latest value after acquiring the write lease.
Reviewed By: @scannell
Differential Revision: D1120488
Don't know what the point was with using an ArrayIter* in the first
place. It was being deleted in c_DOMNodeIterator::sweep(), which would
try to decRefAndRelease() the ArrayData and hit an assert in
MemoryManager.
Reviewed By: @ptarjan
Differential Revision: D1109230
Also, change behavior of saveHTML() to match formatting options of Zend (required for this test to pass)
Closes#1099
Reviewed By: @ptarjan
Differential Revision: D1119532
... to take advantage of the compiler warnings for using `switch` on
an enum and not covering all the cases. After this diff, adding new
collection types should now be much easier, since the compiler should
be able to ferret out (most of) the missing functionality.
Reviewed By: @jdelong
Differential Revision: D1120079
- parser transform for "FrozenMap" in HH\FrozenMap
- array iterator: work in terms of BaseMap
- fix clone to work on FrozenSet and FrozenVector
- add Collection::is{Map|Vector|Set}Type to types.h to facilitate
uses of Base{Map|Vector|Set}:: functionality
- create collectionInitSet to distinguish keyed sets in literals
(usable for FrozenMap) from keyed sets in mutations
- add support for Frozen collections to compiler's ExpressionList::setCollectionType
Reviewed By: @paroski
Differential Revision: D1119583
... by forwarding $collection == $object to collectionEquals,
even when $collection and $object are not the exact same class.
This might set up the ability to also make Collection and
FrozenCollection inter-comparable.
Reviewed By: @paroski
Differential Revision: D1116829
_ is the one and only non-alphanumeric character that can
show up in valid PHP classnames. Switch to | (or another character)
should allow idl files to define classes containing _'s. We haven't
hit this issue yet, but only as the result of classes such as
`PHP_Unserializable_Class` happening to be defined in systemlib.php
as opposed to idl files
Reviewed By: @jdelong
Differential Revision: D1116701
To implement this, the member instruction support needed to
be beefed up a fair bit, and support was needed for scheduling whole
classes at a time in whole program mode. Checking it in disabled;
it's still a work in progress.
Reviewed By: @dariorussi
Differential Revision: D1115782
It looks weird for the nightlies. I currently have
HipHop VM vnightly-2014-01-06 (rel)
Compiler: heads/master-0-g708d7c03f394d0fe537021161f7b5eff5497edbe
Repo schema: 4f6cadf45ef19259e958e2796ca894f6df7b6db9
Reviewed By: @jdelong
Differential Revision: D1117594
There's was an old race in the bindJmp service request, where a
translation gets invalidated while we're trying to bind a jump to it.
This was exposed by the region JIT, but it can also happen in sandbox
mode.
Reviewed By: @markw65
Differential Revision: D1118962
PGO mode isn't implemented in ARM mode. It's nontrivial to implement,
and I want to get the contbuild re-enabled as soon as possible so I'm
just turning off PGO in ARM mode for now.
Additionally, a test was failing because of another interp-one problem
with SetL, where we were trying to box an Uncounted. I added the logic
that boxing an Uninit promotes to InitNull.
Reviewed By: @ottoni
Differential Revision: D1118876
Trying to get vm-tcspace from the admin port of a sandbox
server crashes the VM, because AHot isn't allocated. Just return 0 in
this case.
Reviewed By: @ottoni
Differential Revision: D1118505
Do a busy loop instead of usleep(5000), since usleep(5000)
causes the CPU to halt, giving meaningless results.
Originally submitted by Tim Starling as pull request #65 for
preinheimer/xhprof.
Closes#1488
Reviewed By: @mikemag
Differential Revision: D1118168
Pulled By: @scannell
There was a weird issue where CHECK_CXX_SOURCE_COMPILES wouldn't find
clock_gettime under clang++, switching to CHECK_FUNCTION_EXISTS worked
both under clang++ and g++ on Ubuntu 13.10
Broken by D1109820. When eliminating the branch from an unguarded load,
and it's the last instruction in its block, we have to add a jump after
it so that the last instruction in the block "isBlockEnd".
Reviewed By: @edwinsmith
Differential Revision: D1117803
This got broken by D1107251. Time to just "implement" ("copy") cgStore
from the x64 backend for real, instead of just a few paths that I think
are important.
Reviewed By: @edwinsmith
Differential Revision: D1117398
This wasn't calling requestInit and setting the libxml handler no null.
So the first time an error came along it would reset the handler from
no-op to reading again.
This is a much better fix, we set our custom handler in requestInit and
when libxml_disable_entity_loader we store that state as a member bool
ensuring requestInit is always called to set our own handler.
If the handler isn't inserted then the behavious is as before. The only
time this could go pear shaped is say we wanted to make the default be
off. In that case we'd need a global requestInit that is always called
since there are libxml references everywhere.
Reviewed By: @jdelong
Differential Revision: D1116686
Many people are having trouble with the open source build getting a "Not Found" message and not knowing what to do from there. What do you think about showing the paths we tried? If you set `RuntimeOption::ErrorDocument404` then that will be used instead.
Reviewed By: @scannell
Differential Revision: D1109693
The import.php script called a non-existant method 'getSubpath'
on a FileInfo object. This commit fixes it so it now works. I verified
this works importing a new extension with multiple source files in
nested directories.
Closes#1509
Reviewed By: @ptarjan
Differential Revision: D1118180
Pulled By: @scannell
The code assumed obj->clone() function to return an ObjectData* with
zero refcount, but the refcount is initialized to 1 by clone().
Let's attach() this already refcounted ObjectData* to the Object.
Reviewed By: @jdelong
Differential Revision: D1117583
Most of these tests were only about eval, so they get norepo.
For FPassC, I pulled the eval case into its own test. This is
separate from the diff to actual make eval fatal in RepoAuthoritative
in case we end up needing to revert that one ...
Reviewed By: @scannell
Differential Revision: D1116200
This diff turns on the initial version of the region JIT, with
"hottrace" regions. To contain profiling and retranslation overheads,
the region JIT only targets functions marked as hot for now. Compared
to the tracelet JIT, CPU time is in the noise according to perflab and
production testing. The region translator still has performance
issues, both known (e.g. guard relaxation is still disabled) and
unknown (translateRegion with tracelet regions still produces worse
code than translateTracelet, even with guard relaxation out of the
picture), and we'll continue to work on these. Once we address these
issues, and try other ideas that the region JIT enables, we should
start seeing performance gains. Nevertheless, we feel like the
current state is good enough to push the region JIT to release. So,
if no one has any objection, we'd like to turn on the region JIT and
try to get it in the next release.
Reviewed By: @bertmaher
Differential Revision: D1116793
Libdwarf 20130729 not only has changed Dwarf_Callback_Func_c
definition, but also adds two new functions dwarf_encode_leb128 and
dwarf_encode_signed_leb128. So, we can check for a presence of symbol in
a library, to distinguish between the old and new libdwarf.
Closes#1490
Reviewed By: @ptarjan
Differential Revision: D1117070
Pulled By: @scannell
Added two tests, one to verify the property exists, another one to
verify that the extra error info is actually set.
Closes#1412Closes#1498
Reviewed By: @ptarjan
Differential Revision: D1117082
Pulled By: @scannell
In repo mode, traits are flattened into the preClasses of using
classes. After {D1111932}, there's no attempt made to import traits
at class instantiation time (in repo mode), so the checks of trait
requirements were not done. This diff patches up that hole, with the
(small) limitation of not quite tracking the chain of
trait-using-trait usages in error messages.
Reviewed By: @markw65
Differential Revision: D1116296
In repo mode, we've already done whole program analysis and
imported trait methods, properties, and interfaces into the
containing preclass. It doesn't make sense to redo that work when
instantiating Class*s.
The downstream effects of this change in repo mode are:
- reflection should get (marginally) faster: no work for trait alias
rules until the first time they're reflected upon
- "used traits" reflection uses preclasses only, except for the case
of object prop iteration, which continues to use the list of trait
classes and works as before, but better (outside of repo mode,
trait props are used ; in repo mode, trait props are ignored as
redundant)
- less work at warmup (doing nothing is faster than doing something
for each trait method)
- trait requirements are not enforced (left for followup diff)
Reviewed By: @markw65
Differential Revision: D1111932
An AsyncFunctionWaitHandle is only created when an object it `await`s is blocking. Currently these `await` events trigger the `onAwait()` callback. However, the first time an async function awaits is also the first time it actually gets created. Thus, the first actual `await` results in the `onCreate()` callback. This is fine, but right now there is no way to know what `WaitHandle` caused the creation of the AsyncFunctionWaitHandle. This useful to know.
For example, the current implementation of Teak does not, from my experimentation, get the call stack correct because it assumes that `asio_get_current()` is the parent when the `onCreate()` callback is called. However, this is not true. With the addition of the child that caused the creation, this can be fixed.
Reviewed By: @jano
Differential Revision: D1115761
This test fails when I run it in repo mode from hphp/, and it
just looks like the expectf pattern is too strict.
Reviewed By: @ptarjan
Differential Revision: D1116012
Allow getDefaultValue() to be called on a ReflectionFunction in certain cases (where the default value can be deserialized from the IDL)
Reviewed By: @ptarjan
Differential Revision: D1116436
Use array_merge() instead of plus (`+`) operator. Also, add new test file for
the hMSet/hMGet pair of functions/commands.
Working on #3340180, we realized that we do not have any .expect file for the test files in `hphp/test/slow/ext_redis/` so noone is actually able to test the module (besides the fact that we don't have any automated slow-test working since no Redis server is setup during test).
Based on what I can see, most of the tests are working alright right now, but:
1. Redis commands HMSET/HMGET do not have any test files, and looks like HMGET is actually broken, besides the syntax issue mentioned in #3340180.
2. Most test files are looking for obvious cases, but not exceptional cases like non-existing lookup keys.
Reviewed By: @ptarjan
Differential Revision: D1108114
lists are inefficient for the way we use these, vectors are smaller and faster,
enable binary searching (future), and typically short anyway.
Reviewed By: @jdelong
Differential Revision: D1116766
This probably just pushes a bit of it down to
runtime/base/types.h, but at least a few decent-sized includes are out
of every TU now (lexical_cast.hpp, iostream, boost/foreach, and
filesystem.hpp). Haven't measured impact on build times if any.
Reviewed By: @edwinsmith
Differential Revision: D1115343
And try to fix downstream indirect dependencies to include
what they use (plenty of indirect includes still missing, though).
Most TU's still get this all via the complex-types.h stuff.
Reviewed By: @dariorussi
Differential Revision: D1115342
It references compiler-specific types like AnalysisResult.
Replace the one live use of the JSON::Escape function from this header
in the runtime with folly call; other use is about to be removed in
another diff from dario.
Reviewed By: @dariorussi
Differential Revision: D1115340
Just use count() for the fooContains ones, mapInsert didn't
do anything, move mapInsertUnique to its only user, use folly's
MapUtil.h versions instead for the other ones.
Reviewed By: @markw65
Differential Revision: D1114043
FilePtr seemed strange to define in base.h. Turned out only
process.cpp uses it. FileReader at first seemed to be freeing FILE*'s
with delete, but it turned out the instance version of it was dead
code, and the class was really just a function. The other site was
supposed to be a scope guard.
Reviewed By: @dariorussi
Differential Revision: D1114038
At least one call site may have been using the custom hash
inadvertently with AtomicHashMap but I preserved the behavior.
It seems like this is a little too dangerous, too. If any translation
unit in the program uses std::hash<char*> without first including
base.h, we have undefined behavior. Since we don't control a lot of
the code linked into our binary this seems like a bad idea.
(Plus it's just nicer to be explicit about whether a char* key is
being treated as just a pointer or as a C-style string at a use site
so you can tell what is going on.)
Reviewed By: @edwinsmith
Differential Revision: D1114035
Right now, through this route (among others), nearly every
translation unit in the runtime includes
boost/interprocess/sync/interprocess_upgradable_mutex.hpp ... just in
case you might want to use it.
This diff doesn't solve the problem, it's just a start (all the other
sub-headers for complex-types.h do this same stuff right now).
Reviewed By: @edwinsmith
Differential Revision: D1114034
Organizationally makes more sense.
Also allows us to set the constant values based on the system defines
rather than hard-coded posix values, and make some conditionally
available constants conditional.
I went through php-src/ext/sockets/sockets.c to match PHP:
Newly added sockets constants:
MSG_CTRUNC
MSG_TRUNC
IP_MULTICAST_IF
IP_MULTICAST_TTL
IP_MULTICAST_LOOP
IPV6_MULTICAST_IF
IPV6_MULTICAST_HOPS
IPV6_MULTICAST_LOOP
IPPROTO_IP
IPPROTO_IPV6
IPV6_UNICAST_HOPS
Existing constants made conditional:
MSG_EOR
MSG_EOF
Newly added conditional constants:
MSG_CONFIRM
MSG_ERRQUEUE
MSG_NOSIGNAL
MSG_DONTWAIT
MSG_MORE
MSG_WAITFORONE
MSG_CMSG_CLOEXEC
SO_REUSEPORT
SO_FAMILY
SO_BINDTODEVICE
TCP_NODELAY
Note: I left out the MCAST_* constants in ext/sockets because
we don't actually have the code to do anything with them.
We can add those in a separate diff.
Reviewed By: @jdelong
Differential Revision: D1116722
We'll most likely stay with Map's equality semantics for ==,
but StableMap's equality semantics will likely have a place as a
user-PHP accessible method on collections.
Reviewed By: @jdelong
Differential Revision: D1116700
This diff ensures that Map and StableMap have the same
storage implementation in preparation for:
- StableMap going away (except, perhaps, for its equality semantics)
- FrozenMap coming into existence
Specifically, this diff:
- introduces a BaseMap superclass
- makes c_Map inherit from BaseMap
- renames c_Map::t_xyz to BaseMap::php_xyz
- make c_Map::t_xyz a thin wrapper over BaseMap::php_xyz
- makes c_StableMap inherit from BaseMap
- removes vast majority of old implementation
- adds c_StableMap::t_xyz as a thin wrapper over BaseMap::php_xyz
- keeps c_StableMap::equals behavior (order mattering)
- keeps unserialization behavior (serialize to 'StableMap' class)
- gets rid of StableMapIterator in favor of a transformed MapIterator that works with any BaseMap
Apologies to reviewers: this started out as a diff series with
StableMap extends Map to verify limited number of test failures, and
git code move detecting wasn't quite good enough to make commit
rewriting less painful.
Reviewed By: @jdelong
Differential Revision: D1113840
It failed to detect a cycle if the path to the cycle started
from a leaf node that wasn't in the cycle. This diff goes
back to the old algorithm, adapted for PhysReg and PhysReg::Map,
and also goes back to fixed-length arrays to avoid allocations.
Reviewed By: @jdelong
Differential Revision: D1116541
Now that Maps retain insertion order and have an internal
representation similar to arrays, there's no reason not to implement
sorting on them. The implementations are largely copy-pasta
Reviewed By: @jdelong
Differential Revision: D1113839
The test runner is now much more resiliant than it used to be, so it can endure a segfault or two. Having the tests is better than not.
Reviewed By: @jdelong
Differential Revision: D1116517
ENT_IGNORE is added, which will silently discard invalid code unit sequences instead of returning an empty string.
I changed relevant QuoteStyle matching to flag bitmask checking. I kept our previous QuoteStyle method since it's used in many other places.
Reviewed By: @ptarjan
Differential Revision: D1116336
An overtly literal person might suspect that ##Compiler::Error## would
involve a compiler spitting out an error message reflected in the
ensuing code. Instead, it turns out that it records the message in a
separate area and blithely **continues onwards** as if the error never
occurred.
In repo mode, traits are imported in the compiler as opposed to at
Class initiation time. My contention is that any fatals/errors
discored during trait flattening should be available at runtime when
an attempt is made to load the file.
This diff introduces the notion of an `AnalysisTimeFatal` to the
compiler and ensures that this fatal propagates (with [analysis] added
to the fatal message). It also ensures that trait flattening and
non-repo trait import share the same error messages, which should make
it possible to eventually stop producing ##.expectf## files that
contain the almost entirely inscrutable ##HPHP Fatal Error: %s##.
Reviewed By: @markw65
Differential Revision: D1112629
This reverts commit 0d694bcf6c0fa7aa4c15f166d0732ea37c5566d8.
It's causing parse_ini_string to sometimes hit assertions in
StringData::setSize, and behavior issues on the intern tier. The fix
wasn't completely obvious and there's an open diff relating to
relevant cases (escaped double quotes), so let's just revert until it
can be looked at by emil.
Reviewed By: @markw65
Differential Revision: D1116199
This was a leak appearing in @apuckey's valgrind dump. @simpkins said the object should delete itself since either the success or error callbacks will for sure be called for each connection.
Closes#1252
Reviewed By: @scannell
Differential Revision: D1115399
The Server tests were the flakey ones, but both got disabled. Lets leave the unit tests around so I don't break stuff.
Reviewed By: @scannell
Differential Revision: D1115879
The `Func*` doesn't keep around information about defaults from the IDL so I switched to using the `ClassInfo`. That in turn showed me there was some logic in there that wasn't being used by anything anymore (as there are no values in the IDL's with foo::bar() in them except for `TimeStamp::Current` which is clearly destined for C++). Ripping that out allowed me to kill a helper functions.
I then did the real work that I wanted and marked parameters with `internal` and don't say there is a default value for those and throw the same exception that zend does.
Reviewed By: @markw65
Differential Revision: D1054845
HPHP was inconsistent with Zend PHP in its rendering of the XMLWriter
startElementNS method. This diff brings better consistency with Zend for the
case of null prefix string or empty prefix string.
Reviewed By: @ptarjan
Differential Revision: D1114272
According to some users, Drupal 7 uses public:// and
temporary:// to store and move files around by using stream_wrappers.
Some functions of stream_wrappers weren't implemented. This patch adds
the following missing functions:
unlink
rename
mkdir (recursive or not)
rmdir
Closes#1474
Reviewed By: @ptarjan
Differential Revision: D1115507
Pulled By: @scannell
Uses the following headers from the transport (for fastcgi)
instead of the local config if they exist:
SERVER_NAME
SERVER_ADDR
SERVER_PORT
Closes#1445
Reviewed By: @ptarjan
Differential Revision: D1114969
Pulled By: @scannell
Extend CppCall to support a call indirect (via register) style and implement a call to a Variant destructor via the indirect call instead of helper
Reviewed By: @ottoni
Differential Revision: D1090464
File does its own internal buffering and uses m_readpos, m_writepos,
m_position for the purpose of keeping track of file offsets. This means
that current (PHP) position is not in sync with the underlying file
descriptor (m_fd).
This works fine, were it not for the fact that ext_stream calls directly
into pure virtual method readImpl that generally lives in PlainFile
and works directly on the file descriptor that might contain an
invalid (buffered-ahead) position.
This pull request does several things:
- Remove default value 0 for File::read(int64_t length), since that
implementation returns earlier for 0 values anyway.
- Implement an overloaded method File::read() that reads the remainder
of the file (until EOF) by using proper File::m_* properties.
- Make ext_stream call into File::read instead of PlainFile::readImpl.
Closes#1333
Reviewed By: @ptarjan
Differential Revision: D1091550
Pulled By: @scannell
- Lexer now only interprets "#!" as a line-1-hashbang
- Added tests for a leading line with both "#test" and a real hash-bang
like "#!hashbang"
Closes#1396Closes#1465
Reviewed By: @ptarjan
Differential Revision: D1114361
Pulled By: @scannell
I noticed that the region translator was emitting type checks for
values that were both predicted (via the interpreter type profiler)
and inferred (via the front-end). This is a result of the type
profiler annotating the output of the instructions while the front-end
annotates the instruction inputs. Therefore, we ended up generating a
CheckStk instruction and then an AssertStk instruction. The AssertStk
instruction is then simplified away (since it's asserting a type that
is already known due to the previous CheckStk), and the CheckStk
remains. The tracelet translator avoids this problem by looking ahead
in the chain of NormalizedInstructions (via getOutputUsage) to
determine that the prediction is unecessary.
I PGO mode, we don't really need the values coming from the
interpreter type profiler. TransProfile translations end whenever
there's a side-exit, and type predictions incur side-exits. And when
we stitch multiple TransProfile translations together to for a
hottrace region (in TransOptimize mode), the guard for the top of the
stack essentially does the role of type prediction. And, if the value
is also inferred, then the guard is omitted and the AssertStk is
emitted and not eliminated (since there's not previous CheckStk).
Note that this diff only solves the problem for regions formed via PGO
(hottrace only). Fixing the problem for other region selectors is
going to be more involved and I tasked to do it separately.
Reviewed By: @swtaarrs
Differential Revision: D1112059
Arrays can't possibly pass a method/class check as they convert
to array (a reserved keyword) so don't bother toString-ing in that case.
Closes#1475
Reviewed By: @ptarjan
Differential Revision: D1114192
Fixed memory leak after executing PDOStatement::execute() with bound parameters. Also removed unnecessary copying of result query string.
Test case (I don't know whether it can be tested with Travis because it requires MySQL connection):
<?php
$pdo = new PDO('mysql:dbname=test;host=localhost', 'root', '');
$data = str_repeat('a', 1000000);
for ($n = 0; $n < 50; $n++) {
$stmt = $pdo->prepare('SELECT :data = 1');
$stmt->bindValue(':data', $data);
$stmt->execute();
$stmt = null;
echo sprintf("%dM\n", memory_get_usage(true) / 1048576);
}
Closes#1459
Reviewed By: @ptarjan
Differential Revision: D1113187
Pulled By: @scannell
Apparently this code was just returning while leaving a bunch
of threads running, which is pretty bad.
Reviewed By: @markw65
Differential Revision: D1111881
Due to a bug in the FastCGI server the start up of the server with
a specific IP address was not possible.
Example:
hhvm --config /etc/hhvm/server.hdf -m server -vServer.Type=fastcgi -vServer.IP=127.0.0.1 -vServer.Port=9100
Before bugfix:
netstat -tulpen|grep 9100
> tcp6 0 0 :::9100 :::* LISTEN
After bugfix:
netstat -tulpen|grep 9100
> tcp 0 0 127.0.0.1:9100 0.0.0.0:* LISTEN
Closes#1467
Reviewed By: @ptarjan
Differential Revision: D1114159
Pulled By: @scannell
This allows Patterns with a leading ^ to match.
Pattern ^www.example.com$
Closes#1463
Reviewed By: @markw65
Differential Revision: D1114114
Pulled By: @scannell
They are essentially Nops, inserted to preserve information
from the simplify pass. They aren't needed anymore after
refcount optimizations; convert them to Nop so dce cleans
them up.
Reviewed By: @swtaarrs
Differential Revision: D1114262
Replace preorder walk over dom tree with bottom-up postorder walk,
and merge state along edges. This catches more violations.
Also, add ContEnter, ignore TakeStack, and StkPtr-typed tmps.
Reviewed By: @swtaarrs
Differential Revision: D1114191
The only option that's actually runtime settable right now is
the list of fb_intercept-able functions. I'm going to want more of
these soon, but the way it was set up was slightly annoying.
This isn't great still---it just moves the place we propagate options
closer to compiler_main. We don't want these options to actually
exist in Compiler::Option because otherwise we'd have to merge
libhhbbc.a with libhphp_analysis.a, and they don't really fit in
RuntimeOption either. (Eventually I'd like to just have another
main() for hhbbc with its own option parser---this would also make it
easy to repeatedly run hhbbc on a repo while developing, without
redoing the rest of the production build.)
Reviewed By: @dariorussi
Differential Revision: D1113886
I noticed while debugging a production crash that
testq -1, MemRef
is 3 bytes bigger than
cmpq 0, MemRef
and is typically interchangable.
While looking for test*s to change, I noticed that we always
do ConvObjToBool, even when we know the Class statically, and know
that the result is going to be true. So added a case to the simplifier.
Reviewed By: @elgenie
Differential Revision: D1109374
If you have a non-persistent class in this code path, we
generate code that fails the reference count validator. It IncRefs
the $this pointer before generating the conditional branch to the exit
trace for the class not being defined.
Reviewed By: @edwinsmith
Differential Revision: D1113826
I revert some change will block my task in coldstage which
be brought into the master by arc land. This diff is to revert that
and local changes.
Reviewed By: @ptarjan
Differential Revision: D1113815
hhvm will callback the compiled php read function to parse the
file to be uploaded. During this process, a file instead of a file
descriptor id should be passed into the hphp VM.
The error is caused by sending file->fb() rather than file itself into
the callback function. The actual hphp fread library try to make a dummy
resource after receiving an integer when a ResourceData is excepted.
The dummy resource file then causes a bunch of error which ends up in
the "read function returned funny value".
Reviewed By: @ptarjan
Differential Revision: D1110769
HHProf should only collect profiles when profiling instead of
proactively and then only reporting when profiling as this incurs a huge
amount of runtime overhead by default with the runtime option enabled.
Reviewed By: @dariorussi
Differential Revision: D1112865
Zend will throw a PHP Notice if you try to re-declare a
constant that has already been declared, but HipHop was throwing a PHP
Warning.
Closes#1456
Reviewed By: @jdelong
Differential Revision: D1112973
Pulled By: @scannell
The non-JSON fallback for quoted string values
should still respect JSON string encoding rules like
unicode, and printf-style escape sequences.
Reviewed By: @scannell
Differential Revision: D1112801
JSON_parse() regards scalars as a syntax error,
but we have explicit checks for null, true, false,
numerics, and strings. Clear the error when we return these.
Reviewed By: @scannell
Differential Revision: D1112796
Use different bits for static type and ref counted types. Every static type is not ref counted however we want to introduce the concept of a non static type that does not need ref counting.
Reviewed By: @markw65
Differential Revision: D1090994
Change, centralized and abstracted data graph walker to collect some info on the data graph for APC
Reviewed By: @jdelong
Differential Revision: D1098889
Add Array to string conversion notice (and RaiseNotice IR
instruction needed to do so when using the JIT)
Closes#1314
Reviewed By: @alexmalyshev
Differential Revision: D1080985
Pulled By: @scannell
preg_match_all's third parameter ($matches) should be an optional parameter.
Closes#1451
Reviewed By: @alexmalyshev
Differential Revision: D1112209
Pulled By: @scannell
Handle empty array in str_replace like Zend and return an empty
array instead of null.
Closes#1452
Reviewed By: @alexmalyshev
Differential Revision: D1112243
Pulled By: @scannell
The lexer and parser didn't know anything about the callable keyword,
and it was causing typehint errors when callable was being used inside a
namespace N, and the resulting typehint turned into "N\callable". Add
T_CALLABLE token to match zend, and fix TypeConstraint to respect it.
Reviewed By: @elgenie
Differential Revision: D1112493
imagefilter was using a function table filled with functions that just
threw NotSupportedException. Fixed them.
Reviewed By: @elgenie
Differential Revision: D1111814
Before we only were looking at blocks on the main trace. This diff
removes the trace dependency, but still adds the middle-blocks to the
trace that owns the from-block.
Reviewed By: @ottoni
Differential Revision: D1111948
Refactor optimizeSideExitCheck() into the postorder walk. We were
visiting every instruction before, we really only need to visit
the last instruction of each block, and we can do it in the same
walk as the other jump optimizations.
Reviewed By: @ottoni
Differential Revision: D1111447
Refactor optimizeSideExitJcc into the postorderWalk traversal.
We don't need to look at traces at all for this to work.
Reviewed By: @jdelong
Differential Revision: D1111176
This lays the groundwork for general jump optimizations and removes
the IRTrace dependency from eliminateUnconditionalJump(). Now we
traverse all blocks in postorder; two blocks joined by a trivial Jmp
can coalesced together.
Reviewed By: @ottoni
Differential Revision: D1111166
Zend doesn't have doc comments for its builtins, so
Reflection{Method,Function,Class,Property}::getDocComment() will just
return false, but we have doc comments in systemlib/php and we return
those. Turns out this breaks Symfony, as they parse their own code and
then try to match their doc comments with those of Reflection, but throw
an exception when they fly up the interfaces on one of their classes and
hit ArrayAccess, which they never parsed doc comments for.
Reviewed By: @ptarjan
Differential Revision: D1106653
* remove a few places where we were attempting to do a modifier check
at trait flattening time (badly?) and at class* time (waaay too late)
* fix the glaring hole where 'visibility' modifier was interpreted as
'not `static`' as opposed to ##public|private|protected|final## due to the way
hphp.y happened to reuse modifiers
Reviewed By: @ottoni
Differential Revision: D1111920
Remove left parentheses that survived edits and evolution. Fix the serialization of a simple function call to use the original function name. Make printExpressionVector treat a null list as an empty list. Use the original (scanned) string value when serializing scalar values. Make StaticClassName::outputCodeModel produce properly serialized strings (i.e. with headers). Use printStatementVector instead of just serializing each element of the vector in sequence. Adjust property counts to take into account null values. Tweak serialization of if statements to better deal with empty true blocks.
Reviewed By: duv
Differential Revision: D1097296
The commands zRange and zRevRange on redis weren't working. Since its
arguments are being passed to the command as an array, we must call
`processArrayCommand()` instead of `processCommand()`.
Reviewed By: @ptarjan
Differential Revision: D1111425
It's more precise to put the next edge on IRInstrution than on Block.
The current setup made it easier to add edges into the IR in general,
but this finally puts them where they should go. This diff also
cleans a few things up: Edge now has an instruction field, which
avoids the need to set Edge.m_from whenever an instruction's block
changes; Edges are allocated separately, and only for instructions
that need them, which reduces sizeof IRInstruction by 16 bytes.
Every block must now end with a control flow instruction, even if it's
just a jmp to a next block. Unnecessary jumps should already be
removed at code-gen time.
This diff also adds a Branch flag. Any instruction that could have
an edge must have either the Branch flag or MayRaiseError flag, in
which case m_edges is never null (but Edge::to could be null).
Other instructions must have m_edges == null. Because of this, it
was necessary to factor the compare instructions into the ones that
throw, with MayRaiseError set plus a catch edge, and ones that don't,
with no edges.
Reviewed By: @jdelong
Differential Revision: D1109820
That's a requirement from how we generate specialized guards, so don't
even let non-final classes enter into the type system.
Reviewed By: aravind
Differential Revision: D1109309
Otherwise, for functions that we never saw during the first
Eval.JitProfileRequest requests, we'll generate profiling translations
that never get retranslated.
Reviewed By: aravind
Differential Revision: D1104276
* Reduce copypasta by inheriting from a common IntlRequestData
* Move some stuff into headers for interop between intl components
Reviewed By: @ptarjan
Differential Revision: D1107269
traits should be able to state what they require of their
subclasses:
require implements SomeInterface
require extends SuperClass
This will aid hack in being able to typecheck trait bodies as
well as allowing more disciplined trait coding (tying traits to
class hierarchies, as happens in practice).
This diff checks implements and extends requirements on recusively
used traits (class uses trait that itself uses another trait that has
requirements). The approach chosen is to walk the trait hierarchy for
each Class instantiation; an alternative approach would be to keep a
list of requirements in each trait Class and add to it.
Note that nothing is done in repo mode, since traits end up flattened
into using classes.
Reviewed By: @jdelong
Differential Revision: D1101640
traits should be able to state what they require of their
subclasses:
require implements SomeInterface
require extends SuperClass
This will aid hack in being able to typecheck trait bodies as well as
allowing more disciplined trait coding (tying traits to class
hierarchies, as happens in practice).
This diff introduces the checking of implements and extends
constraints on the using class, and (less importantly) enforces that
we're dealing with the right kind of class on traits.
Reviewed By: @jdelong
Differential Revision: D1101637
traits should be able to state what they require of their
subclasses:
require implements SomeInterface
require extends SuperClass
This will aid hack in being able to typecheck trait bodies as well as
allowing more disciplined trait coding (tying traits to class
hierarchies, as happens in practice).
This diff moves the trait requirement declarations into the preClass,
but doesn't yet check them
Reviewed By: @jdelong
Differential Revision: D1101621
We're turning it off in all of our configs, but we left it on
in the example OSS configs. There's some sort of race-issue reported
on github, so let's turn the default to the tested configuration.
Closes#1402 (not the underlying problem, but we're not really
planning to make StatCache better any time soon).
Reviewed By: @edwinsmith
Differential Revision: D1108713
The type prediction optimization checks for a specific pattern, which
changed once we dropped the dest operand of IncRefs. This diff fixes
it.
Reviewed By: @jdelong
Differential Revision: D1110700
locAsCell behaves like CGetL: it returns a subtype of
TInitCell (uninits become init nulls, and it dereferences TRef).
Since in these grouping functions we're about to set the loc back
"unchanged", we want something that does the deref but not the
conversion of uninit to init.
Reviewed By: @edwinsmith
Differential Revision: D1109766
Just is easier to manipulate bytecode than metadata. This
doesn't hook it up in hhbbc yet. Also I removed surprise flag checks
from IterBreak: they aren't ever going to jump to loop heads.
Reviewed By: @markw65
Differential Revision: D1103402
Don't even check USE_HHVM/USE_HPHPC, hphpc died months ago.
HHVM_BINARY and HHVM_LIB_PATH_DEFAULT defines are no longer used.
HHVM_PATH is specific to test.
Otherwise the block may become empty and validation passes start to
complain. It's simpler to just convert the instructions to Nop and
let DCE take care of cleaning things up.
Reviewed By: aravind
Differential Revision: D1109291
The current reimplementation of SplObjectStorage does not allow mutation
of "info" values attached to object keys in the case where the object is
already present in the object. This is inconsistent with PHP's behavior.
Closes#1388
Reviewed By: @ptarjan
Differential Revision: D1108349
Pulled By: @scannell
The contract for strrchr is "If needle contains more than one character,
only the first is used". The implementation was using strrpos which
scans for the entire string, not just the first character, resulting in
an incompatibility. This PR request resolves that incompatibility.
Also, for the purposes of strrchr, zend treats the empty string as a NUL
character. This happens because the empty string is (apparently) handled
by the second rule for needle: "If needle is not a string, it is
converted to an integer and applied as the ordinal value of a
character."
Closes#1394
Reviewed By: @JoelMarcey
Differential Revision: D1108545
Pulled By: @scannell
As no error number was being passed when a fatal error occurred, error_get_last() in a shutdown handler wasn't able to check if the error was fatal.
Closes#1408
Reviewed By: @alexmalyshev
Differential Revision: D1110032
Pulled By: @scannell
Zend's implementation of stripslashes removes a trailing
backslash in a string, except in the empty string it is replaced by a
NUL. Prior to this PR, HHVM's implementation always replaced the
trailing backslash with a NUL. The reason is, HHVM unconditionally
appended the character following a backslash. When the string ends in
backslash, the following character is the null-terminator of the
underlying C-string.
This was identified because of a failing test in the WordPress test
suite.
Closes#1423
Reviewed By: @alexmalyshev
Differential Revision: D1110135
Pulled By: @scannell
PHP documentation requires it to be optional, passing no
argument would call the constructor taking no arguments.
Reviewed By: @ptarjan
Differential Revision: D1109795
We shouldn't use the current directory or the configured `SourceRoot` since the webserver could have many virtual hosts and always will send us a DOCUMENT_ROOT header.
The only scary part of the change is checking for `sourceRoot` instead of `getDocumentRoot` but I think it is right.
Reviewed By: @markw65
Differential Revision: D1108017
Also remove a "useless non-terminal" warning (an old rule was
accidentally left in). This only affected empty async function
closures, since the onClosure itself wasn't off by one, and all
finishStatement does is replace empty statement lists.
Reviewed By: @edwinsmith
Differential Revision: D1109810
No information of input string was stored by ini_set. For e.g.
10K was converted to 10240 which ini_get('memory_limit') returned.
Solution was to store user passed in string and convert it to integer
whenever required
Reviewed By: @ptarjan
Differential Revision: D1109228
Let type inference know the actual type for T_COLLECTION
expressions. Also mark them "definitely not null".
Reviewed By: @jdelong
Differential Revision: D1109650
traits should be able to state what they require of their
subclasses:
require implements SomeInterface
require extends SuperClass
This will aid hack in being able to typecheck trait bodies as well as
allowing more disciplined trait coding (tying traits to class
hierarchies, as happens in practice).
Reviewed By: @jdelong
Differential Revision: D1101619
This lets us analyze systemlib.php in wholeprogram mode. It also
analyzes the various extension php files in wholeprogram mode. Previously,
whole program mode was almost entierly unaware of the mini-systemlibs, and
things only really worked by luck, and bugs in the way they were processed.
Reviewed By: @jdelong
Differential Revision: D1099615
NULL is allowed for some string parameters in some functions of finfo. In fact, NULL is the default value. e.g., http://php.net/manual/en/function.finfo-open.php
Our current implementation did not allow nullable strings. We would get errors like:
HipHop Fatal error: Argument 1 passed to foo() must be an instance of string, null given in /tmp/strtest.php on line 4
Make these string nullable (e.g. ?string)
phpbb was running into this issue using finfo
Reviewed By: @ptarjan
Differential Revision: D1107796
Move the Set collection class to the HH namespace.
So now get_class(new Set()) === "HH\Set".
The auto-import mechanism in place makes the change transparent most of the
time (e.g. developers can simply use "Set" in their code), but the namespace
shows up in some cases, serialization being a notable one.
Depends on D979471.
Reviewed By: @elgenie
Differential Revision: D1081929
The $count parameter of str_replace is supposed to return the total
number of string replacements performed. This was only working correctly
when both $search and $subject were strings. When either or both are
arrays, the counts need to accumulate across all replacements. The code,
as written, was only returning the replacement count for the last pair
of values.
Closes#1383
Reviewed By: @ptarjan
Differential Revision: D1106935
Pulled By: @scannell
Loading $this will always fail in these, but we shouldn't dump core
while processing the unreachable code.
Reviewed By: @ottoni
Differential Revision: D1107377
This diff changes things so that Profile translations for all function
entries (normal entry plus DV funclets) trigger Optimize
retranslations in PGO mode. This fixes the PGO mechanism for
irregular functions (e.g. array_map) that don't follow the defunct
bytecode rule that DV funclets fall-through one into another and then
into the function's main entry (function base).
Also did a few cleanups along the way.
Reviewed By: @bertmaher
Differential Revision: D1108164
Classes derived from exception have a custom-instance-init
method which gets called before the constructor. It can throw (eg
if a timeout occurs), so allocObj needs a catch trace, and allocObjFast
shouldn't be called on classes derived from Exception.
Reviewed By: @edwinsmith
Differential Revision: D1107437
Looking at XLS trace dumps, most units have a lot less
intervals than SSATmp ids. Allocating them separately
should save a bunch of memory, but also avoid any hazards
from std::vector moving them during register allocation.
(which happened to me once, w/out a reserve call).
Reviewed By: @jdelong
Differential Revision: D1107035
We weren't properly splitting the mysql socket form of connect
strings when ipv6 support was added. The net result was a string of the
form:
localhost:/path/to/socket
was trying to open the socket 'path/to/socket' rather than
'/path/to/socket'
Reviewed By: @ptarjan
Differential Revision: D1107623
This should unbreak the legacy region selector in opt builds while I
try to figure out why it's firing.
Reviewed By: @edwinsmith
Differential Revision: D1105296
- aprof needs 6 digits just like a
- return the proper sizes for the admin port check-health command
- make an assert in emitVerifyParamType more useful
Reviewed By: @bertmaher
Differential Revision: D1103500
This diff adds syntax to hphp.y, context sensitive keywords to hphp.ll, AST classes, a dummy emitter that just turns a query expression into a serialized CodeModel, as well as several test cases that exercise all options in the syntax and tests that the new keywords can still be used outside of queries.
The PHP syntax is exactly the same as the C# syntax.
There is significant restriction not present in C#, but necessary to get rid of shift reduce conflicts in Bison, namely: a query expression can only appear on the right hand side of an assignment to simple variable and as the expression of a return statement.
The need for making the "from" keyword context sensitive also precludes changing the syntax of "from $row in $table" to a more PHP compatible "from $table as $row", since $row can be any kind of expressions and hence does not provide enough context for the scanner to determine that the from token starts a query.
A query expression compiles to a call looking a bit like
$rc = $c->executeQuery("serialized ast for normalized query expression", argvector);
foreach ($rc as $re) { yield some_expression_containing($re); }
The $c is the value of the expression in the first from clause. The serialized ast represent the query expression after all parts of it that can be executed locally have been removed. Argvector is a vector of values that were computed locally. $rc is collection of tuples received from the query engine. The "foreach" turns the tuples into values as specified by the select clause.
This diff does not complete the implementation of code generation for query expressions. Specifically, the ast is not normalized, the argvector is null and the foreach is missing. I would like to get this diff out as is now in order to enable people to write query providers and test them with actual query expressions.
Reviewed By: @paroski
Differential Revision: D1088496
`php_pcre_replace` isn't guaranteed to return a String or Boolean. Lets just proxy the result back if it isn't a string instead of assuming and segfaulting the async tier.
Reviewed By: @markw65
Differential Revision: D1106633
I screwed up the prefix check. Something that is a directory has to have a `/` between the prefix and the file, not just any character.
Closes#1334
Reviewed By: @JoelMarcey
Differential Revision: D1104260
These flags aren't used for anything, so it's hard to know
what semantics they're supposed to have. If we want to add something
similar in the future it will probably be just as easy to reason
through what we want from each opcode instead of trying to use these.
Reviewed By: @jdelong
Differential Revision: D1100600
This was the top punt. Implementing that just moved a bunch of punting
to DbgAssertRefCount, so I implemented that too.
Reviewed By: @edwinsmith
Differential Revision: D1104532
A small profiler which looks for memoization opprotunities. It's fairly ghetto right now, and dumps its output to stderr, but it's useful as is now so I'm gonna put it in. It's not hooked up anywhere, but if you're interested in how to hook it up, run it, and intrepret the output lemme know.
Reviewed By: @hermanventer
Differential Revision: D1100611
For consistency with abi-arm.h. This doesn't cause too much X64::
line-noise (since files like code-gen-x64.cpp just do `using namespace
X64`), and it shines a light on some spurious platform dependencies,
which are now well-marked for when future ARM codegen stumbles across
them.
Reviewed By: @edwinsmith
Differential Revision: D1104447
It was getting overrwritten every time session_set_save_handler() was
being called.
Also ext_session_request_shutdown() was calling close() on the session
module twice, fix that.
Reviewed By: @ptarjan
Differential Revision: D1101153
When a request finishes and the PDO connection is not closed in
userland, we need to explictly close it to prevent excessive amount of
connections (and eventually causing MySQL to reject them).
This can obviously be solved in userland by closing the connection in a
register_shutdown_function, but we need to be consistent with PHP.
Closes#1345
Reviewed By: @markw65
Differential Revision: D1098327
Pulled By: @scannell
I added some code to the openFile function in runtime/ext/ext_process.cpp that accounts for the case when the user calls proc_open() using
php://stdin as stdin for the process spawned.
Reviewed By: @ptarjan
Differential Revision: D1094713
Template symbols are tagged WEAK, and neither
LOCAL nor GLOBAL. We need to include those in perf-pid.map
though.
Reviewed By: @ottoni
Differential Revision: D1103103
The c++ implementation of array_filter was recently removed,
and static analysis doesn't see .hhas files, so is now unaware of the
function, and so spits out UnknownFunction warnings. In addition, until
D1099615 lands, functions defined in mini-systemlibs aren't known either,
and so result in similar warnings.
This is a quick hack to eliminate those, so we can hotfix it to rc. I'll
do a better diff on master on top of D1099615.
Reviewed By: @ptarjan
Differential Revision: D1103230
- Memory profiling should not result in allocations and VM re-entry if we're crashing
- Fix call fixup in function prologue
Reviewed By: @jdelong
Differential Revision: D1102730
Several of the functions relating to option types were wrong
if the option type had data (e.g. types like ?SStr="foo"). It's
easier to get everything right after adding TOptC{Str,Arr} types,
although I don't think they should happen much, so I added those.
Also, update IsTypeL; Jmp cases to do as good as the CGetL; Jmp cases
do with optional object subtypes.
Reviewed By: @edwinsmith
Differential Revision: D1099593
The hhbbc case was a bug---for HNI it is a change in behavior
that looks unintentional, but I sorta doubt anything relies on the old
behavior. Also remove the StringData* overload so you can't
accidentally call the wrong function, and add documentation.
Reviewed By: @alokmenghrajani
Differential Revision: D1099590
This makes some of the common patterns of user-level explicit
type tests update the types of locals on each side of the conditional
branch.
I thought a bit about how to do this without just pattern matching on
common bytecode pairs, but this seems the simplest way to get what we
want for now. One other idea basically would involve a whole pass to
figure out which stack slots have the same types as which locals
(taking into account things that kill that relationship), which seemed
like it was unlikely to get any more types (although it would be "more
general").
Still a TODO is instanceof + jmp.
Reviewed By: @edwinsmith
Differential Revision: D1093057
With the control-flow sensitive local type inference in
hhbbc, a local was being asserted as Type::Null. Because
isKnownDataType returned true, preOptimizeStLoc decided that
converting that local from KindOfUninit (the actual live type) to
KindOfNull did not require storing a new m_type value, leading to a
crash down the line in the next translation. I tried cleaning up
isKnownDataType but too many things depend on it (also it's a little
conceptually shaky because of how we deal with Str), so for now tasked
and just fixed this function.
Reviewed By: @swtaarrs
Differential Revision: D1099460
This reverts commit ff25227dea707166baf9fcb14a4940d503252e5f.
This has been reverted in 4 releases. That is just unacceptable. Please don't commit this until it can go out with a release.
Reviewed By: @jano
Differential Revision: D1102064
Use this to unify all our to/from string functions for OA
arguments. Also removes some of the remaining casting to/from
unsigned char.
Reviewed By: @swtaarrs
Differential Revision: D1098649
I'm planning to make the opcode table support strongly-typed
OA args, so I'll convert the remaining OA's to have enum classes.
After this diff, only BareThis uses an OA arg without an associated
enum class (I'll change that if making OA take a type argument turns
out to be good).
Reviewed By: @swtaarrs
Differential Revision: D1097329
When I changed `getHeaders()` to be the same for fastcgi as all the other transports I didn't notice julk has put in special rules to deal with the fact they weren't the same. Rip that out.
This makes `$_SERVER` contain `HTTP_HOST` instead of just `HOST`.
Reviewed By: @sgolemon
Differential Revision: D1100779
This gets ARM register allocation to use XLS properly.
- x2a is now just a type conversion function. This is the smoothest way
of getting around the PhysReg::operator[] problem. I don't think this
is the ideal way forward because it means the ARM backend is still a
second-class citizen in a way. Any thoughts on how this should be
done? I have a few, none of them appealing.
- Another problem I encountered is stuff within the jit (check.cpp and
linear-scan.cpp) treating rVmSp and rVmFp specially, even though these
are x64-specific. I want to try putting those in the X64 namespace,
so that genuinely x64-specific usage sites have to be explicit about
it, and then having runtime-populated rVmFp and rVmSp globals that
depend on the current arch() for usage sites that don't care about
platform.
- Made the IR printing stuff able to pretty-print ARM regs.
Reviewed By: @edwinsmith
Differential Revision: D1100519
Array has a weird behaviour where string keys that can be represented
as ints are automagically converted to ints. From the manual:
A key may be either an integer or a string. If a key is the standard
representation of an integer, it will be interpreted as such (i.e.
"8" will be interpreted as 8, while "08" will be interpreted as "08").
Since Set can contain both ints and strings, we could have e.g.
$s = Set {1, '1'}
Calling $s->toArray() gives back then a 1-element array.
We were previously raising a warning in this case, but the warning didn't
specify what was the value of the "duplicate" key. Do so.
Reviewed By: @jdelong
Differential Revision: D1096274
Adds the optional second `is_html` boolean parameter to match the Zend
implementation. The nl2br function still needs some work to have full
parity with zend, so the zend testcases aren't moved from bad to good
yet.
Reviewed By: @JoelMarcey
Differential Revision: D1101855
Pulled By: @scannell
Modified findSingleTraitWithMethod so that it raises an error when there is trait collision for a trait alias
Reviewed By: @jdelong
Differential Revision: D1098140
subclasses of c++ builtins (aka datetime) need to execute
both the builtin's clone *and* whatever the PHP classes' __clone is.
This unbreaks three datetime related test failures (my bad).
Reviewed By: @sgolemon
Differential Revision: D1102148
... by replacing it with the combination of IsCppBuiltin and
HasClone. This frees up an ObjectData flags slot.
Reviewed By: @jdelong
Differential Revision: D1100574
This was a little tricky. On ARM machines, register number 31 is the
stack pointer. However, in some encodings, register number 31 refers to
a virtual "zero" register (basically the /dev/zero of registers). To
make sure that you don't accidentally use the wrong one with the wrong
encoding, vixl uses register number 63 to identify the stack pointer
(does not exist in hardware) and converts it to 31 while assembling.
This means that vixl uses 33 different register codes, so I'm changing
PhysReg to reflect this. This means we can now only represent 31 SIMD
register on ARM. I think this is preferable over losing the stack
pointer / zero register distinction in vixl.
Reviewed By: @edwinsmith
Differential Revision: D1100167
Instead of walking the entire list of profiling translations, keep
sets keyed on FuncID.
Default to JitRegionSelector=hottrace when JitPGO=true.
Reviewed By: aravind
Differential Revision: D1101198
This limits the duration of profiling, and skips PGO on functions
that aren't really hot.
Reuses the request count used to control the interpreter warmup
requests.
Reviewed By: @bertmaher
Differential Revision: D1095115
Some trivial cleanup; it's pretty confusing to have a Value
named "state" when there is also a "struct State" in this file.
Reviewed By: @swtaarrs
Differential Revision: D1091303
All of our current local cronjob problems (not sure about chronos) are coming from corrupted .stat files. This is because the way we handled the gathering and printing of post test error information and stats were not 100% correct.
This diff hopefully helps fix this such that our local cronjob won't fail any longer.
Reviewed By: @ptarjan
Differential Revision: D1100647
This diff refactors the bytecode emitter support for try/finally. I re-
worked the algorithms to be written in an iterative manner (before they
were recursive) and fixed two small bugs, but aside from that I tried to
preserve the existing algorithms for now and mainly focus on moving the
code around and simplifying the structure a bit.
A lot of the emission logic for supporting try/finally was in separate
classes instead of EmitterVisitor which made things a bit unwieldy. This
diff takes most of the logic from FinallyRouter and FinallyRouterEntry and
moves it to EmitterVisitor, which helped simplify things and better fits
the style of the rest of the emitter. I got rid of the FinallyRouter class
and moved its fields to EmitterVisitor, and I renamed FinallyRouterEntry
and Action to "Region" and "ControlTarget" respectively. I also refactored
things a bit to reduce the amount of code that needs to deal with Regions.
Finally, I fixed a small bug where Region::getCaseCount() was double
counting the number of continue cases, and I improved the emitter to avoid
emitting a jump after the body of a try block when its not needed.
Ideas for future improvements: (1) simplify the algorithms and data
structures, (2) clean up how regions are created, entered, and left,
(3) merge the "Region" abstraction together with other region-like
concepts ("ForeachIterGuard", "FPIRegion", etc).
Reviewed By: @hermanventer
Differential Revision: D1099687
... the flags should all be the same. Fixes an inline issue
where FrozenSet was not marked as having a Clone function,
and *Vector and *Set were not marked as `IsCppBuiltin`.
Reviewed By: @jdelong
Differential Revision: D1100505
It doesn't like that. It's going to be fixed to not barf on None, but
this will make things strictly better.
Reviewed By: @ptarjan
Differential Revision: D1100177
Headers as mangled in the FastCGI protocol, but the `getHeader()` method on `Transport` assumed the header was the original value.
Closes#1359
Reviewed By: @alexmalyshev
Differential Revision: D1098954
The bytecode emitter had a bug where it wasn't properly keeping track of
which iterators were live at a fault funclet's entry point. When emitting
a foreach loop inside the body of a fault funclet, the bytecode emitter in
some cases would erroneously use an iterator variable ID that was already
live.
This diff fixes the bug by updating the bytecode emitter to keep track of
which iterators were live at a fault funclet's entry point, and by updating
the logic for allocating iterator variable IDs to correctly handle foreach
loops inside fault funclets.
Reviewed By: @jdelong
Differential Revision: D1099508
This diff tightens up the logic in c_Map::reserve to be more careful when
mixing signed and unsigned integers and when mixing 32-bit and 64-bit
integers.
This diff also removes a bogus assert, adds some more (non-bogus) asserts,
and adds some comments.
Reviewed By: anietoro
Differential Revision: D1097684
I think I was thinking that since interfaces can't declare
__construct methods, abstract classes probably couldn't either.
Actually not true.
Reviewed By: @dariorussi
Differential Revision: D1092876
Code gen for FunctionExitSurpriseHook and refcount optimization RetCtrl
opcode processing needs to know whether these opcodes were used inside a
generator. They currently obtain this information thru curFunc(). This
information is known statically, so pass it explicitly.
Needed for unified inner/outer generator functions.
Reviewed By: @jdelong
Differential Revision: D1095196
Finally. PhysReg can now represent 32 GP regs and 32 SIMD regs.
Having the arch() dependency inside PhysReg feels a little strange, but
(a) Map really does need to behave differently depending on the
architecture, and (b) it's really convenient to have Map defined inside
PhysReg. I think it's an okay tradeoff.
In a followup diff, I'll get rid of x2a and have PhysRegs with ARM
register numbers flowing through XLS. It's still going to be a bit messy
because both codegen backends use the operator[] trick to create memory
references from register + offset. The ARM backend uses
vixl::Register::operator[], but the x64 backend uses
PhysReg::operator[]. I'm not yet sure how I'll reconcile this.
Reviewed By: @ottoni
Differential Revision: D1097959
The way I was generating the "RUN TEST FILE" commands at the end of the script run or within .errors/.fatals files was not the best. This improves that.
Reviewed By: @ptarjan
Differential Revision: D1098631
I love yii. I love yii. I love yii.
Need to check for another type of post test warning, that includes a PHPUnit Exception.
Reviewed By: @ptarjan
Differential Revision: D1098761
It looks like we fixed the post test fatal problem that joomla was having, but now yii may have post test warnings. For example,
/data/users/ptarjan/fbcode/hphp/test/frameworks/frameworks/yii/tests/./
framework/web/auth/CWebUserTest.php
HipHop Warning: Constant PHPUNIT_COMPOSER_INSTALL already defined in ve
ndor/phpunit/phpunit/composer/bin/phpunit on line 49
Let's see if this can fix that.
Reviewed By: @alexmalyshev
Differential Revision: D1098415
With this, I think the dependency is broken, and we can start using
PhysReg to represent different register sets smoothly, without wrecking
anything.
Reviewed By: @edwinsmith
Differential Revision: D1096506
We want external developers to be able to use their own collection classes (e.g. Vector, Map, etc.) without colliding with HHVM's native versions.
This diffs moves the Vector class to the HH namespace.
It uses the "autoimport" mechanism in the parser so that the change is mostly transparent to PHP-land, and also modifies the IDL compiler so that class names (in the IDL) can contain namespaces.
i.e. for Vector, we change the class name in the IDL from "Vector" to "HH_Vector", which later gets exported as "HH\Vector" in PHP-land.
Reviewed By: @paroski
Differential Revision: D979471
The two register allocators had some remaining offenders. XLS was really
easy to fix (and in fact it made the code nicer), whereas LinearScan
didn't want to go quietly.
There is one substantive difference: in the stress mode where LS has a
reduced number of free registers, the ones at the beginning of the
sequence will be reserved instead of at the end. I could have avoided
that by giving PhysReg::Map a reverse iterator, but I don't think it
matters that much.
Up next: remove PhysReg::operator int().
Reviewed By: @edwinsmith
Differential Revision: D1096303
Removes method prologue as unnecessary since
we're coercing types during the call anyway.
Fixes fileinfo's HNI declarations to use nullable types.
Reviewed By: @ptarjan
Differential Revision: D1096599
Append to _script.errors during a single run of the script in case different frameworks have script errors during an --all run, for example.
Reviewed By: @ptarjan
Differential Revision: D1097486
This diff should hopefully help the cronjob run better.
The cronjob and my local runs were getting errors like this:
The stats file for joomla is corrupt! It should only have test names and statuses in it.
We were getting this because of hhvm cleanup core dumps, etc. after a test was run. Instead of printing stats in the stats file, we were printing this fatal information, which corrupted the stats file.
So, I captured this fatal information and directed it to the fatals file instead.
Reviewed By: @ptarjan
Differential Revision: D1097602
I'm trying to break dependencies on PhysReg's internal representation
(regnum for GP regs; regnum + constant offset for SIMD regs). This is
necessary to use it for ARM registers. This means forbidding direct
conversion between int and PhysReg, and this file is one of the worst
offenders.
I rewrote it to use PhysRegs everywhere (this doesn't ruin the compiled
code; PhysReg's only member is an int so passing it around by value
and copying it isn't a big deal), and in the process introduced
PhysReg::Map, which uses the convenient underlying representation to be
compact, but hides that detail behind an STL-like container interface.
The next step will be to flush out other places where implicit
int-PhysReg conversion happens, and squish it. Once it's all gone, we
can freely mess around with the internal representation of PhysReg, and
it will all be contained in PhysReg, PhysReg::Map, and RegSet.
Reviewed By: @edwinsmith
Differential Revision: D1095930
The code to detect a side exit to the first instruction in the
tracelet was broken for inlining, if the offset of the side-exiting
instruction just happened to be the same as the offset of the start
of the tracelet.
If we're inlining, we know they're not the same though, so skip the
check in that case.
Reviewed By: @jdelong
Differential Revision: D1096829
At this point, we want a way to always log these type warnings in the runtime (instead of the current 1/100 sampling). The next
step is to convert the nullable warnings into exceptions (see 83c970e1d8c01fd6e20c2cdb32d6a047c79edc4d).
Reviewed By: @paroski
Differential Revision: D1068880
File::seek returns true/false as a success status, so don't compare it
against a size_t.
Clang also doesn't like using an assignment in the condition of a
for-loop, wrapping it in parens silences the warning.
Reviewed By: @scannell
Differential Revision: D1096987
Adds the ability to override the runtime option specifying
allocation vs. heap profile on a per-request basis by adding profileType=foo to
the query string specified in the HHProf start request.
Reviewed By: @edwinsmith
Differential Revision: D1096216
Adds a simd field to Abi, plus code to have allow & prefer
sets for each interval. We try to allocate from the prefer
set, but always at least take from the allow set. Doubles
always prefer simd. In addition, instructions that load and
store Cells, prefer simd. This mimics the existing policy in
linear-scan.cpp.
Also changes linear-scan.cpp to not prefer GPRs for a tmp
that is an XMM candidate but which crosses a native call,
when HHIREnableCalleeSavedOpt==false (since prefering GPRs
in that case is part of the optimization).
Add support for XMM registers to PhysRegSaver. If we had
a live XMM (double or TypedValue) that spanned a call, it
wasn't getting saved.
Reviewed By: @ottoni
Differential Revision: D1091845
Simplify some IRTrace creation logic and clean up some type
smart::unique_ptr code now that we're on gcc >=4.7.
Reviewed By: @jdelong
Differential Revision: D1079241
There were two erroneous asserts in c_Map's implementation that were failing
in some cases when elements in a Map were unset. This diff removes the bogus
asserts.
Reviewed By: @dariorussi
Differential Revision: D1096926
Fixed the VM AST to Code Model serializer to use "sourceLocation" rather than "location". Also fixed the serialization of constant expressions to use "variableName" rather than just name and to use the original name field for its value. Also fixed serialization of closure expressions to check for the case where there are no captured variables.
Reviewed By: duv
Differential Revision: D1095904
@ptarjan's cronjob brought about an error that looked like this:
HipHop Warning: error() expects exactly 1 parameter, 0 given in /data/users/ptarjan/fbcode/hphp/tools/command_line_lib.php on line 16
HipHop Fatal error: Argument 1 passed to error() must be an instance of string, null given in /data/users/ptarjan/fbcode/hphp/tools/command_line_lib.php on line 16
Well, that is because error() requires a string as a parameter and there were cases in --csv where I called error() without a string.
Why the error is happening, we can hopefully find out after this fix too.
Fixed that. Actually re-did the erorr handling just a tad.
Reviewed By: @alexmalyshev
Differential Revision: D1096625
There were a bunch of collection-related functions (e.g. collectionSet()) that
FrozenVector didn't implement. Fix that.
Reviewed By: @paroski
Differential Revision: D1066321
This seems to avoid some of the overhead for profiling and
retranslating in perflab. It's possible that we can benefit from
additional profiling data, but this lower threshold seems to be the
best for perflab right now. We can revisit it once we can increase
perflab warmup.
Reviewed By: aravind
Differential Revision: D1093148
Fix ArrayData's protected member m_kind being accessed incorrectly
Clang didn't like having a static_assert in an anonymous struct in
an anonymous union.
Seems like objects that use the new member initialization syntax are
required to have a user defined ctor, at least that's what the error
was...
Reviewed By: @jdelong
Differential Revision: D1093761
phpmyadmin (ab)uses this quite a bit and we are grossly incompatible. Either PHP has changed a bunch since 5.2 or the original author didn't test it thoroughly.
Reviewed By: @alexmalyshev
Differential Revision: D1095350
This updates Map to use an HphpArray-like data structure instead of the old
data structure it was using. As a consequence Maps will now retain insertion
order.
With this change, Map performance stayed the same or improved on several
micro-benchmarks that test out different aspects of Map performance (such
as foreach, creating lots of small maps, building large maps, accessing
using "$c[$k]" syntax, etc).
Reviewed By: anietoro
Differential Revision: D1085607
The parser has a mechanism for creating a list of statements that are prepended to the next statement added to the main list of statements. This code is completely dead and serves only to confuse the reader.
Reviewed By: @jdelong
Differential Revision: D1093564
This doesn't return an uninit null, it casts the function
pointer 'uninit_null' to a bool, which then gets cast
to a Variant "true". Don't you just love PHP I mean C++.
Reviewed By: @jdelong
Differential Revision: D1093730
My previous attempt at this solved the specific problem I was looking
at but accidentally tightened up the assert in a place it shouldn't be
checking. This diff fixes that and improves the stacktrace file for one of the
failure cases.
Reviewed By: @ptarjan
Differential Revision: D1093847
Flip the switch and make FrozenSet a full-blown collection.
This wires up support for literal syntax, casting to bool,
and materialization and magic methods.
Reviewed By: @elgenie
Differential Revision: D1060075
We've been working around various issues (the win32 tests, many of the blacklists) where the tests were actually telling us in what cases they shouldn't be run.
Very few tests actually pass now but I think this is the right thing to do
Reviewed By: @alexmalyshev
Differential Revision: D983880
make_tv<KindOfNull>() creates a temporary TypedValue with uninitialized
m_data field. Using this temporary together with tvSet() results in a
warning, as the uninitialized value is assigned the destination's m_data
field.
Introduce tvSetNull() that avoids touching m_data.
Reviewed By: @jdelong
Differential Revision: D1090898
Instead of using the `_private` like zend does, I'll just have a thread local map on the side. I'm a bit worried that `_private` is used by other places so this seems safer and easier to reason about.
Reviewed By: @alexmalyshev
Differential Revision: D1071499
The thesis of this diff is to introduce implicit conversions between
vixl::CPURegister and PhysReg, the same way we have for the x64 register
classes.
- I removed the concept of "no register" from vixl. It overlaps with
"invalid register" and was kind of confusing.
- constexpr all the things
- Add the implicit constructor and conversion operator to PhysReg
I considered making the vixl abstractions mirror the asm-x64
abstractions exactly -- i.e. get rid of the class hierarchy -- but that
would be too disruptive. I think this is all we'll need to do.
I also haven't made implicit conversions between PhysReg and
vixl::FPRegister yet. We still need to sort out the way PhysReg
represents SIMD registers internally (changing the number of GP regs
isn't as simple as changing that constant) but that can be done in a
future diff.
Reviewed By: @edwinsmith
Differential Revision: D1091795
The perf tool won't lookup symbols for parts of the binary
that aren't file mapped, so provide a perf-pid.map file when we
do that.
Reviewed By: @bertmaher
Differential Revision: D1091918
I tried puling in the real `libgd` but it turns out php-src forked the library pretty hard and didn't contribute back. Instead I'll just pull in their fork.
This is a straight copy and then I fixed all the stupid C -> C++ stuff and wrote the `php_compat.h` to shim.
Reviewed By: @alexmalyshev
Differential Revision: D1083759
I went throught the tasks for the last few releases and put down some things. Can anyone else notice other big things in your releases? I still have to fill out all the OSS stuff in Mark's but they are all on stickeys at the office.
Reviewed By: @jdelong
Differential Revision: D1091115
I noticed some cases where CSE was missing opportunities because we
were first checking the CSE hashtable, then simplifying the
instruction (when missing in the CSE hashtable), and finally inserting
it into the CSE hashtable. For instructions that actually got
simplified, this ordering caused redudant instructions to miss in the
CSE hashtable. This diff fixes the problem by changing the order so
that instructions are first simplified, and then inserted in the
hashtable.
Reviewed By: @edwinsmith
Differential Revision: D1086429
I've seen this test fail a few times since the variance on the random number generator is pretty high. Add some wiggle room.
Reviewed By: @jdelong
Differential Revision: D1091124
Required changing the behavior of DirectoryIterator and
FilesystemIterator. DirectoryIterator should iterate through the base
names of files, but FilesystemIterator iterates through full
pathnames.
Fix a bug in RecursiveIteratorIterator along the way
Reviewed By: @ptarjan
Differential Revision: D1034196
We never defined the actual Reflection class, which just has two
static methods in it.
Appeases yii, which has a requirements check that determines whether
the Reflection extension is enabled by searching for this class.
Reviewed By: @ptarjan
Differential Revision: D1086615
Convert atomic_acquire_load and __sync_fetch_and_{and,or} on condition
flags to std::atomic<>.{load,fetch{and,or}}.
Reviewed By: @jdelong
Differential Revision: D1084266
Sometimes we end up with a DefLabel that defines a value with type
Cell, but only has one incoming value with an uncounted type. The Cell dest of
the label won't have any tracked references since it's always uncounted, so
recognize that situation and don't abort.
Reviewed By: @ptarjan
Differential Revision: D1090701
The code used to allow a read of the bit immediately past
the end of the buffer - and since both children should be nullptr
in that case, the value doesn't matter. But its still an illegal
read, and the ASAN build was catching it.
Reviewed By: @edwinsmith
Differential Revision: D1089631
DV initializers had some rules about fallthrough, jumps to
the main entry point, and a requirement that they each only be a basic
block. We violate these rules in array_filter.hhas and
array_map.hhas, and they currently don't seem to be needed. This
changes the spec so they are just alternative entry points based on
argument count, and updates hhbbc to not assume those things. We
still have a few reasonable rules about where the entry points can be
(they must be in the primary function body, and cannot be in the
middle of an FPI region).
Reviewed By: @edwinsmith
Differential Revision: D1088641
From what I can tell, nothing rules this out in the bytecode
spec. Wrote this to see if it actually worked, which it seems to.
Reviewed By: @edwinsmith
Differential Revision: D1010605
Member instructions are fairly unusual in that they can throw
with a state reflecting changes in the middle of their execution. The
normal model in HHBBC for PEIs (potentially exception-throwing
instructions) is to propagate the state before the instruction has
begun execution, so these need to be handled specially by explicitly
propagating the states before each dim.
Reviewed By: @edwinsmith
Differential Revision: D1088633
I feel bad, because I wrote this originally. perf showed that this code
was really hot, so I rewrote it much simpler. I also fixed some mistakes
in the register-convention constants provided by vixl. This seems a
little wtf, but what they had there before definitely doesn't agree with
the documentation, as well as the implementation of
vixl::CPURegList::GetCallerSaved.
Reviewed By: @jdelong
Differential Revision: D1087062
This reverts e5cdbb1a67f28f94d43c83ff2627fd3eff8b3646 which
reverted the original 5.6 client update based on the issue from 3340526.
With third-party patched with D1088527 fixing the double-close, this
diff restores 5.6 to fbcode.
Original 5.6 diff: D1058111
Reverted in: D1087701
MySQL fixed in: D1088426
third-party patched in: D1088527
Reviewed By: jicongrui
Differential Revision: D1088758
Create an Abi POD struct that encapsulates details about the
ABI that the register allocator needs to know. For now, it's
just what register are available to be allocated and which
ones are callee-saved registers.
Reviewed By: @jdelong
Differential Revision: D1088590
If there's no length, the result is treated as a
null-terminated string which means that null characters incorrectly stop
the output.
Closes#1322
Reviewed By: @ptarjan
Differential Revision: D1087212
Pulled By: @scannell
This started as a small diff to get `date.timezone` working and escalated to this.
I did it as a small change with just adding a get callback to the bind call and used it during the get. I debated having a side-index of everything that has been set so far and echo it back, but the setting might muck with the data before saving so I think this is more generic.
I think in a perfect world you could just register their name, type, and an optional validator, but that's for later when this gets cumbersome.
Reviewed By: @sgolemon
Differential Revision: D1088980
These fly completly in the face of the `function_exists` detection that you are supposed to use. The worse offender was a completly unimplement extension of image magic.
I ran `git grep` in `runtime/ext`
Reviewed By: @sgolemon
Differential Revision: D1088798
I was lying a little bit and not importing these tests since they have no chance of passing since our INI story sucks. I think we shouldn't be cheating with our numbers and instead should have these and be able to work towards them passing.
Reviewed By: @JoelMarcey
Differential Revision: D1082559
These were brought on by importing `fileinfo`. I ended up doing it natively in HHVM, but these bugfixes are still useful. The worst part is the preg stuff since our code diverged so much from zend I had to just copy theirs. Some day we hopefully can reconcile them.
Reviewed By: @paroski
Differential Revision: D1025745
If we've requested a warmup phase, we limit the number
of threads initially, and then allocate more after a suitable
warmup period.
We don't need to eagerly alloate them though - we can stick with the
existing code which only allocates as necessary.
Reviewed By: @jdelong
Differential Revision: D1087578
AsyncAwait pushes an HHBC "Cell" flavor, which corresponds to
the TInitCell type in HHBBC (it can't be KindOfUninit). Oops.
Reviewed By: aravind
Differential Revision: D1088391
The main change is that fault funclets now can be coverted by
protected regions. There were also some issues with having multiple
protected regions pointing to the same fault funclet, even though I'd
already updated the spec to make that legal. This diff also changes
things to find funclet handler extents using the same logic as the
verifier (relying on funclet bodies being contiguous), since it's
easier to do than forward propagating in RPO until you find an Unwind
now that there can be try/catch blocks inside the funclets.
Reviewed By: @edwinsmith
Differential Revision: D1088288
Instead of manually calling placement new or destructors with
smart_malloc and smart_free. Since these are type-aware, they also
can easily use smartMallocSize/smartFreeSize to make a smaller
allocation.
Reviewed By: @swtaarrs
Differential Revision: D1084270
These functions were a bit hard to understand, and both
contained a reference leak in cases involving magic getters. There
were also some behavioral differences from zend with protected
properties that are fixed. It's very tempting to try to template this
and combine the two functions---they're almost the same, but just
barely not quite, so I'm leaving them separate for now.
Reviewed By: @dariorussi
Differential Revision: D1084236
I think there are a couple others relating to dynamic
properties and magic methods, but this one is independent enough for
its own diff.
Reviewed By: @swtaarrs
Differential Revision: D1084106
Common idioms in php require magic methods to be allowed to
be entered recursively. This diff makes hhvm mostly match zend on the
behavior here: recursion is allowed until it hits the same magic
method for the same property on the same instance. For now there are
still some slight divergences in cases where there are also declared
protected properties with the same name (and we'll differ for now in
some cases where zend SEGVs).
There are a few things still here that look like bugs in some object
property reference counting (at least one case with setop of an object
prop seems to leak a reference). I've tasked them to look at later so
we can get this in, though. (They aren't all related to magic
methods.)
Reviewed By: @swtaarrs
Differential Revision: D1083309
This just needs to mask out the low bit the way normal
systemlib works. If you want to print the extension bytecodes, you
can set Eval.DumpBytecode=3.
Reviewed By: @markw65
Differential Revision: D1087356
Dragon has encountered an issue with double close()'s, which is
an issue in the underlyng libmysqlclient library.
This reverts commit 9e5a733ca19b8a199eb7742f90e6c80e46860d1d.
Reviewed By: @tudor
Differential Revision: D1087701
By default, zend source compatability remains disabled,
however you can now explicitly request compilation of the
infrastructure and the extensions it supports via:
cmake -DENABLE_ZEND_COMPAT=ON .
Note that CMake caches -D defines between runs, so a later call
without ENABLE_ZEND_COMPAT will still retain the option enabled.
Either explicitly set it to OFF, or delete CMakeCache.txt if
switching between the two.
Currently json_last_error and json_last_error_msg only return meaningful values after json_decode, which is confusing since the functions are defined and at first seem like they are fully implemented.
Reviewed By: @ptarjan
Differential Revision: D1078012
It's not the ARM part that kills us here, but the interp-everything
part. The inlining code fails in a couple of different ways if the
instruction that pushes the ActRec is interped. We don't really have a
way to cleanly bail out of inlining if we discover that it's impossible
below the IRTranslator level.
Rather than put in a bunch of effort to sort out that situation,
I'm opting to punt until we get proper ARM codegen for FPush* and FCall,
at which point we should be able to turn on inlining without trouble.
I've tasked it so we don't forget.
Reviewed By: @jdelong
Differential Revision: D1085589
When defining an enum it is useful to have the values cached in a static array given Enum don't change value
Reviewed By: @markw65
Differential Revision: D1086167
Make the "Run Test File" command for tests that don't have an expected status beter for frameworks that don't run in parallel. For those frameworks, the test run command does not contain the individual test. And currently we can't run the individual test that is not behaving as expected without jumping through a few manual hoops. Turns out there is access to the test name while we are running, even serially. Use it.
Reviewed By: @alexmalyshev
Differential Revision: D1085298
PDOStatements have a field for their PDOConnection. Turns out
PDOMySqlStatements have an extra field that stores their
PDOMySqlConnection, which they use instead. Synchronize the two,
as currently it's not possible to run pdo_handle_error without
hitting throw_null_pointer_exception().
Reviewed By: @ptarjan
Differential Revision: D1084318
This file gets created unconditionally, for stats logging, even if you
don't have logging turned on. This is annoying. I'm removing that code
from the simulator; if you want stats logging, it's easy enough to add
it yourself by creating vixl::Instrument and adding it as a decoder
visitor (like I do with PrintDisassembler in enterTC).
Reviewed By: @swtaarrs
Differential Revision: D1084658
While doing this, I made CodeCursor not depend on X64Assembler and moved
it into a different file.
Reviewed By: @jdelong
Differential Revision: D1083358
A measurable percentage of L1 dcache misses in production are
coming from lookups of the __clone function in ObjectData::cloneImpl.
If a decent number of them don't have custom __clone functions, we can
just check an o_attributes bit (which we just checked in ::clone, so
it should still be in dcache). (This diff doesn't avoid the redundant
load of o_attributes, though.)
Reviewed By: @ptarjan
Differential Revision: D1070758
--no-edit for pull requests was causing issues on Ubuntu 12.04 running the script.
Error was: error: unknown option `no-edit'
Took it out. Things ran fine. Pull requests still worked for doctrine and pear.
Reviewed By: @alexmalyshev
Differential Revision: D1084828
We don't have a php symlink to the hhvm executable in oss land. Create one so Pear can work correctly. Otherwise we will literally have 0% for Pear.
Reviewed By: @ptarjan
Differential Revision: D1084685
Mostly organizational frufaru
This moves us away from having multiple icu_* extensions
and closer to having a single 'intl' extension
similar to Zend. icu_ucnv and icu_uspoof will be
folded in when they are converted to HNI.
Future intl classes (DateFormatter) will be added here.
Reviewed By: @ptarjan
Differential Revision: D1083189
- Make it not fatal if the zend path don't contain a / in the end
- Better error message when using --only and it doesn't match any files
Reviewed By: @ptarjan
Differential Revision: D1083278
The previous version of this optimization was a bit too picky
about where it found the object input to the FPushCuf. This fixes it
up so it catches most of the hot cases in www.
Reviewed By: @swtaarrs
Differential Revision: D1054142
This means the ObjectData has a C++-level clone
implementation. Also clean up some duplicate specifications of the
template parameters for ExtObjectDataFlags.
Reviewed By: @edwinsmith
Differential Revision: D1070691
This allows us to stop translating gracefully once we've emitted a
certain amount of code to a. I also fixed the names of the RuntimeOption
members to match the config options they map to.
Reviewed By: @ottoni
Differential Revision: D1081564
Some of the work during lockdown exposed a few issues with the region
JIT enabled. Most of the issues were because jump optimizations was
mutating an instruction into another one with a different number of
dests, including SideExitJCCs and SideExitGuardLoc. These were fixed
by making these instructions have the similar dests as their
corresponding instructions. For the JCCs, ideally we should get rid
of their None dests. I tried that, but unfortunately it's not that
simple and will require changes to the simplifier at least. To
unblock work on the region JIT, I'm taking the simplest approach here
by making SideExitJCCs have a dest too, and I'll task cleaning up the
dests of all these instructions.
Reviewed By: @swtaarrs
Differential Revision: D1082383
The check for the hhvm runtime build in oss land was wrong. This attempts to fix that. Also, we have no "php" symlink to hhvm in oss world, so I removed that check.
Reviewed By: @sgolemon
Differential Revision: D1083192
The Pear folks have accepted my pull request. Use the pear git source again. We are actually losing 2.5% on Pear for some reason, but this is happening with the current hash (as shown in our graph) or with this new hash. So that is a wash. Use the newer hash.
Reviewed By: @alexmalyshev
Differential Revision: D1082918
The Intl extension is massive and is best
organized into multiple sub-extensions (icu_ucnv, icu_locale,
icu_num_fmt, icu_date_fmt, etc...).
Extending the loadSystemlib() helper to load from multiple
systemlibs allows us to follow this pattern in the intl module:
void moduleInit() override {
BindIntlFuncs();
loadSystemlib(); // loads intl's main mini-systemlib
BindLocaleFuncs();
loadSystemlib('icu_locale');
BindUCnvFuncs();
loadSystemlib('icu_ucnv');
// etc...
}
Reviewed By: @ptarjan
Differential Revision: D1081324
Now that lockdown is done we are at 50.77%. This is from the newest 5.5
branch. 18b7875fab791bb88d73df360fd91f1ace70c5b3 to be exact.
The following tests were added to the bad directory. All of them for 2
reasons. Some date format thing changed (years are now 2 digits) and
they now are setting a constant as case-insensitive which we emit a
warning for so it breaks the test.
* test/zend/bad/ext/date/tests/DateTime_format_basic2.php
* test/zend/bad/ext/date/tests/date_constants.php
* test/zend/bad/ext/date/tests/gmdate_variation13.php
* test/zend/bad/ext/standard/tests/file/file_get_contents_basic.php
* test/zend/bad/ext/standard/tests/file/file_get_contents_file_put_contents_basic.php
* test/zend/bad/ext/standard/tests/file/file_get_contents_file_put_contents_variation1.php
* test/zend/bad/ext/standard/tests/file/file_get_contents_file_put_contents_variation2.php
The following tests failed in repo mode, so I made them `.norepo`:
* test/zend/good/Zend/tests/bug47593.php
* test/zend/good/Zend/tests/bug60771.php
* test/zend/good/Zend/tests/error_reporting03.php
* test/zend/good/Zend/tests/error_reporting08.php
* test/zend/good/Zend/tests/halt_compiler2.php
* test/zend/good/ext/exif/tests/bug62523_1.php
* test/zend/good/ext/exif/tests/bug62523_2.php
* test/zend/good/ext/exif/tests/bug62523_3.php
* test/zend/good/ext/exif/tests/exif_encoding_crash.php
* test/zend/good/ext/sqlite3/tests/sqlite3_23_escape_string.php
* test/zend/good/ext/standard/tests/array/sizeof_variation4.php
* test/zend/good/ext/standard/tests/file/bug30362.php
* test/zend/good/ext/standard/tests/file/readfile_variation6.php
* test/zend/good/ext/standard/tests/streams/stream_resolve_include_path.php
* test/zend/good/ext/standard/tests/strings/wordwrap.php
* test/zend/good/ext/standard/tests/url/parse_url_basic_001.php
* test/zend/good/ext/zlib/tests/gzcompress_variation1.php
* test/zend/good/ext/zlib/tests/gzdeflate_basic1.php
* test/zend/good/ext/zlib/tests/gzdeflate_variation1.php
* test/zend/good/ext/zlib/tests/gzencode_variation1-win32.php
* test/zend/good/ext/zlib/tests/gzencode_variation1.php
* test/zend/good/ext/zlib/tests/gzuncompress_basic1.php
* test/zend/good/tests/classes/unset_properties.php
* test/zend/good/tests/lang/include_variation3.php
Reviewed By: @JoelMarcey
Differential Revision: D1081723
I hope they accept my pull request, but for now let's just use my repo.
https://github.com/phpbb/phpbb/pull/1908
Reviewed By: @alexmalyshev
Differential Revision: D1081325
With the introduction of FrozenSet in D1060075, we ran out of bits
in o_attributes to represent new collection types.
This diff changes things so that we only store a 1-bit attribute
IsCollection in o_attributes, indicating (suprise suprise) whether
a particular ObjectData is a collection or not.
If IsCollection is set, then the precise collection type
(which remains an element of Collection::Type) can be found in
o_subclassData.u16.
Reviewed By: @paroski
Differential Revision: D1070558
There were two problems with Set::map():
* the return type of the callback was not being checked, so we could
end up with a Set of a type other than int or string.
* we also weren't checking for duplicates -- so, for instance, calling
map with a constant function (constant in the mathematical sense)
would give us back a set with repeated elements.
Fix the two points above by making Set::map() use the regular add()
operation (which automagically takes care of everything).
Reviewed By: @paroski
Differential Revision: D1069261
All callers of getPostData use the size arg correctly. I tried searching the git history for why this was ever done, and it goes back to before when hphp was moved from svn to git in 2008.
Reviewed By: @markw65
Differential Revision: D1073159
Pipe::closeImpl did not have a good check for whether the pipe needed
closing. Fix that, and add the warning that zend prints on invalid args
to popen()
Closes#1313
Reviewed By: @scannell
Differential Revision: D1079485
In the interest of maintaining by sanity by getting automated testing
for ARM mode set up ASAP, I'm putting off (and tasking) figuring out
what's going on with strtotime_leak.php in ARM mode. I added something
to $_ENV that allows PHP code to check what arch it's running as, and
we'll skip strtotime_leak.php if we're in ARM mode.
As part of this, I pulled arch() into its own header file to avoid
including translator-inline.h from the files where the env vars are set
up (it didn't seem right).
Reviewed By: @jdelong
Differential Revision: D1080752
quick, slow, and zend/good almost all pass with this diff, after a bunch of
lockdown breakage. I say "almost" because strtotime_leak.php still
fails. I believe that's a consequence of interp'ing everything, although
there may be a real memory leak there. I'll deal with that in an
upcoming diff.
- Since InterpOne has catch traces now, we can't punt on BeginCatch and
EndCatch anymore. It seems that for the time being, we can skate by
without actually implementing catch traces, though. The stack is
always spilled before InterpOne, and because everything is InterpOne'd
we're not actually holding anything in registers (so we don't need to
restore them).
- NewStructArray wasn't accounted for in all places in translator.cpp.
- I reduced the amount of work that mixedbag.php does, so that it
completes in a reasonable amount of time in ARM mode. It's still
executing all the same code, just fewer times.
Reviewed By: @jdelong
Differential Revision: D1080648
It's arguable that maybe OA,LA would be a nicer order, but
all the other opcodes that have both subops and a LA take them in the
LA,OA order. (In general, it appears OA always comes last unless
there is an MA, right now.) Also remove unused isTypePred thing.
Reviewed By: @swtaarrs
Differential Revision: D1079371
Also name the types more like other type names (in both
JIT::Type and HHBBC) for macro-friendliness, and remove default cases
from switches so we'll find places that need to be updated when we add
new cases to the enum.
Reviewed By: aravind
Differential Revision: D1079271
This uses @ircmaxell's password_compat library to implement the
password extension on top of the underlying crypt functions.
Closes#992Closes#1303
Reviewed By: @ptarjan
Differential Revision: D1078315
Pulled By: @scannell
Move PageletTransport definition in pagelet-server.h and create PageletServerTaskEvent to be used for integration with Asio.
Reviewed By: @jano
Differential Revision: D1069174
So it turns out ReflectionParameter::__construct(string, string) can
also be written as ReflectionParameter::__construct(array, string) and
the now supported ReflectionParameter::__construct(array, int).
Reviewed By: @ptarjan
Differential Revision: D1068773
I originally wrote a hacky str_getcsv with that used fgetcsv() + temp
files in PHP to stop fatals in open source land. This fixes the perf
issues with the old implementation by not using files at all.
Closes#1079
Reviewed By: @scannell
Differential Revision: D999569
In sandbox mode, files change, and we could translate
potentially unlimited numbers of functions into ahot.
Reviewed By: @swtaarrs
Differential Revision: D1079214
In some cases, we can statically prove that an FCall will
go to a particular method. But that might depend on the fact that
the FPush* would fatal. eg we know that an object is of class Foo,
or is null. The FPushObjMethodD will fatal if its null, so the
FCall is known to call Foo::method (or an override).
But if we try to inline the FCall bad things will happen if the
FPush* was interped. So don't do that.
Reviewed By: @swtaarrs
Differential Revision: D1078789
Fix crash due to maybePop() call reading garbage out of the freelist the first time it is accessed.
Closes#1300
Reviewed By: @jdelong
Differential Revision: D1078982
Some of these may actually be hot, and they're small enough that
putting them in 'a' shouldn't hurt.
Reviewed By: @jdelong
Differential Revision: D1069482
Some of the logic in the Vector implementation was unnecessarily calling
into smart_malloc() to allocate 0 bytes, which is wasteful. This diff fixes
the issue appropriately.
Reviewed By: anietoro
Differential Revision: D1079298
Users are supposed to be able to override idx with
their own version - but that doesn't work if we translate it
during bytecode emission.
We don't really have a good way of knowing whether its been
overridden, however, so use JitEnableRenameFunctions as we
have for other, similar cases.
Reviewed By: @dariorussi
Differential Revision: D1078332
Due to the interdependencies between libraries, converting
portions of the codebase to the 5.6 client independently is not an
option. This diff moves all of fbcode to 5.6 as well as updates the
async_mysql client to the newer, slightly modified async api.
This diff brings with it the new features in the 5.6 client, most
notably ipv6 support. It also adds ipv6 support to the php mysql
connect api in the form of '[addr]:port' in addition to the previous
'host:port' syntax for ipv4 addresses.
Reviewed By: agallagher
Differential Revision: D1058111
This was causing a hilarious failure mode in debug builds where
unzipping this data would return the compressed data, because the flags
argument was 0x7a7a7a..., meaning the zip library thought the
FL_COMPRESSED flag (meaning return the compressed data) was set.
The problem was only showing up in interp mode, because I guess interp
mode passes arguments to native functions differently such that it was
picking up dead stack cells. Also, the test wasn't catching it because
both calls returned the same incorrect thing. I edited the test to be
more robust (and fix a variable-name type while I'm at it).
Reviewed By: ptarjan
Differential Revision: D1070357
VGetL has an effect on the local: it gets boxed. This was causing us
trouble in interp-everything mode when a local got boxed by being passed
by ref to a builtin and then consumed. (The builtin means the tracelet
won't be broken in between.) This was failing an ext_openssl test.
It hurts to be messing with this old code, especially since we've gotten
this far with this bug always present and it hasn't given us any
trouble. When can we kill it?
Reviewed By: @edwinsmith
Differential Revision: D1071404
pmethodCacheMissPath smashes code under the write lease,
but there's nothing to prevent two threads going through it in
sequence - resulting in a double free of the pdata.
Check to see if the code has already been smashed, and bail out if
it has.
Reviewed By: @edwinsmith
Differential Revision: D1078180
This reverts commit 9ee6e1013b786b280090a052861e708e7c3fe4c0.
I was not having a good day. The crashes were caused by generating
the bytecode with one version of hhvm, and running it with another
(using HHVM_REPO_SCHEMA to shoot myself in the foot), while trying
to debug the asio issue.
Reviewed By: @dariorussi
Differential Revision: D1078072
This reverts commit f5f2fc6faa38098ce95dd509f3b33891ed7b4746.
My base rev was broken when I was testing this - there wasn't really
a problem with the RefcoutOpts.
Reviewed By: @edwinsmith
Differential Revision: D1078057
Socket and SSLSocket are allocated via ::operator new,
so they need to take care of freeing their own memory when they
are swept.
This was showing up as a gradual leak if Socket's were held until
the end of the request.
Reviewed By: @andralex
Differential Revision: D1077472
Summary: sbrk() has no equivalent how we use it and we use finite() for
parity with the reference implementation so these are not helpful
warnings.
Reviewed By: @sgolemon
Updates array_filter() to support collections, and removes the old C++
implementation of array_filter() which is no longer used. This diff also
updates "foreach ($x as $k => $v)" for Set and FrozenSet so that the
current value is assigned into both $k and $v.
Reviewed By: @dariorussi
Differential Revision: D1071459
Finally logic is handled by a new component: FinallyRouter.
The approach taken essentially constructs a simple finite
state automaton that decides which action to take next, once
the control reaches the end of a finally block. The
automaton uses an unnamed local variable "state". It also
uses an additional unnamed local to stash result between the
point of actually returning from a function and invoking
return. In order to minimize perf impact, two copies of
finally blocka are in fact emitted. The first copy ends with
a switch statement and is part of the automaton. The second
copy handles exceptional situations exclusively and ends
with Unwind. When multiple nested finallies exist, multiple
copies of a fault funclet corresponding to the inner finally
will be emitted in order to correctly handle chaining.
Exception chaining is handled using an extended set of
members in Fault (m_raiseLevel, m_raiseFrame,
m_raiseNesting). These values are used to decide whether two
exceptions stored on the top of the m_faults stack should be
chained already, or not yet. Additionally, changes have been
made to grammar files and AST in order to give the emitter
more information about the scope of goto labels. This is
used in order to handle goto from try finally block
correctly. No jumps into try finally are allowed, since
reference implementation (Zend) fatals in this case.
Reviewed By: @paroski
Differential Revision: D1058497
ReflectionMethod will support method getPrototype().
**Please note I added an extra field "originalClass" to class ReflectionMethod because the exception message in ReflectionMethod::getPrototype() needs the original class name. (To be compatible with Zend)**
For example:
class Base { public function test() {} }
class Child extends Base {}
$rf=ReflectionMethod('Child', 'test')
Then $rf->class will be "Base" while $rf->originalClass will be "Child".
The implementation for Func* is coming from https://github.com/php/php-src/blob/0d7a6388663b76ebed6585ac92dfca5ef65fa7af/ext/reflection/php_reflection.c (using Func->baseCls). The difference is that we need to deal with interfaces because Func->baseCls didn't consider interfaces.
For builtin classes, because MethodInfo* doesn't contain baseCls information, so we need to implement the logic from scratch.
Reviewed By: @ptarjan
Differential Revision: D1048239
This demonstrates that the 'next-int-key' state of the array
is not modified by unset, even for the last element.
(php 5.3 and 5.5 do the same thing).
Reviewed By: @ptarjan
Differential Revision: D1074810
Generators that aren't closures still need to subtract
one pointer's worth from the Func* to get the address of the memory
to free.
Reviewed By: @jano
Differential Revision: D1075816
Updates the C++ impl of array_map() to support collections, and updates
array_map.hhas to call the C++ impl when the second parameter is not an
array.
Reviewed By: @dariorussi
Differential Revision: D1071632
Updates call_user_func_array() to support collections for the second
parameter. Also update call_user_method_array(), hphp_create_object(),
hphp_invoke(), and hphp_invoke_method() to support collections.
In the course of implementing this, I fixed a bug with invokeFunc where it
would pass along the arg array to __call() and __callStatic() methods
without checking to make sure the arg array had integers keys 0 thru n-1.
Reviewed By: @dariorussi
Differential Revision: D1071732
PHP 5.4 added support for "C::{<expr>}()" style method calls. This diff
updates HHVM to support them as well.
Closes#1292https://github.com/facebook/hhvm/issues/1292
Reviewed By: @scannell
Differential Revision: D1071647
This is phase 1 (the biggest) of a refactoring of the test script. I have broken run.php into 3 areas of focus: the original run.php, the test finder, and other utils.
You can now run the script with the --byfile or --bysingletest option. The --byfile options lets you run the tests by test file name. This is faster. The --bysingletest options lets you run the tests by each single individual test of a framework. This is slower, but let's us support a good --filter option down the road.
Reviewed By: @ptarjan
Differential Revision: D1073658
The Server::stop() API claims to be asynchronous, but bad things happen if Server::stop() does not synchronously stop the VM as LibEventServer does. Essentially the main thread can exit and leave the VM threads flapping in the breeze. Call waitForEnd() on the servers before exiting.
Reviewed By: @markw65
Differential Revision: D1056280
The AST classes now have an additional visitor that can serialize the AST in the format expected by the unserialize function. The concrete classes to be produced by the unserialize function can be controlled by passing in a prefix argument to the visitor.
Facebook only:
Also added is an extension function fb_serialize_code_model_for(codeobject, prefix) that takes a string as its first argument, prefixes it with "<?php " and then parses it as if it were an eval string and then returns the serialized AST.
Reviewed By: @paroski
Differential Revision: D1027004
Workaround for #3235411. These changes are needed so we
can shrink ObjectData without crashing entirely.
Reviewed By: @ptarjan
Differential Revision: D1072781
We can make bstrcaseeq a little bit faster by:
- Bailing out early if the pointers are equal
- Using an 8x unrolled case-sensitive comparison (with 8-byte
compares) to speed the common case where the strings are the same
including case
- Using the original version of bstrcaseeq to implement bstrcasestr,
since there the common case is *not* equal strings.
Reviewed By: @jdelong
Differential Revision: D1069607
Make WaitHandle, StaticResultWaitHandle and StaticExceptionWaitHandle
non-virtual. Move the virtual barrier to WaitableWaitHandle.
Reviewed By: @jdelong
Differential Revision: D1070819
It's a waste of memory to put the serialized array string in
the static string table, because we only need it when loading
or storing units in the HHBC repo.
Reviewed By: @jdelong
Differential Revision: D1070745
Many arrays are created with name/value pair syntax, with all
static string names and no repeat keys; aka "struct-like". This
diff adds a new opcode to support that pattern.
Reviewed By: @jdelong
Differential Revision: D947681
Do not use emit StaticResultWaitHandle::create() extension call for
every return from eagerly executed async function. Instead, use
AsyncWrapResult opcode that takes care of wrapping the result into
StaticResultWaitHandle object and returning it to the caller.
Reviewed By: @jdelong
Differential Revision: D1045994
preg_replace /e was failing for $this->foo() style replacements. We were returning $this is null. That was wrong.
Reviewed By: @ptarjan
Differential Revision: D1069658
@dariorussi brought this up on the other ctor diff. I think it is a big enough change to do on its own.
Reviewed By: @dariorussi
Differential Revision: D1070445
@paroski made the change that moved the size of
collections to a fixed offset, but didn't go further to actually take
advantage of that with an assembly version of ##isCollection()##.
Reviewed By: @oyamauchi
Differential Revision: D1067752
CreateAsync opcode creates a Continuation object that is wrapped into
AsyncFunctionWaitHandle object by ->getWaitHandle() call. Let's merge
these operations into AsyncESuspend that produces
AsyncFunctionWaitHandle and kill Awaitable/getWaitHandle() API from
Continuations.
AsyncFunctionWaitHandle internally still uses Continuations.
Partially based on Mirek Klimos's summer internship work.
Reviewed By: @jdelong
Differential Revision: D1069759
m_origFunc is used only to obtain a name of the enclosing function and a
number of original arguments to locate Closure object (which stores
static locals).
If a Func is a generator, allocate extra pointer size to store a pointer
to the original function. Populate this pointer from getGeneratorFunc()
(i.e. when Create{Async,Cont} is interpreted or compiled).
Reviewed By: @jdelong
Differential Revision: D1067622
Right now we don't clean up the YY_BUFFER_STATE created by the Bison parser after we scan a string -- we simply ignore the return of yy_scan_string and it never gets cleaned up (since yy_switch_buffer on a subsequent call won't delete anything.) Fix that.
Closes#733
Reviewed By: @elgenie
Differential Revision: D1069986
A good chunk of the calls to hash_string_i in production are
coming from looking up classes while converting APCObjects into
ObjectData. If the Classes are persistent, we can have them already
looked up. We can also avoid creating an array just to call
o_setArray.
Reviewed By: @dariorussi
Differential Revision: D1067486
Most of the time when we go to the cold path, it's because
we're iterating an APCLocalArray. Add a specialized version for that.
We were also always going to cold by first going to a function that
checked for various collection types (with very big code)---change
this to a quick check at the front of iter_next_cold that then tail
calls to a function that code collection dispatch on the already
loaded type (compiles as a jump table). We also bailed for releasing
the array which is easy enough to handle.
Reviewed By: @bertmaher
Differential Revision: D1067317
Our vendor/bin/phpunit did not contain our PHP_BINARY fix. So I updated composer to get that version, with a hack to make sure that your runs actually get the latest too. I will remove that Hack later and come up with a better way.
Plus I fixed Symfony to support HHVM (PHP_BINARY) too: https://github.com/JoelMarcey/symfony/commit/eba220f998ed994900e0324d1a8dd54b9656ae37
Symfony is above 97% now.
I will upstream that.
The nothing to do errors are gone from yii now, but didn't help the percentage that much. I updated to their latest master hash anyway.
Reviewed By: @alexmalyshev
Differential Revision: D1070555
When async functions and continuations are used with closures inside
methods, their generator body needs to be cloned into the enclosing
class. This is currently done in run time, but there is nothing
preventing us to do it in compile time, so let's do it.
Reviewed By: @jdelong
Differential Revision: D1067501
Bind inner and outer generator functions, do not pass the name of inner
function thru CreateCont/CreateAsync immediates.
Reviewed By: @jdelong
Differential Revision: D1067483
Changed FastCGI behaviour to close the connection when an
invalid record has been received instead of aborting.
Reviewed By: @ptarjan
Differential Revision: D1061545
We were double adding the statics, which resulted in
an assert in dbg builds, and random crashes in release.
Reviewed By: @jdelong
Differential Revision: D1070112
This diff adds PredictTL and PredictTStk, which are similar to
AssertTL and AssertTStk but for predictions instead of known types. They're
mostly intended for debugging right now, to help reproduce issues that depend
on certain type predictions being present. In the future we could start
emitting them instead of metadata entries.
Reviewed By: @jdelong
Differential Revision: D1069999
If a method doesn't exist in an interface, then we need to check
all interfaces that it inherits from as well.
Reviewed By: @JoelMarcey
Differential Revision: D1068583
Zend PHP does not count in sleeping time into scripts time
limit, HHVM does. Change that for parity reasons.
Closes#1279Closes#1287
Reviewed By: @markw65
Differential Revision: D1066797
Every APC object (aka shared object) now has an APCHandle field used by the concurrent storage. No indirection any longer from APCVariant to the object data (string, object, array)
Reviewed By: @jdelong
Differential Revision: D1023419
This is how zend does it. They shove the container object into the _private part of the dom node and then re-use it. A test in drupal depends on this and it seems correct for the elements to `===` the same if they really have the same underlying node.
Does this introduce a memory leak? I'm not increffing anything so I think the smart pointer wrapping the `ObjectData*` is keeping the `ObjectData*` alive at all times already, this is just a cache of the pointer.
Reviewed By: @markw65
Differential Revision: D1065371
Revert "re-use c_DOMNode for xmlNodePtr"
This reverts the important part of commit 7f8617bd2895e9a802f0efd219390e9b40a8b41d.
I originally thought that the use of `_private` was a problem so I tried using a thread-local map but that didn't do anything.
While I figure out how to do this properly, just revert so our graphs aren't 22%.
Reviewed By: @JoelMarcey
Differential Revision: D1073217
The refcounting optimization now understands the flow of values throw
SpillFrames while inlining. This diff is aimed at fixing correctness issues;
there may be more opportunities for optimization we're missing around inlined
calls.
Reviewed By: @ottoni
Differential Revision: D1063557
Differential Revision: D1075908
The code to eliminate unused inline frames was broken for a few
superficial reasons. Once I fixed those, I found and fixed a few larger issues,
mostly having to do with stack offsets for ReDefSP and DecRef (see the code for
details in comments). Unfortunately I'm going to have to check this in disabled
for now since there's at least one crash remaining and I need to move onto
other things for the moment.
check.cpp now enforces that any instruction that can throw must have a catch
block attached, since a number of optimizations rely on that for
correctness. This exposed a number of old issues, the biggest of which was that
LdClsMethodCache and LdClsMethodFCache had a taken label for a slow exit and
can also throw. Since they need a catch trace to be able to throw correctly, I
split them up into smaller instructions to expose more of the control flow at
the IR level.
Reviewed By: @jdelong
Differential Revision: D1060374
... I'd argue that this should be the default
and tests that depend on not having notices should not work
Reviewed By: @ptarjan
Differential Revision: D1069033
Some tests need some additional includes in order to be run as a single test file. Added them. https://github.com/phpbb/phpbb/pull/1888
Reviewed By: @ptarjan
Differential Revision: D1069949
The fakeAR thing isn't necessary now that we have a special fixup
implementation for simulator mode. Combined with @markw65' changes to
functionEnterHelper etc., everything's pretty clean, and function
interception works properly (it didn't before lockdown).
Reviewed By: @edwinsmith
Differential Revision: D1069589
We were failing many tests in phpbb3 because there was globals clowniness when trying to run their tests with filenames. I sent a pull request up to fix that. In the meantime, use my fork.
Reviewed By: @elgenie
Differential Revision: D1069881
The error handler takes an arbitrary "context" pointer.
In our handler, if the pointer is not null, we assume its an
xmlParserCtxtPtr, but there were a few places where we passed
in a different type.
Just pass in nullptr instead.
Reviewed By: @edwinsmith
Differential Revision: D1069579
To avoid the dreaded "Nothing to do" error, we need PHPUnit to check for our PHP_BINARY env variable. We had that pull requested accepted by PHPUnit. Now the framework vendor dirs need that version. Start with zf2.
Reviewed By: @ptarjan
Differential Revision: D1069559
- At some point, the order of arguments to InterpOne got switched
around for no apparent reason in the refcount optimization diff.
- My fix to poly-torture.php got accidentally pseudo-reverted, also in
the refcount optimization diff.
- The type effects of an interped PushL wasn't accounted for properly.
There are still a few more quick tests that crash. Based on their file
names, I think it's all a single root cause. I'll look at those next.
Reviewed By: @jdelong
Differential Revision: D1068766
This is a bit flakey since the 1 second boundary can tick inbetween the `null` and `"now"` case. That isn't even the main point of this test.
Reviewed By: @markw65
Differential Revision: D1069019
This splits HHProf (heap profiling) into two different knobs --
one is compile time, because of the overhead in the memory-manager smart
malloc functions, and the other is a runtime option that controls actual
tracking of data. This gets us the ability to have no impact when
compiling without the flag and minimal impact (within 1%) of impact when
compiling with the flag but with the runtime option turned off.
Reviewed By: @mikemag
Differential Revision: D1068213
Without this we hapilly put the `cwd` infront and open a directory. mediawiki has a test failing because of it. This felt like the best place to put it.
Reviewed By: @alexmalyshev
Differential Revision: D1067777
Adds a CheckExistenceBeforeRewrite option to allow rewrite rules to take effect even on files that exist on the default path. This option is off by default.
Closes#1283Closes#1286
Reviewed By: @ptarjan
Differential Revision: D1065548
Pulled By: @scannell
Zend orders their properties with child first then parent. We were doing the opposite. Fix that by rearranging the array in php land in reflection.php
Reviewed By: @ptarjan
Differential Revision: D1064961
While working on something else, I got bitten by this: if you construct
a String from a char, the char gets promoted to int and that constructor
won't do what you want (it stringifies the int).
To my great joy, this exposed some actual latent bugs, so I fixed them.
E.g. the things that thought they were appending a slash were actually
appending the string "47".
Reviewed By: @swtaarrs
Differential Revision: D1067258
The magic methods for Pair were missing from the IDL, and so were
not visible from PHP-land.
Add them to the IDL.
Reviewed By: @elgenie
Differential Revision: D1066776
Composer needs these functions all of a sudden. I couldn't figure out what they should do from the docs, and looking at the code they look to be identical to the gz versions except they don't force Gzip. Our versions of the gz fucntions don't force GZ anyways so I'll just proxy.
Reviewed By: @alexmalyshev
Differential Revision: D1067316
A Gen{Array,Map,Vector}WaitHandle from an outer context may be woken up
and may establish a dependency on a WaitableWaitHandle from an inner
context. Fix the assert.
Reviewed By: @swtaarrs
Differential Revision: D1067182
BlockableWaitHandle::blockOn() may throw when cross-context cycle is
detected while wait handle enters context. Move this responsibility to
the caller:
- AsyncFunctionWaitHandle and SetResultToRefWaitHandle now perform the check before construction
- the cross-context cycle exception is now catchable from async functions
Related cleanups:
- blockOn & co. are now inlined
- enterContext's likely case is now inlined
Future work:
- maintain parent_context_idx <= child_context_idx invariant for all
children of Gen{Array,Vector,Map}WaitHandles, so that enterContext()
is not needed when collection wait handles are unblocked; once done,
enterContext() calls will occur only on user action (construction of
WaitHandle and await) and the logic could be simplified
Reviewed By: @jdelong
Differential Revision: D1064798
I kept these separate when strings were first moved from the
old SmartAllocatorImpl stuff into here because combining them
increased stores too much. Now that almost all of the heap is going
through the smartMallocSize api, it seems ok to combine them. Perflab
showed stores very slightly up (red only on a few endpoints), d-TLB
misses possibly slightly down, d-cache misses down, cpu time in the
noise.
Reviewed By: @edwinsmith
Differential Revision: D1062598
Some of the data sets for these tests fail in Zend as well.
We are getting rid of them all since we clown by file, but in this case that is ok, I think.
We move to 99.88%
Reviewed By: @ptarjan
Differential Revision: D1065351
These tests all fail in zend with the same error `Creating default object from empty value`.
Reviewed By: @alexmalyshev
Differential Revision: D1065442
Add a c_FrozenSet class that inherits from BaseSet and exposes an immutable
interface to PHP-land (it implements ConstSet).
We can foreach over it, but literal syntax doesn't work yet, since it's
not a collection (will make it so in another diff).
Reviewed By: @paroski
Differential Revision: D1051520
In zend `DateTime` can be serialized. I could try to match their format but as long as we are consistent with ourselves I think this is ok.
Putting that attribute check seems pretty hacky but I couldn't think of a better way.
Reviewed By: @mikemag
Differential Revision: D1063231
Sigh. The script was not printing fatals to the stats file and thus they were not being counted in the percentage.
Reviewed By: @ptarjan
Differential Revision: D1065312
Use the initial profiling, interpreted requests to detect hot
functions. Marking them as hot hints the JIT to put them in the ahot
TC area.
Reviewed By: @edwinsmith
Differential Revision: D1063581
It looks like curl is unhappy when passed a user:pass to `curl_setopt(CURL_URL)`. Lets remove it before we get there.
I could have used `parse_url` and then put it back together, but the regex seemed simple enough... (famous last words)...
Reviewed By: @sgolemon
Differential Revision: D1064319
This test uses `debug_backtrace()[0]['args']` to get the args, so we need to keep them around. If we set this always it is a 5% perf regression so only doing it specifically for this test.
Reviewed By: @JoelMarcey
Differential Revision: D1064678
We were moving the immediate to a register and then to
memory; we can save an instruction by storing directly to memory.
Reviewed By: @jdelong
Differential Revision: D1064108
Also, only do one pass over the array, instead of two.
Perflab things it cuts on instructions a very tiny bit, and cuts
branch misses (less than a percent.) This is adding a place that
assumes packed and mixed arrays have the same value layout---do we
think it's worth that? (We can always rip it out later, and maybe
GenArrayWaitHandle will become less important if people soon use
Map/Vector WaitHandle instead?)
Reviewed By: @jano
Differential Revision: D1061039
Some platforms (MacOS) don't allow section names
longer than 16 characters. Use "ext." plus the first
twelve hexits of md5($extname) instead.
This diff also adds an objdump wrapper for checking for
and dumping the contents of mini-systemlib sections.
Reviewed By: @scannell
Differential Revision: D1061643
Destructor timing makes this test just everso-slighty
nondeterministic. (I occaisionally see it kick in between the
last two tests rather than before them).
Move the close to the end and it'll always happen in the right order.
Also change expectf "finalised" to "finali%ced" to
account for libsqlit3's switch from Brittish English to American English.
Or maybe it was the other way around. Either way... Ugh.
Reviewed By: @ptarjan
Differential Revision: D1065633
Unlikely case: if we called the wrong Func, the target Func
was in low memory but the actual Func wasn't, and the guard and
actually-called Func have the same low 32-bits, it would pass the
guard. While here, also change a few assembler calls to use the new
api.
Reviewed By: @edwinsmith
Differential Revision: D1060995
We have to know nothing mutated the array on the other side
of the SSATmp representing the array.
Reviewed By: @markw65
Differential Revision: D1060861
For LdFuncCachedSafe, if it returns null, we can't cache it
without knowing if something inbetween defined the func. The other
ones might work but are too dubious for now.
Reviewed By: @edwinsmith
Differential Revision: D1060858
1. Restructure c_Continuation to put the Continuation object
after the ActRec.
2. Cache the entry TCA for the continuation function in the
Continuation object.
Reviewed By: @jdelong
Differential Revision: D1055946
Move the responsibility for cycle detection from blockOn() to its
caller. Do not detect cycles when the parent wait handle is being
creates, as it's impossible for new cycle to be introduced that way.
Also, it was previously not possible to catch a cycle exception by
adding try/catch around the await. Fix it.
Reviewed By: @jdelong
Differential Revision: D1062770
Eager execution semantics guarantees that "await" can reenter ext_asio
only with blocked WaitableWaitHandle. Also, an AsyncFunctionWaitHandle
is constructed only when blocked WaitableWaitHandle is encountered.
Take advantage of that, kill all dead code and simplify the rest.
Reviewed By: @jdelong
Differential Revision: D1062521
The SQL queries can have UDFs in them, which causes havoc with the JIT
if we haven't sync'd our registers beforehand.
Reviewed By: @jdelong
Differential Revision: D1060223
This reverts commit 83c970e1d8c01fd6e20c2cdb32d6a047c79edc4d.
Reverting this will allow us to run old revisions of www in perflab. I can
bring this diff back in a few weeks.
Reviewed By: @jdelong
Differential Revision: D1062203
array_slice(func_get_args(), N) ends up making array copies that are unnecessary. Provide a new library function to deal with this pattern.
Reviewed By: @markw65
Differential Revision: D1057678
Add support for reading /etc/hhvm/config.hdf as a fallback if no configuration file is specified on the commandline.
Closes#1251Closes#1275
Reviewed By: @edwinsmith
Differential Revision: D1061239
Pulled By: @scannell
When we know the object properties at jit time we can just
emit stores inline to do initialization, instead of calling memcpy.
Reviewed By: @markw65
Differential Revision: D1063044
This patch standardizes that we always collect user+sys stats,
not just user stats.
Having fewer counter flavors is a prerequisite for one-day
sharing counters in the kernel.
Short-term this patch will change perflab behavior to start to count
kernel instructions.
Other tools such as perf and dynolog already collect user+sys stats.
Reviewed By: @markw65
Differential Revision: D1059681
Make BaseExecutionContext::recordLastError() virtual since
file/line number information is only accessible in VMExecutionContext.
Closes#1260Closes#1281
Reviewed By: @alexmalyshev
Differential Revision: D1061728
Pulled By: @scannell
The support for LLC and dTLB more precise events don't work in perf
anymore, so update them to use the more generic (but less accurate)
events. While here, I added support for more events in tc-print:
iTLB, L1I, and L1D misses.
Ths diff also fixes a couple of issues in Func to deal with the fact
that a tx64 object is not created in tc-print anymore. These issues
were introduced when we got rid of Translator::Get() and company
recently, and they were seg-faulting tc-print.
Reviewed By: @bertmaher
Differential Revision: D1062649
Instead of some sort of brute force, best effort way to get the test files, use the phpunit xml provided by each framework (if there is one).
Record the expect files again with this new information.
(Also, fixed a minor bug where Incomplete tests were not being put in the errors file)
Reviewed By: @alexmalyshev
Differential Revision: D1062413
Our ZipFile implementation was not matching Zend, particuarly in tell() and seek(). This reared its ugly head with the Pear test suite. So, I tried to fix this, using PlainFile as a model.
Reviewed By: @ptarjan
Differential Revision: D1061351
As a first step in implementing FrozenSet, move *all* the functionality in
c_Set to an abstract BaseSet class. c_Set and c_FrozenSet can then both
inherit from BaseSet, except that they expose different PHP "interfaces"
(i.e. FrozenSet doesn't have any of the mutable methods).
Reviewed By: @paroski
Differential Revision: D1050796
MADV_HUGEPAGE only works on anonymous, privately mapped
memory. So re-map the hot part of the binary, and mark it huge.
Reviewed By: @edwinsmith
Differential Revision: D1061057
Fixing support for KEEP_CONN = false. The connection is now
closed *after* the currently server request is responded to.
Reviewed By: @scannell
Differential Revision: D1057616
The logic for await expr is:
- check if expr is null, if so return null
- if expr is not a WaitHandle, call getWaitHandle
- if the wait handle is finished, either pull out its result or
throw its exception
- else if it's unfinished, either suspend the continuation or if
we're eagerly executing the async function, wrap it in a result
wait handle and create an async function that will continue here.
This diff changes the null check to not do reference counting (use an
unnamed local instead of Dup), and makes an opcode to speed up the
logic in the second part, by removing function calls and reference
counting due to another Dup.
Reviewed By: @jano
Differential Revision: D1058415
This diff replaces the old DCE-based refcount optimization with one
based on an algorithm we trust a lot more. Both optimizations rely on each
produced reference being consumed exactly once, and this new pass verifies that
fact as it goes along. This caught a number of leaks and other refcounting bugs.
I tried to heavily document the code itself, so for an overview of the
optimization start at the optimizeRefcounts function in refcount-opts.cpp. A
few notes about changes not contained to refcount-opts.cpp:
- IncRef no longer produces a new SSATmp. This allows us to generate IR in more
straightforward ways without worrying about which IncRefs chain to which
DecRefs.
- All refcounting instructions are now marked Essential. DCE will leave them
alone, and only optimizeRefcounts will move or remove them.
- The code in FrameState that knows how each opcode affects the current locals
has been separated from the code to update the tracked state of those
locals. This allows the optimization to also take advantage of this
knowledge.
- OverrideLoc and SmashLocals have been removed, and their behavior has been
folded into the instructions they used to follow. This was needed so we can
process each instruction and its effects on locals atomically.
Reviewed By: @ottoni
Differential Revision: D1044602
Differential Revision: D1062844
Differential Revision: D1054603
If this gets CSE'd, we will try to replace it with an IncRef,
which is a type error because it's not a subtype of Gen.
Reviewed By: @edwinsmith
Differential Revision: D1060856
It turns out that checking the first byte of a string to see if it's in
the range ['0', '9'] is a better early-exit than the isStatic + hash
sign bit check. We can also use the NUL-termination invariant to make
the check slightly more efficient: no need to check the length
separately, but just subtract '0' and use unsigned comparison with 9.
Ad hoc instrumentation with stats counters shows that the first-byte
check bails us out in the vast majority of cases.
Reviewed By: @edwinsmith
Differential Revision: D1060828
Now that @edwinsmith has hoisted various redundant computations of
m_hash, this is adds less instructions. It's still a slight increase
in instructions, but stores are slightly down and loads in the noise.
It seems better in principle to do some extra math rather than some
extra memory accesses, and it saves a small amount of memory.
Reviewed By: @edwinsmith
Differential Revision: D1060836
This reduces loads and stores but costs a few more ALU instructions
that initialize registers that don't get used when we only probe
one time.
Reviewed By: @jdelong
Differential Revision: D1053987
I noticed some unnecessary Array growing when looking at LLC-store-misses,
this fixes a few of the top ones.
Reviewed By: @markw65
Differential Revision: D1057028
Calling through tx(), TranslatorX64::Get(), and Translator::Get() is
utter nonsense. The global tx64 object now doesn't need to be
thread-local; it can just be global, since there really is only ever one
during the entire process lifetime.
The TC-cycling logic isn't used, hasn't been tested in ages, and as such
is likely broken, so I'm removing it.
I also devirtualized a bunch of crap in Translator, and added the
override virt-specifier to the two legit overrides in TranslatorX64.
Reviewed By: @jdelong
Differential Revision: D1059757
While working on something else I noticed a bunch of dead code (presumably related to hphpc) so remove it.
Reviewed By: @markw65
Differential Revision: D1059801
Need to sync VM state before calling functions that execute
SQL queries, some of which are PDOStatement::{execute,fetch}.
Reviewed By: ptarjan
Differential Revision: D1059768
We changed the Laravel git has (due to ptarjan getting a pull request accepted). Let's record the expect file again.
Reviewed By: @alexmalyshev
Differential Revision: D1059633
The Pear tests may be somewhat out of date. There are many tests that fail with HHVM, but also fail PHP 5.5. And, HHVM and PHP 5.5. are printing the same "different than expected" output.
Let's whitelist these tests and don't count them as failures or passes.
During this process, I modified the way we handle blacklist and graylist tests. Basically just move these to "disabled" during the install process. That way we know they won't get executed.
Reviewed By: @ptarjan
Differential Revision: D1058987
Invoking a Vector's toFrozenVector() method is now an O(1) operation.
Subsequent modifications to the vector trigger a copy-on-write.
Reviewed By: @paroski
Differential Revision: D1012992
The code in www is basically clean with a few last diffs going in
next week. There's no longer any reason to treat these failures in a
different way.
Reviewed By: @paroski
Differential Revision: D1050132
Since we added new pull requests, we need to force a framework redownload if they don't have it. E.g., @ptarjan's cron job needs to redownload Pear because of this.
Reviewed By: @alexmalyshev
Differential Revision: D1057685
We were seeing a surprising number of hits with perf in FixedStringMap::find() under WaitHandle::join(). This is used while looking up the methods send, next, and raise on Continuation in c_Continuation:call_send() and friends. Since there's a single method to find, go find it during process init and use the result there instead of doing a string lookup on each call.
Reviewed By: @markw65
Differential Revision: D1056356
It looks like if you have two children with the same name, we just make an array of them. So we have to count them up too.
Reviewed By: @JoelMarcey
Differential Revision: D1054872
I don't know why they originally did it like this. I think it was just an oversight by Parker last year in D599728
Reviewed By: @JoelMarcey
Differential Revision: D1056703
The file not found errors we were getting for PEAR was due to the fact that we needed more PEAR packages. I added some more pull requests.
Reviewed By: @ptarjan
Differential Revision: D1057255
If m_used==0 but isFull()==true, the hashtable is full but the
array is empty. We try to copy 0 elements, which crashes because
wordcpy() is a do-while loop. But also, we should be compacting
in this case instead of growing. Add an assert, and do compaction.
Reviewed By: @markw65
Differential Revision: D1057100
Differential Revision: D1059120
After @ptarjan's awesome find about the wrong phpunit.xml being used in testing, let's record the yii expect file again.
Reviewed By: @ptarjan
Differential Revision: D1057061
yii has multiple xml files (for example blogs and such) some of which appear alphabetically before `tests`. Lets make sure we find the right one.
Reviewed By: @JoelMarcey
Differential Revision: D1056958
Its a little alarming that gcc warns about eg using an
int, and also memcpy'ing to/from that int (which is explicitly
allowed by the standard's aliasing rules).
Reviewed By: @jdelong
Differential Revision: D1052741
These functions are generally called from enterTCHelper, but their
return address is set so that they return to the callToExit stub.
This was causing the ret instruction ending this translations to miss
all the time, since the return address didn't match what the hardware
return address stack predicted.
This diff marks these functions as AttrVMEntry, a new attribute
meaning that the function is generally a VM entry point. This
information is used to generate a predictable direct branch to the
callToExit stub.
Reviewed By: @swtaarrs
Differential Revision: D1054750
A direct port of zend's forked libmagic code embeded in the same way they do it. All the bad tests are from `var_dump` imcompatability or unrelated unimplemented functions.
Reviewed By: @paroski
Differential Revision: D1050594
There also doesn't seem to be a good reason for
forcing the jit off. I'm assuming these got committed by
accident.
Reviewed By: @edwinsmith
Differential Revision: D1055752
In a previous version of D1012992 I broke Vector by
accidentally disallowing the following pattern
$v = Vector {1, 2, 3};
foreach ($v as $e) {
$v[0] = 42;
}
i.e. we should be able to mutate elements of Vector (and Map, and StableMap)
while iterating over the collection at the same time.
The bug was caught by a flib unit test, but it seems there wasn't an
hphp unit test that tested the behaviour.
So I'm adding it.
Reviewed By: @paroski
Differential Revision: D1056037
implode doesn't know what to do with Vectors. I also like having them on their own line for easy copy-paste (I'm ok to undo that if you have a reason not to).
Reviewed By: @JoelMarcey
Differential Revision: D1055626
The FacebookPHPSDK curl test was failing since we had a proxy set and that is not good for internal curl access. Add no_proxy settings.
Reviewed By: @alexmalyshev
Differential Revision: D1055647
This diff implements ZipArchive class and zip functions of
PHP, as described in http://php.net/manual/en/class.ziparchive.php and
http://www.php.net/manual/en/ref.zip.php respectively.
This diff is not complete, summary and test plan will be updated as
the code revised. Also I should land a third-party repo commit as
well, libzip, before I land this code.
Reviewed By: @ptarjan
Differential Revision: D1040058
@ptarjan successfully got an upstream Twig pull request accepted for tests that parse large ints.
We are now Twig=100% :)
Reviewed By: @alexmalyshev
Differential Revision: D1055267
Framework::$parallel needs to be set in the constructor only, or Pear fatals
Reviewed By: @JoelMarcey
Differential Revision: D1054784
Differential Revision: D1054961
Differential Revision: D1055096
Some array_* utils were migrated to understand collections,
but still warn that "array_xyz expects array(s)" when passed a
scalar. This diff audits all instances of throw_bad_array_exception
and renames some to throw_expected_array_exception and others to
throw_expected_array_or_collection_exception, depending on whether
the function has been migrated.
Reviewed By: anietoro
Differential Revision: D1053736
WTF PEAR!!?!?!
Well, Pear was out of control running tests in separate process with wildly changing statuseses for a given test depending on the time of day and alignment of the moon. So created a serial option...
We have consistency now. --record and subsequent runs give the same results.
In the future, maybe allow the parallel/serial flag to be set at the command line, but for now just setting this within the framework class itself.
Pear runs much slower this way. Results can't be viewed piecemail (gotta wait until the end of the run). And I will need to fix the test run messages that get printed in the diff/errors/fatals file to extract single test files this way (the message now tells you to run the entire test suite again).
This script is not affecting flib tests.
Reviewed By: @ptarjan
Differential Revision: D1054205
REQ_INTERPRET is kind of heavyweight when we really just want a
conditional interp-one. This diff replaces REQ_INTERPRET in failure
cases with an interp-one on an exit trace, and removes the ReqInterpret
instruction. We still need the service requests, for the debugger case.
Reviewed By: @swtaarrs
Differential Revision: D1052990
They were doing increfs and decrefs while trying to get the
args into the packed array, and went through a C++ helper. They also
would jump backward in the nPassed = 2 case and do a BIND_JMP in the
middle of the prologue, which prevents fallthrough from ever working.
This fixes that, uses the empty array for nPassed = 0, and
disentangles the code from the other prologues. (I didn't do the same
for the ARM version for now.)
Reviewed By: @markw65
Differential Revision: D1049527
We were just casting the flags argument from an int to a
StringUtil::QuoteStyle, but the arg can have more bits set in it.
Reviewed By: @ptarjan
Differential Revision: D1053206
Print out the actual command line string to run a given test. This will be printed in the errors/fatals/diff files.
Reviewed By: @ptarjan
Differential Revision: D1053801
This bug basically prohibited the install of frameworks. Why? Because I was doing setXXX calls in the Framework constructor even if the framework wasn't installed. So I fixed that. To do this quickly, I removed the parallelization of multiple framework installs. But since the install should be rare, this quick fix is worth the time hit.
Failing flib tests have nothing to do with this script
Reviewed By: @ptarjan
Differential Revision: D1053633
Straight forward for Vectors and Sets: continue to throw
exceptions for mapping types. ## array_push ## takes its array
parameter as a reference, so the semantics are very close to a
collection helper function.
Reviewed By: anietoro
Differential Revision: D1049841
Reduce the number of instructions needed on what ought to be the most common path on some of the simpler extension stubs. For calls to functions on this_ with no locals the tests in free_frame_locals_inl and friends were redundant. Provided a path to avoid those. Also out-lined a bit of code which should be more rare to try to save a little code size, and added some LIKELY/UNLIKELY markers. Switched a memcpy to a struct assignment. Looking at the asm output for th_10WaitHandle_getWaitHandle() shows a leaner and straighter path after the call thru to the return. The difference bewtween the memcpy and the struct assignment is (strangely) slightly different register scheduling which produces what I imagine could be fewer stalls.
Reviewed By: @jdelong
Differential Revision: D1051867
This gives the option to allow zend to be used to run the framework unit tests. This could be good for comparison purposes or to whitelist tests for HHVM that Zend also fails. Right now, we specify the path to the Zend binary. Later, we could see about using env variables or something to retrieve it.
Reviewed By: @ptarjan
Differential Revision: D1053279
We may be failing tests because the test needs access to the outside world, but we cannot get there due to the default firewall behavior. Provide the proxy info as part of the proc_open command to run the tests.
Also fixed a "thumb" problem. Better to rely on the contents of the expect file vs the out file to see if things ran as expected instead of setting variables all over the place.
Reviewed By: @ptarjan
Differential Revision: D1053079
RecurisveIteratorIterator's original reverse engineer from lack
of PHP.net documentation had some parity differences -- make it better.
Closes#1260Closes#1266
Reviewed By: @ptarjan
Differential Revision: D1052707
Pulled By: @scannell
GCC 4.7.x on Amazon Linux AMI compilation results in the linker
being unable to find the lambda so de-lambdify it.
Closes#1264
Reviewed By: @ptarjan
Differential Revision: D1052778
C++11 has standardized the TR1 implementation; the latter
should now be purged.
With the deprecation of gcc-4.6, we have full C++11 support and are
capable of moving off of tr1. Further, moving to gcc-4.8 with tr1
causes some compilation issues, incentivising an immediate switch.
== How ==
echo A | codemod --extensions h,cpp,cc,d,tcc 'std::tr1::' 'std::'
echo A | codemod --extensions h,cpp,cc,d,tcc 'tr1::' 'std::'
echo A | codemod --extensions h,cpp,cc,d,tcc 'include\s*<tr1/' 'include <'
echo A | codemod --extensions h,cpp,cc,d,tcc '\s*namespace tr1 = std::tr1;\n' ''
echo A | codemod --extensions h,cpp,cc,d,tcc '\s*using namespace tr1;\n' ''
echo A | codemod --extensions h,cpp,cc,d,tcc 'using namespace std::tr1;' 'using namespace std;'
Performing
ls | grep -v third-party | xargs egrep --color=auto -RIws "tr1"
yields a few non-comment results in
FacebookUpdate/windows/omaha/third_party/gtest/include/gtest/ and
facer/engine/worker/gearmand_0.11/ (seems like non-fb code), some
html (which has not been changed), ti/etc/wrapper.py (this looks like
some compatibility code), and linters/cpplint/ (which seem acceptable).
There are a few files which use tr1 legitimately. Specifically, google
value-parameterized tests require tr1::tuple, and do not work with
std::tuple. Fortunately, these are all cpp test files, not headers.
These files have had their codemod changes reverted.
tr1::functions may be initialized with NULL. std::function makes this
explicit and only allows construction from a newfangled nullptr_t. Clang
is very strict about this, so some NULLs needed to be changed to nullptrs.
== HPHP ==
Most of the non-codemod changes were to hphp. hphp needed to specialize
some hash functions in namespace std::tr1; the tr1 level has been
removed and now-duplicate definitions have been fixed.
hphp/tools/tc-print/perf-events.h makes use of std::tr1::array::assign,
which is no longer a standard function. Uses of assign have now been
replaced with fill. Of note, the arrays are of integral type, and so
slight differences in copy/move/delete semantics between fill and assign
should be irrelevant.
Reviewed By: @andrewjcg
Differential Revision: D1052036
PDOStatement::queryString right now is not being set when using
the regular PDOStatement. If you use PDOStatement you don't want the
constructor to be called, but you want queryString to be set in any
case.
Closes#1211Closes#1263
Reviewed By: @ptarjan
Differential Revision: D1051402
Pulled By: @scannell
A fairly sizeable design change. Now all frameworks are subclasses of a master abstract Framework class. This makes special casing better and easier (e.g. Pear). And it is just better code, I think, for long term maintainability.
Reviewed By: @ptarjan
Differential Revision: D1049900
Objects can change out from under this caching (dynamic properties) so this is safest. If it turns out to be perf critacl we can cut the data into cacheable and not. But then we'll have it figure out what key to use, since serializing it isn't in the contract of this class.
Reviewed By: @alexmalyshev
Differential Revision: D1051775
Previously when we timeout requests that's been sitting on the queue for too
long, we just return 503 to the client on the transport. In addition to that, we
should log the request in access.log
Reviewed By: afrind
Differential Revision: D1033156
This diff extends the approach from D1031058 so that unserialization is
both forwards/backwards compatible with migrating all collection classes
to the HH namespace.
Reviewed By: anietoro
Differential Revision: D1050299
After we store the null Func, it was setting an invName on
the ActRec even though it's not a magic call. It would also update
the MCE as if it were magic. I'm not sure if this could've caused a
bug (maybe someone would treat the invName as a VarEnv, since there
should never be an invName on a non-prelive actrec?)
Reviewed By: @bertmaher
Differential Revision: D1050301
This modifies get_loaded_extensions() to not show the APC
extension when Server::APC::EnableApc is false.
Closes#1103Closes#1262
Reviewed By: @JoelMarcey
Differential Revision: D1050685
Pulled By: @scannell
The change to make this unconditionally allocate a new array
changes big-O behavior of user code in some situations. Thanks to
lesha and andrewparoski for catching this. An equivalent case for
array_merge shouldn't be possible because an inc ref always happens to
pass it to the builtin.
Reviewed By: @paroski
Differential Revision: D1046251
Remove the inline restrictions from findForNewInsert(), and
pass in table & mask so the loads from m_tableMask and m_hash
can be hoisted out of the hashtable init loops in Grow & Copy.
Also, replace memcpy/memset with loops that operate on words
at a time. (no alignment checks, even #s of words).
Reviewed By: @jdelong
Differential Revision: D1047021
I originally tried to use `o_get` but that isn't const, so I added a const version.
A side effect is `var_dump` of an ArrayObject now shows the inner array. Are we cool with that? I like it.
I also tried to move this class down to C++ but that is too much work for this. @sgolemon is there an easy way to have the class in C++ but most of the impl in PHP?
Reviewed By: @jdelong
Differential Revision: D1041009
I refactored the logic here and missed a case that sets m_accept_socket back to -1 for a server that takes over. This doesn't affect it's operation, but makes it unable to yield its fd to the next server (eg: 2nd gen takeover was busted)
Reviewed By: @paroski
Differential Revision: D1050529
Paths without a leading / were being rejected by MakePathList.
This changes the code to match the original FileCache::writeDirectories
logic. It also drops the "return the filename, too" scheme since the only
call site just throws it out anyway.
Reviewed By: @paroski
Differential Revision: D1050552
If this instruction returns null, it's not safe to CSE it if
something in between may have defined the class.
Reviewed By: @markw65
Differential Revision: D1050386
We hit an APC-related bug where reserialize() was being called on a
serialized collection during HHVM startup (when reading APC prime values
from a file), and this caused HHVM to fall over.
This diff fixes reserialize() and adds some test cases and comments.
Reviewed By: @markw65
Differential Revision: D1050281
This is feasable now, after all the steps taken toward it
earlier.
Some subclasses still use vtables, so now we now have to take care to
do correct casts between ObjectData* and c_Foo*'s. (HNI should
eventually let us change the c_Foos so they don't derive from
ObjectData at all.) This diff changes things so that we have a custom
instance delete function (this replaces the late-bound ~ObjectData), a
bit in the object attributes that indicates whether it's got a native
subclass, and some additional metadata in PreClass telling us the
offset of the ObjectData subobject. A variety of extension
destructors were also moved to headers so they could be inlined in the
appropriate delete_Foo functions (their only caller).
Reviewed By: @jano
Differential Revision: D1046763
Pessimize dynamic properties in favor of smaller objects.
This goes with removing the vtable for ObjectData.
Reviewed By: @swtaarrs
Differential Revision: D1046746
The pattern call_user_func(array($obj, "staticString"), ...)
is pretty common, and it's basically the same as FPushObjMethodD
except it warns instead of fataling when the method is not defined.
Catch this pattern and turn it into a similar IR sequence, and add a
template flag to methodCacheSlowPath to warn instead of fataling.
Reviewed By: @swtaarrs
Differential Revision: D1042143
They returned IRInstruction*, while dereferencing a Block::iterator
gives IRInstruction&. This diff changes it to be consistent with every other
container. I also changed it so you can't get an IRInstruction& from a const
Block*. Luckily no code appeared to be depending on that.
Reviewed By: @jdelong
Differential Revision: D1049640
This rewrites some helpers to avoid using the global
rbx register. This is needed for lto support (or at least, we
would have to compile function-entry-helpers.cpp with lto
off). Its also needed if we want to compile with clang, and it
will help with the arm port.
This adds a few new arm failures, but also fixes some existing bugs.
Reviewed By: @jdelong
Differential Revision: D1045712
Corrects the case when a SetM is performed on an ArrayObject
that holds an array with a ref count of 1.
Reviewed By: @ptarjan
Differential Revision: D1048713
Since we determined that fgetc didn't solve deadlocking, and we just blacklisted those tests instead, we go back to fgets.
Also, clean up the way we analyze tests and their statuses.
PEAR is flaky. I don't think it is any atomicity or overwrite problem with the script. I think it might be the fact that we are running these things with separate processes. Or the tests are flaky. Either way we need a serial mode.
Reviewed By: @ptarjan
Differential Revision: D1049044
- simulate random arrival of events.
- keep track of request queue time and wall time for each request.
- keep track of the max queue time and max load.
- added ability to add a padding to the time to simulate random delays.
- compute various statistics for queuing time and wall time.
Reviewed By: rkroll
Differential Revision: D1044762
A few test files from a few frameworks are causing deadlocking issues with the script. Blacklist them. Deal with them later.
Reviewed By: @ptarjan
Differential Revision: D1047939
Removing the final newlines from the expect files was premature and probably a mistake.
http://stackoverflow.com/questions/729692/why-should-files-end-with-a-newline
So, leave it to clients/upstream to deal with newlines at the end of the file.
Also, do not print user path info out in expect files (or other files). e.g., no joelm
Also, list frameworks in help message when specifying invalid ones
Reviewed By: @ptarjan
Differential Revision: D1045907
We weren't tracking the default values of properties in
ReflectionProperty. Unfortunately this diff only fixes the issue for
classes that don't use ClassInfo, so builtin classes will still break.
Fixing them will be a separate diff.
Also replace old for loops with range-for
Reviewed By: @ptarjan
Differential Revision: D1043255
This disabled making new functions named 'extract', which
doesn't work because extract already exists. We want to disable
allowing creating new functions that have the behavior of extract.
Reviewed By: danielm
Differential Revision: D1042932
This refactors the MD5 code a bit to avoid forcing the use of malloc.
Now, the raw MD5 api unconditionally gives back a 16-byte digest,
and we have wrappers to convert to std::string and String, respectively.
Reviewed By: @jdelong
Differential Revision: D1046220
Use async functions to generate Static*WaitHandles. The explicit methods
to do so will be gone soon.
Reviewed By: @billf
Differential Revision: D1046534
Magento2 (and possibly other frameworks) end up making classes
that extend ArrayObject but never call its constructor. This works
under Zend so it should work under us as well.
Reviewed By: @scannell
Differential Revision: D1045913
I noticed some missed opportunities for inlining were because the
callee was not marked as hot, but the caller was. There's a check to
prevent inlining in such case, which kind of makes sense -- the call
may be in a cold path. However, in some cases the callee is not
marked as hot probably just because it's too small. And if the
function is small enough it's better to inline it anyway -- they code
may get smaller. So I added a callee code-size threshold below which
inlining is always allowed.
I did some experiments with different values for the new threshold,
and also the previously existing HHIRInliningMaxCost, and set them to
what seems best these days.
Reviewed By: @jdelong
Differential Revision: D1044965
... throwing ##"Not implemented is not implemented"## does
not cover oneself in glory. Easy fix with a few emacs macros
Reviewed By: @ptarjan
Differential Revision: D1044243
Let's sort the expect files alphabetically so any changes to them doesn't result in mega-diffs.... well, this will be the last mega diff to prime the expect files :)
Reviewed By: @ptarjan
Differential Revision: D1044747
PushL pushes the value of a local on the stack and unsets it, avoiding
any refcounting operations. This is useful in Continuation::send and async
functions.
Reviewed By: @ottoni
Differential Revision: D1042054
A simple framework for doing a controlled simulation on job queue. Within this
set up, we can specify a duration for each request going through the system. The
request will have a fixed service duration of x ticks. We define our own
TickWorker that finishes the request after x ticks. We have a static global
logical clock we can then use to drive the simulation.
The next step is to generate a reasonable workload based on our real work
request latency distribution and run it through the system. After that, we can
simulate server side issues (ie. all reqeusts incur additional latency or small
percentage of request with very high latency).
The test case will help us select and fine tune the algorithm for doing queuing
and timeouts.
Reviewed By: rkroll
Differential Revision: D1043222
ReflectionClass supports taking an object and should use the dynamic props from it. @alexmalyshev is going to send a diff about default, so we'll have to co-ordinate whoever lands first.
Reviewed By: @elgenie
Differential Revision: D1043099
Add a mode for HHProf where all allocations are shown. This
isn't helpful for leak tracking or looking at what memory is still
alive, but this allows visibility into allocation patterns that would
otherwise be hidden because they are balanced.
Reviewed By: @mikemag
Differential Revision: D1042696
fgets was not working. stream_select seemed ok, but fgets seems to block anyway if only a certain amount of data is available without a newline. Use an fread(), character by character approach.
Reviewed By: @ptarjan
Differential Revision: D1043978
We were getting errors like: PHPUnit_Framework_Exception: HipHop Notice: Nothing to do. Either pass a .php file to run, or use -m server.
It had to do with running php in processes and passing php code via stdin. We need the php wrapper/symlink to hhvm instead of the explicit hhvm binary.
The fix was to fork phpunit, make a change to their getphpbinary() function to check for an environment variable that we then set in this script. Then we upstreamed that fix to the master phphunit branch and it was quickly accepted (that was nice!)
Also added @elgenie fork for Slim as well.
Reviewed By: @ptarjan
Differential Revision: D1043544
Added support for passing arrays to apc_store/add instead of key,value pairs one at a time. Sharing an early
version to get code review feedback.
Reviewed By: @paroski
Differential Revision: D1037553
I noticed this was hot in perf, so I did some standard streamlining:
- have the string functions use String(ReserveString) instead of malloc
- switch a std::vector to smart::vector
- inline the small String::replace() wrapper functions
- mark f_string_replace and string_replace() as HOT_FUNCTION
Reviewed By: @jdelong
Differential Revision: D1041907
This function is already implemented as SQLite3::createFunction, however
PDO is expected to have it's own version of it as well. I leaked some of
the SQLite3 declarations over to PDO to get it to work.
Zend just duplicates all the functionality between PDO and SQLite3, for
instance 'php_sqlite3_func_callback' and 'php_sqlite3_callback_func' are
the same function just in different files...
Reviewed By: @ptarjan
Differential Revision: D1039095
instanceOfHelper was just a thin wrapper around Class::classof. Do the
null check in the TC and call classof directly. I also get rid of a null check
in classof which trimmed down its assembly a bit.
Reviewed By: @jdelong
Differential Revision: D1042062
Eugene found some bugs with collections when he wrapped some of the our
collections tests inside a "main" method. These bugs have since been fixed,
so we can update collections tests that are not wrapped in "main" methods.
Reviewed By: @ptarjan
Differential Revision: D1041602
Split the monolithic functions preparing special variables such
as $_REQUEST or $_SERVER into multiple functions to enable feeding of
data from multiple sources. In case of FastCGI protocol, the values are
sent by the web server.
Import parts of proxygen and thrift.
Added #ifdef's to allow compilation with an unpatched version
of libevent library.
Reviewed By: @ptarjan
Differential Revision: D988737
Differential Revision: D1008756
Differential Revision: D1021808
Differential Revision: D1035231
If it's not an NVTW, it's really quick to convert an array to a bool: is
m_size nonzero? The cold path is still a call to C++.
We can argue about codegen if you want. I could have the C++ helper
return a bool, get that into the dest register, and then jump over the
setcc, or do what I've done here.
Reviewed By: @edwinsmith
Differential Revision: D1040912
Look for a "format" key in the thrift spec array for collections (maps, vectors, sets). If the value is "collection", construct a Map/Vector/Set object rather than an array.
Reviewed By: @andrewcox
Differential Revision: D1025009
We were calling `newSlab` at statup and then `hphp_session_init` promptly calls `resetStats` setting it to 0. It looks like we should clear the stats when we clear the slab. That's a little scary for now, so I'm going to just make it non-zero.
Reviewed By: @jdelong
Differential Revision: D1041217
Make the fast path of the method cache slow path do a little
less work.
This was in part to see if the wouldCall logic could get simple enough
to make it a fast path unique stub in ahot. This version of the code
was simple enough for me to translate to a unique stubs, which I tried
last night (the theory was that getting it on the first page of ahot
could help iTLB/icache), but it was in the noise. I only did
methodCacheSlowPath(), so maybe it would only help if the whole thing
was pulled over, but I'm inclined to think that this suggests idea of
trying to move hot helpers to ahot stubs isn't very promising.
Reviewed By: @markw65
Differential Revision: D1039748
I saw code doing null checks on the m_preClass in
target-cache.cpp's wouldCall(), but it turned out to be unreachable
code.
Reviewed By: @dariorussi
Differential Revision: D1039739
When we run out of log space while profiling, we close out the dangling stack with the last entry we have. This under-represents the functions left on the stack, which is fine, but also (sometimes greatly) under-represents main(), which is a pseudo-function intended to represent the entire profiling run. This change ensures that we always close out main() with data from when profiling was turned off, even if we run out of trace space.
Reviewed By: @swtaarrs
Differential Revision: D1040813
Some callsites always pass nullptr, and some always pass non-null.
Also, we can make the whole thing smaller by rearranging the cases.
Reviewed By: @markw65
Differential Revision: D1041950
SingleTest was a bit unwieldly. This hopefully refactors it a bit nicer. Also, found some output bugs that may have affected our runs.
Next is to sort the expect files so that we can change them without monster diffs
Reviewed By: @ptarjan
Differential Revision: D1041553
Switches to using the sign bit to indicate that a refCount
is static, and rewrites the various decRef sequences to be:
if (count == 1) release();
else if (count > 1) --count;
Adds runtime options to allow experimentation with the exact strategy;
- whether to load the count into a register (if one is available)
- whether to use if (!--count) release(); if we don't need a static check
- whether to skip using the register and just emit --count if we know
its not static, and can't hit zero.
Also switcher various other static-bit checks to do byte tests on the
high byte, rather than word tests on the entier value.
Reviewed By: @edwinsmith
Differential Revision: D1012547
The first time we call a method, we add its flag to the
intercept table (so it can be enabled by future calls to intercept)
and then set the flag based on whether or not its intercepted in
the current thread.
That leaves a hole where thread a could call intercept,
thread b could call the function (setting the flag to zero,
because its not intercepted in thread b), and then thread a
would behave as if the function were not intercepted.
Fixed by using adding a flag to the global table to say whether
or not its ever been intercepted, and initializing the method's
flag from there.
Reviewed By: @jdelong
Differential Revision: D1039463
CheckSymLink (following symlinks and making the realpath calls)
is the Zend behavior so we should default to this as well and allow
people to disable it for performance reasons instead of the inverse.
Depends on D1034342
Reviewed By: @ptarjan
Differential Revision: D1034354
We were always generating a loop like:
0xd800252: mov eax, 0x1
0xd800257: sub rbx, 0x10
0xd80025b: inc eax
0xd80025d: mov byte ptr [rbx+0x8], 0x0
0xd800261: cmp eax, 0x2
0xd800264: jl 0xd800257
to set the DVs that didn't get a value passed in to Uninit.
This diff unrolls the loop for small number of values to be
initialized.
Reviewed By: @jdelong
Differential Revision: D1041394
Right now HHVM allocates about 1.2 GB of memory by default.
Reduce this by a factor of ~10 for a better experience with small
applications, VMs with limited memory, evaluation and testing purposes,
etc.
The configuration settings are available to change this to the previous
behavior is reproduced here for ease of access:
Eval {
JitAHotSize = 4194304
JitASize = 536870912
JitAProfSize = 536870912
JitAStubsSize = 536870912
JitGlobalDataSize = 134217728
}
Reviewed By: @markw65
Differential Revision: D1034305
Debugger commands 'up','down' and 'variable' now operate on the async
stack as well as the regular stack. If used in conjuction with 'where async'
the awaitable dependency stack is traversed instead of the regular stack
by the said commands.
Reviewed By: @mikemag
Differential Revision: D1034548
Some functions took a const String&, but assumed
that if the refCount was 1 they could destroy the parameter.
This is fine for calls from the vm, because it always refcounts
correctly, but can lead to surprising results for calls from c++
code.
It turns out that (for g++/x86 at least) the actual calling convention
for a function taking a String is identical to one taking a const String&
(ie its the caller's responsibility to pass a reference to a
temporary in the former case). So this diff just changes them
over to be String (which required a bit of hackery in the code to
generate the vm stubs). That fixes the issue for calls from c++, and
has no effect on calls from the vm.
Reviewed By: @jdelong
Differential Revision: D1040836
We need to initialize the timezone or else we get a warning in the logs. I could have added a -v option, but I want to start putting things in the INI files when they exactly correspond to a PHP ini setting.
I created a `php.ini` file just for the test runner and forced us to use it.
Reviewed By: @JoelMarcey
Differential Revision: D1040418
The ContSuspend* instructions were not marked as "terminal" (TF), and so
the bytecode emitter thought it was possible to these instructions to fall
through and there some unnecessary Null instructions being emitted for
"yield" expressions to satisfy asserts in the bytecode emitter.
This marks the ContSuspend* instructions as "terminal" and gets rid of the
unnecessary Null instructions that were being emitted.
Reviewed By: @jdelong
Differential Revision: D1039548
Matches Zend's behavior of emitting a fatal error on properties that
start with \0 only if the object does not have the appropriate magic
method defined.
Reviewed By: @ptarjan
Differential Revision: D1032024
HHVM's instanceof operator was returning true when checking if an array was
an instance of the Traversable interface, and this was breaking some PHP
code out in the wild. This diff fixes HHVM so that the instanceof operator
returns false in such cases.
There are some existing hh files that require that "array() instanceof
Traversable" return true. To solve this, we introduce a new interface
named "HH\Traversable" and we change "instanceof" to return true when
checking if an array is an instance of \HH\Traversable, and we update the
parser so that it implicitly imports \HH\Traversable for hh files when we
are in the global namespace and there are no conflictly "use" statements.
To keep the interface hierachy coherent, the Iterator interface required
similar treatment.
Reviewed By: @ptarjan
Differential Revision: D1037748
This is in mainCode in X64---figured I'd change it in case it
is easy to miss when we actually implement the stub.
Reviewed By: @scannell
Differential Revision: D1039633
Silly me, I thought that box() does sort of the opposite of unbox(). To
wit, I thought it would box Cells and pass through already-boxed stuff.
Turns out it assert-fails on already-boxed stuff.
Reviewed By: @swtaarrs
Differential Revision: D1038748
Introduced MySQL TypedResults runtime parameter, which allows
switching from HHVM behavior of returning also ints and doubles from
MySQL results to Zend behavior of returning only strings and nulls.
Closes#1237Closes#1238
Reviewed By: @ptarjan
Differential Revision: D1038046
Pulled By: @scannell
Because it's the right thing to do. We overrode the default
constructor for hash_map so I left that alone for now.
Reviewed By: @jdelong
Differential Revision: D1035287
Remove a lot of the HPHPc hacks and do real eval. I could have re-used the escaping but the code was a bit cleaner like this
Reviewed By: @markw65
Differential Revision: D1015443
Check countness of current SSATmp, not the original SSATmp for
refcount validation. Passthrough instructions like CheckType<Int>
can cause the countness to change.
Reviewed By: @ottoni
Differential Revision: D1038437
More changes to avoid mulitiple copies of destruct
sequences, to make it easier to modify the incRef/decRef
code.
No intentional changes to behavior/performance
Reviewed By: @jdelong
Differential Revision: D1038763
Some tests would deadlock, even with the specified timeout. So I added some more stream_select statements before appropriate fgets calls.
Reviewed By: @ptarjan
Differential Revision: D1039419
This can kick in if you inline a function, passing an
argument that came directly from AllocObj, but isn't measurable on the
site.
Reviewed By: @bertmaher
Differential Revision: D1038352
No change in functionality. Just some refactoring. Putting methods in classes. Common forking and bucketing method. Etc.
Next up:
Timeout bug
Alphebetize expect file
More refactoring
Reviewed By: @ptarjan
Differential Revision: D1039348
If you turn off Precoloring without turning off XMM support,
stuff breaks due to not copying Cell values coming back from
calls, from (eax,edx) to whatever full xmm register was assigned.
Reviewed By: @ottoni
Differential Revision: D1037919
very straight-forward, since ##isContainer##,
##getContainerSize##, and ##ArrayIter## are already collection
friendly.
Reviewed By: @paroski
Differential Revision: D1031865
Lets see if we can put this up to `GetNamedEntity`. It is a LOT cleaner this way and fixes the bug in the attached class.
I still need the helper as constants don't have `NamedEntities`.
Reviewed By: @markw65
Differential Revision: D1032816
Reduce to a single implementation of the generic
dec-ref-and-destroy code.
RefData can never be static, so stop checking it
Reviewed By: @swtaarrs
Differential Revision: D1037810
Sort the frameworks vector so that we can have a general alphabetical order of test
running after we bucket them in threads.
Fix a couple of bugs (undefined variable and possible div by zero) too.
Reviewed By: @ptarjan
Differential Revision: D1038251
D988759 changed the way we reallocate arrays, and broke a previous optimization in SetNewElemArray and UnsetElemArray, causing memory leaks in a wide variety of cases. We got a very nice repro from the Firehose team. This fixes the test case in the referenced task, which can complete now with minimal memory use. I suspect this also explains a number of other OOM bugs which have been cropping up since the 10/25 release, and perhaps the extra swapping in v3 we've experienced since then.
Reviewed By: @jdelong
Differential Revision: D1038091
This is just code cleanup; sometimes we care about the # of logical
words for a tmp or PhysLoc, (eg 2 for a TypedValue) and sometimes
we care about the physical locations assigned (eg 1 for FullXMM,
0 for a constant). This separates the two a bit more clearly.
Reviewed By: @bertmaher
Differential Revision: D1037818
Various places test func->info to determine whether a Func is a c++
builtin or not. Some of them need to include Native Funcs.
Rename Func::info to Func::methInfo to find all the uses, and spot
check them.
Reviewed By: @jdelong
Differential Revision: D1035915
The script now preloads all of the tests for all of the specified frameworks (every test is retrieved with --all). Then we fork of threads, bucketing as necessary to keep things sane. This is instead of forking of a thread per framework and then more threads for the tests of each framework where we could get up to 1000+ instances of HHVM going (and that is bad).
Also fixed a bug on how we retrieve the actual tests.
Did a little more refactoring too.
Singled out two tests from zf2 that was causing some weird deadlocking. Don't run those. Figure out why and then take them out.
Reviewed By: @ptarjan
Differential Revision: D1037105
In legacy mode, readMetaData should not modify the input
rtts, since these are shared with the tracelet's guards.
Reviewed By: @ottoni
Differential Revision: D1036751
- There were register "allocation" bugs in the closure code. First, the
incref code was clobbering the address of the datum to incref with the
refcount. Second, the closure prologue code was using rAsm2 to hold
the closure's address, and that got clobbered by the fixed incref
code. >_<
- The type calculus of SetL's effects on locals wasn't right. If the
local is boxed before SetL, it'll be boxed after, regardless of what's
on the RHS.
Reviewed By: @jdelong
Differential Revision: D1036579
Minor version 2.3.5 vs 2.3.1; with a pull of the commit
listed in run.php, it will have no errors.
Reviewed By: @ptarjan
Differential Revision: D1036922
This diff begins to allow indivdual tests per framework to be run in separate processes. Now we won't stop on fatals and we should be able to get a nice percentage number for all frameworks.
There is a "too many threads" spawned issue right now that needs fixing (deadlocking occurs as I create too many at this point). But let's start the review process.
Also did a fairly sizeable refactoring too.
Reviewed By: @ptarjan
Differential Revision: D1035690
This adds new IR opcodes to lookup class methods from the TC
instead of interpreting. LookupClsMethod basically does the same
thing as the interpreter; LookupClsMethodStatic is optimized for the
case where the call is in a static function.
Additionally, when the class input comes from a LdCtx we can get the
method slot at jit time and burn that into the TC. This case is
pretty common since "LateBoundCls; FPushClsMethod" is a common
pattern.
Reviewed By: @jdelong
Differential Revision: D1035577
We manually initialize the IPV6 sockaddr_in6 structure
as gethostbyname_r has problems with numeric IPv6 adresses
(http://sourceware.org/bugzilla/show_bug.cgi?id=5479). In the particular
case it fails with permission denied, while it works with the equivalent
ipv4 address.
Reviewed By: @mikemag
Differential Revision: D1030284
I failed to appreciate the difference between the two (unbox works on
types that aren't necessarily boxed) in my last diff.
Reviewed By: @edwinsmith
Differential Revision: D1035871
Adds fast paths in native helper functions for some common
cases for FPushCuf; bails to the full vm_decode_function logic if
things are less than simple.
I also tried a fast path for strings with class names ("Foo::bar"),
which made those calls about 2x faster in micro-benchmarks, at the
expense of making "self::foo" about 3x slower. It was in the noise on
perflab, and also required differences in autoload order, so I'm
leaving that one out for now.
Reviewed By: @bertmaher
Differential Revision: D1032035
HHVM treats all non-int flags as arrays, but Zend treats all
non-array flags as ints, so HHVM handles e.g. string flags
incorrectly. Reverse the logic to match Zend.
Closes#1226
Reviewed By: @alexmalyshev
Differential Revision: D1034218
Pulled By: @scannell
Remove the old code (with a few lingering stubs to be cleaned up in a future change)
continuous build seems to be expecting bad strings in unrelated code
Reviewed By: bmaurer
Differential Revision: D1030191
This adds a refcount validation pass. The pass creates an
approximation of a map from SSATmps to refcount-deltas for
each exit block. The validation consists of verifying that the
deltas are same before and after refcount optimizations.
This is run only in debug mode or under the runtime
flag Eval.HHIRValidateRefcount.
Reviewed By: @ottoni
Differential Revision: D1022219
The assert in the minstr translator was failing in
test/quick/poly-torture.php. The setup is: there's a CGetM whose base is
boxed, and before the CGetM there's an InterpOne that causes us to drop
all knowledge of refs' inner types in the frame. (This happens in x64
mode too if I force IncDecL to be interped.)
We can actually drop the inner types to InitCell instead of just Cell --
you can't have a reference to uninit. Then we can slightly weaken the
assert in the minstr translator, and it will pass. Weakening the assert
is justifiable; the codegen for LdRef knows that it shouldn't bother
emitting a typecheck if the box's inner type is InitCell.
Reviewed By: @swtaarrs
Differential Revision: D1033158
This is intended to be code cleanup, with no real change in
functionality, but should make the sign-bit-as-static-indicator
diff much smaller, and easier to reason about.
Reviewed By: @andralex
Differential Revision: D1030409
Shuffle didn't handle two corner cases correctly:
1. unused destinations. These could/should be eliminated upstream
but there's nothing incorrect about them, we can just ignore those
copies.
2. a DefConst feeding into a DefLabel needing 2 registers; We already
handled DefConst, but not when the destination doesn't have a known
type. e.g. merge(1,"foobar") => {Int|StaticStr}, which needs 2
registers.
Reviewed By: @dariorussi
Differential Revision: D1032504
StLoc was producing an incref on its result even if the result
was not pushed on stack (consumed).
Reviewed By: @ottoni
Differential Revision: D1032861
- Have separate stubs for the three return helpers. They don't need to
be implemented yet, but they all need to have distinct addresses
because we compare against retInlHelper directly to determine whether
to run function-exit hooks.
- This exposed a bug in cgGuardRefs, where the "is logical immediate"
assert was firing. This time I actually invested real time into
understanding what the hell's going on there and rewrote the thing
properly. (There are still some improvements to be had: most notably,
when the mask is a single bit, we can use Tst instead of And-Cmp.)
- Fixups done on faked-up ARs in the simulator's catch block were
succeeding, but not ones done from VMRegAnchors. The underlying cause
is that the VM stack is not participating in the native frame pointer
chain, because we're not using native call instructions to get into or
out of the TC. I added logic to FixupMap that looks at the stack of
simulators stored in ExecutionContext, and reads their registers to
look for the place to apply the fixup.
Reviewed By: @edwinsmith
Differential Revision: D1032483
Fixups for simulated calls to C++ were basically not working at all.
This fixes a couple of test failures. There are still some failures left
that are failing with a null AR* in fixupWork, which I'm researching
separately.
To add the pseudo-unwind personality to the simulator, I made a
mechanism to provide an "exception hook". Eventually we'll probably want
it to return a flag indicating whether or not to re-throw, but that's
not necessary yet. I made it a hook instead of implementing the logic
right in the catch block to avoid having vixl depend on libruntime.
Reviewed By: @edwinsmith
Differential Revision: D1031833
headers_list should return an empty array when there are no
headers. There were already tests involving this in ext_network.php, but it's
being skipped (at least in the github repository).
Closes#1218
Reviewed By: @alexmalyshev
Differential Revision: D1030259
Pulled By: @scannell
Added 4 counters to Transport to track how long thread sleeps in various sleep functions
when serving a request. I exported the request through hphp_get_timers.
Reviewed By: @mikemag
Differential Revision: D1021385
The rpc server keeps the ExecutionContext alive across requests to
reduce startup costs. Unfortunately, we weren't clearing $_SESSION, $_GET,
etc... at the beginning of the request. This was making us think that most of
the http headers in most requests were duplicates, and emit a warning where the
option is enabled. It's also generally bad practice to leak this stuff between
different requests.
Reviewed By: @markw65
Differential Revision: D1010456
Vector had a bunch of methods that were not available in FrozenVector.
Add the ones that make sense given that FV is immutable (e.g. we can't sort it).
Reviewed By: @paroski
Differential Revision: D1014907
analyze needs to read live state, which is only
valid if this is the first tracelet in the region. For
subsequent tracelets, fall back to the interpreter.
Reviewed By: @ottoni
Differential Revision: D1028657
I left this unimplemented in my initial prologues diff, just out of
laziness. Time to actually get it done.
This diff contains anecdotal validation for my decision to fork code-gen
instead of trying to put the ARM assembler behind the X64Assembler
interface. Note the AttrStatic part in the closure prologue
implementation -- the x64 version uses a weird quirk of the shrq
instruction that puts the former LSB in the carry flag. Trying to
emulate that in terms of ARM instructions seems pretty foolish.
Reviewed By: @markw65
Differential Revision: D1025972
* __doc__ for the module
* Make RECOGNIZE regex part of the process of defining a pretty-printer
* remove ##lambda x: bar(x)##
Reviewed By: @ptarjan
Differential Revision: D975674
Mutation operations can reseat the original array. In zend land, this isn't the case so we need a wrapper for the original array which will change its internal pointer during any reseating operation.
I verified that every method was implemented in this by removing the inheritance and making sure there were no unknown methods in the big table.
Reviewed By: @jdelong
Differential Revision: D1009352
Verily, case sensitive and insensitive comparisons are not
the same. Zend knows this too: http://codepad.viper-7.com/YmAmQk
Reviewed By: @jdelong
Differential Revision: D1031067
This is another test that recovers from VerifyParamType,
which we don't handle correctly in RepoAuthoritative mode (by design).
Modify it so it will SEGV without the correct flags, and then pass
them.
Reviewed By: @markw65
Differential Revision: D1019278
Every PreClass structure contains an Offset pointing usually
into the psuedo-main, to the DefCls for that PreClass. For closures
it points to the opcode after the CreateCl (perhaps unintentionally?).
If a merge-only unit fails to define a class, it "fakes" like it was
running the psuedo-main, and sets PC to this offset before raising the
error. Right now, a Nop is placed in the bytecode for this. This
changes things to have a new instruction for this case, so that static
analysis of the bytecode can see why the Nop was there.
Reviewed By: @edwinsmith
Differential Revision: D1029696
Option types, static string and static array, and specific
class types. And AssertTStk was not correctly computing the Location.
Reviewed By: @swtaarrs
Differential Revision: D1029072
HHBBC sometimes infers that functions return Bottom
(i.e. infinite loop or always throw). In this case, after the FCall,
I want to insert a String "static analysis error"; Fatal sequence, but
that sequence ends up included in the Tracelet that does the FCall.
One way to break it is to have the analyze pass / region selectors
recognize this pattern, but it seems that this might come up in other
contexts where ahead-of-time analysis may have good reasons to suggest
tracelet breaks (e.g. to avoid our "double tail" problem on control
flow diamonds, or maybe StaticLoc?).
Reviewed By: @swtaarrs
Differential Revision: D1029595
This aids in implementing strength reduction if you can
constant propagate to instructions taking a classref when there is a
*D form. (E.g. AGetL; ClsCns converting to ClsCnsD, FPushClsMethod ->
FPushClsMethodD, etc.)
Reviewed By: @bertmaher
Differential Revision: D1029405
Modify one of the tests so it fails with the wrong options
and pass the right ones, add a similar test for static member
functions. It appears DynamicInvokeFunction is ignored for member
functions (but member functions are inspected for a "dyn_" prefix??),
so I added norepo for the ones that do intercept on member functions.
Reviewed By: @swtaarrs
Differential Revision: D1029398
We put the top of stacks toward the right in the spec. Also,
make it a little clearer that CreateCont and CreateAsync unset locals
on the current frame.
Reviewed By: @edwinsmith
Differential Revision: D1029381
Mostly exposing some fields on the FooEmitters, consts, and
other small things like that. This is split off in an attempt to make
the code review a little easier.
Reviewed By: @markw65
Differential Revision: D1025651
I don't think anything in the system actually requires this,
so we might as well not have the rule.
Reviewed By: @edwinsmith
Differential Revision: D1025601
These instructions do nothing. They match up for the cases
that we currently use metadata to nop things out, except FPassC
(because FPassC is already always a no op). I'll remove
MetaInfo::NopOut in a separate diff on top of this to perflab it
separately.
Reviewed By: @edwinsmith
Differential Revision: D1025494
ld on OS X 10.9 doesn't seem to be able to locate the ctype.h
functions (ex. isdigit) when they are used as function pointers, so wrap
them in lambdas.
Reviewed By: @markw65
Differential Revision: D1030137
Since bmaurer noticed that we spend a lot of time locking on
memory stats during webserver shutdown, and we don't do anything with
these stats anyways, let's just turn them off.
Reviewed By: bmaurer
Differential Revision: D1030301
yii leaves this file around which is a duplicate of its test. So the autoloader loads it twice. Kill it between runs.
Reviewed By: @JoelMarcey
Differential Revision: D1030682
The test output depended on the sort order of equally-likely
types; we don't care about their order, but we do care about frequency
ordering, so bias the output towards integer.
Reviewed By: @scannell
Differential Revision: D1030488
The x64 version of this distinguishes the case where dvs.size() == 1
because then it can use a compare with mem and immediate operands. ARM
can't do that.
Reviewed By: @edwinsmith
Differential Revision: D1028069
Apparently #error isn't the best thing. This fixes a couple build
blockers: building vixl natively on ARM, and building in non-fast-TLS
mode.
Reviewed By: @scannell
Differential Revision: D1029917
RegisterInfo either represents registers or spill locations for
an SSATmp; Looking at the way we use it, the name PhysLoc makes
more sense.
Reviewed By: @ottoni
Differential Revision: D1025818
Rewrote the algorithms for array_intersect() and array_intersect_key() to
work with collections and to achieve better performance (particularly for
array_intersect()).
Reviewed By: @dariorussi
Differential Revision: D1025142
The variable command, along with its clients the global command and the = command, obtained variable names and values from the server by asking for an map of variable name to variable values in a single request. If one or more of these variables have really large values, the serialization of the map exceeds the serialization limit and the entire command fails. This makes it difficult pin-point which variable causes the trouble and breaks the client commands in unexpected ways.
This diff changes the protocol of the variable command so that it first gets an array of variable names only and then separately gets the value of each variable. If such a separate get fails because of a serialization limit, the variable's value is printed as "...omitted".
Reviewed By: @mikemag
Differential Revision: D1021035
Add an --allexcept option that allows us to run all tests but those listed.
Fix a weird bug that happens with an HipHop warning occurs on the same line as a status. Had to fix the regex for that.
A few other fixes
Next up:
Each test of each framework in own process
Create per framework shell script to run only those tests that had a different status than expected
Reviewed By: @ptarjan
Differential Revision: D1028292
retranslateOpt called retranslate, which could end up
returning nullptr if another thread got the source-key lock, and
then got blocked on the write lease.
Call translate instead, and don't generate optimized translations
if the debugger is attached.
Reviewed By: @ottoni
Differential Revision: D1027892
Removing the using-directive exposed most of the remaining bits of
x64-specificness in tx64. I just added explicit namespace qualification
to most of them and will deal with them properly later. (I actually find
it kind of suspect that we haven't hit problems with, for example,
bindJmpccFirst yet.)
The one place where I made actual changes is in the code that handles
emitting a fallback request to interp in the event of total codegen
failure for a tracelet. Previously it was handy to keep this
unimplemented (I've been testing with an assert(false) in the
X64Assembler ctor) because it exposed places where we were getting
spurious failures because not enough IR opcodes were implemented. The
remaining places where we're hitting this failure mode are legitimate:
polymorphic tracelet explosion and running out of spill space.
Reviewed By: @ottoni
Differential Revision: D1027996
Implement unused FILE_BINARY and FILE_TEXT because PHP does
even though they have no effect in PHP 5.
Closes#1215
Reviewed By: @JoelMarcey
Differential Revision: D1027907
Implement file extensions set that should be treated like PHP
files in the webserver
Closes#1207
Reviewed By: @markw65
Differential Revision: D1021819
Pulled By: @scannell
All the debugger tests were failing because of this.
The Tricky Topic of the Day introduced in this diff is ARM code's
interaction with thread-local storage. ARM has its own way of getting a
pointer to thread-local storage (already implemented in tlsBase()) but I
don't know exactly how it works -- i.e. whether it works the same way as
on x64, where the system register points to an area with a bunch of
pointers to thread-local objects. ARM certainly doesn't have
segmentation the way x64 does.
Rather than figure all that out and implement corresponding support in
vixl, I've elected to just call into C++ to get the TLS base. This is
going to be one area where simulated-ARM mode diverges significantly
from native-ARM mode, but we'll cross that bridge when we come to it.
Reviewed By: @jdelong
Differential Revision: D1023960
The timeout was broken, as in it didn't work. Take a new approach. Timeout per individual test in an individual framework instead.
Default is allow 60 seconds per test.
And some other fixes too.
Reviewed By: @ptarjan
Differential Revision: D1027221
... for the purpose of adding trait-based methods to a class at PreClass-to-Class conversion time.
Reviewed By: @jdelong
Differential Revision: D1023552
Generic wait handle for async executions which are not bound by context
but rather have session scope. Used for upcoming SleepWaitHandle.
Reviewed By: @jano
Differential Revision: D1018708
An IncRef that is marked as a candidate for sinking should
be removed from the sinking list only if the corresponding DecRefNZ
is live.
Reviewed By: @ottoni
Differential Revision: D1026155
We assert in DOMNode::{appendChild,insertBefore} that the node that
has been passed in is an orphaned node, however it's only orphaned if
it has no parent or its parent is also orphaned.
Fixes the last fatal in yii
Reviewed By: @ptarjan
Differential Revision: D1026211
After eager execution, the queue of ready ContinuationWaitHandles may
contain only unblocked handles. Process the most recently unblocked first
to improve cache locality.
Reviewed By: alexsuhan
Differential Revision: D1016230
This variable is entirely independent of the hdf, so it should be set even it there isn't one.
This came up when someone (me) was running `hhvm -m server` from the symphony directory trying to show it off, but PATH_INFO doesn't work unless the m_documentRoot is set. It just assumes that all files exist if there is no document root.
This shouldn't affect anything in FB since there is always a `.hdf`.
Reviewed By: @markw65
Differential Revision: D1025781
gdb traps calls to a function named __jit_debug_register_code,
and updates its internal symbol tables.
Apparently gdb-7.2 was prepared to demangle the name,
while gdb-7.6 is not.
Reviewed By: aravind
Differential Revision: D1026295
We want to be able to timeout waiting for external thread event
completion in order to order correctly with async sleeps.
Reviewed By: @jano
Differential Revision: D1018706
The expect files were containing a bit too much infomration. Now they just contain name of test and status. No other data.
Also increased the timeout (mostly because of the time for pear) and tried to text align the csv output as best I could.
Some minor other changes too
@ptarjan: You should run the graph script with --csv and --csvheader ... modify the script to handle the header that comes each time we append.
Reviewed By: @ptarjan
Differential Revision: D1025044
StoreImmPatcher is currently subtracting the wrong offset (not
taking into account the extra instruction emitted) when setting m_addr.
Closes#1210
Reviewed By: @markw65
Differential Revision: D1025861
FrozenVector now supports serialize() and unserialize().
Additionally, as a result of the above, var_dump(some_frozen_vector)
now gives a more meaningful output.
Reviewed By: @paroski
Differential Revision: D1013734
Correctly populate the instanceBits of each class so that "fast path"
taken by the JIT correctly supports traits implementing interfaces.
Reviewed By: @swtaarrs
Differential Revision: D1023165
After stubbing out ZipArchive, there were a few issues that caused complilation problems. This fixes those.
- Add a string argument to NotImplementedException
- Change CStrRef to const String&
- I think "null" should be "void" in the typemap; otherwise you get "static null HHVM_METHOD" type functions.
Reviewed By: @sgolemon
Differential Revision: D1025577
To sync the folly submodule the first time, you'll need
to issue:
git submodule init
git submodule update
From then on, you'll also want to make sure folly is up to
date by issuing `git submodule update` after a `git pull`.
This allows to use annotations in Doctrine 2 ORM Entities.
Fixes 225 unit tests in doctrine/doctrine2.
Fixes 118 unit tests in doctrine/annotations (100% passes now).
Closes#1199
Reviewed By: @paroski
Differential Revision: D1019739
Pulled By: @scannell
Change RegAllocInfo from a 1D SSATmp->RegisterInfo map to a
2D IRInstruction,SSATmp->RegisterInfo map. This lets the register
allocator assign a different register or spill slot to a single
SSATmp at different locations during its lifetime.
Reviewed By: @ottoni
Differential Revision: D1021754
... it's not germane to the purpose of the tests: nor is it
sustainable to continue to add/remove the names of system traits from
these tests. A possible alternative is to pass a flag to
get_declared_classes|traits to exclude systemlib builtins.
Reviewed By: @paroski
Differential Revision: D1023627
The old magic number was pretty shamefully bad. It's
definitely no 0xC01O55A1B0B51ED5, but maybe this is a little better
than what it was ...
Reviewed By: @edwinsmith
Differential Revision: D1019412
Differential Revision: D1025644
The JIT will crash in some situations with these. We can end
up going to cgAssertType with a constant src, which will break when it
didn't have registers.
Reviewed By: @swtaarrs
Differential Revision: D1019432
I was trying to understand what this function does, and this
made it a bit easier for me to follow the logic (less nesting).
Reviewed By: @andralex
Differential Revision: D1018846
This information is available in the IR so let's get it from there
instead of NormalizedInstruction. This is part of my crusade to minimize
IRTranslator's role and eliminate NormalizedInstruction.
Reviewed By: @ottoni
Differential Revision: D1020925
This kind of logic doesn't belong in IRTranslator, especially since
it's a thin layer we'd like to eventually get rid of.
Reviewed By: @oyamauchi
Differential Revision: D1020911
If the names are really constant, they should be available to
HhbcTranslator. If there are any cases where they're not available, we should
make them available.
Reviewed By: @jdelong
Differential Revision: D1020897
This code was quite old and was using predicted types and strings
passed in from fields on NormalizedInstruction, which will be going away
soon. It's been changed to just use the information we already have available
in m_evalStack and rely on the optimizations/prediction support we have now. I
also fixed a bug where the name string wasn't being consumed on every path by
reworking who's responsible for destroying it.
Reviewed By: @jdelong
Differential Revision: D1020885
filterAssertType is used by some upcoming code to handle things like
assserting {InitNull|Obj<C>} when the known type is Obj. I also cleaned up how
we handle invalid types from static analysis. We used to replace the assert
instruction with a Fatal, but we can still end up generating bogus IR if we
continue translating. The best thing to do (for now) is to punt on the whole
trace, since there's no clear way to create well-formed IR for the whole thing.
Reviewed By: @jdelong
Differential Revision: D1020613
LdRef now removes any specialization from what we think is in the
inner type, to avoid having to guard on it again. This produces a value
specialized with the current context class. Weak type constraints go through
the process of finding the appropriate guard to constrain but don't actually
constrain the guard. They can be used to determine if we can use a specialized
type without having to add any additional guards, which I'll need to do in an
upcoming diff.
Reviewed By: @ottoni
Differential Revision: D1020843
I'm planning on eliminating the inputs vector soon. Reading types from
it (instead of HhbcTranslator) can bypass guard relaxation, and the information
is all available elsewhere. This diff just includes the straightforward cases;
the more invasive bytecodes will come in separate diffs.
Reviewed By: @ottoni
Differential Revision: D965348
When HHVM can't bind to a port it tries to shut down the
currently running instance using /stop on the admin port, but
RuntimeOption::ServerIP was blank (do we actually set this anywhere?)
and we weren't passing the admin password.
Reviewed By: @markw65
Differential Revision: D944849
This diff changes how region translation operates, with the goal of
improving code locality. Instead of triggering retranslation at a
translation granularity, this diff changes things so that only
translations corresponding to the function-body entry trigger
retranslations. The other translations still keep their profile
counters, which are used to guide region formation.
When an optimized retranslation is triggered for a function, a series
of regions is created for this function. These regions ensure that
all profiling translations for this function (and control flow arcs
connecting them) are covered by the regions created. The regions are
then translated consecutively in the TC, following an order that tries
to improve the locality of the generated code.
After a function has been regionized, any retranslation that is
triggered by new live types uses the tracelet JIT.
Reviewed By: @swtaarrs
Differential Revision: D1017506
Had I been smarter when I started this project, I would have done this from the begining. It used to be a hodgepodge of some implementation in headers and others in .cpp. When I would import a new extension I had to fight importing all the new macros and function signatures, putting them in their right place or else I will get compile errors.
So, I spent today cleaning up this story. Now all headers are original Zend (codemodded with tabs to spaces) with any changes I needed to make wrapped in a `#ifdef HHVM`. That way if I ever want to re-import I can slice it and insert it easily. It also has the nice property that the old code is right there so you can compare at the glance what I am doing and what they are doing.
I updated the README to explain the file structure.
I talked to @jdelong and @markw65 about a good long-term solution. @jdelong things we should code to the API and not share any implementation, @markw65 prefers compile errors but said link errors would be ok. He just doesn't think I should pull in all the implementations and force run-time errors since those would be hard to debug. I think having their `.h` files and our own `.cpp` is a good compromize for now.
Reviewed By: @paroski
Differential Revision: D983907
This is the biggest extension on pecl. Most of their tests depend on a server implementation which I don't really want to package into our test infra yet.
Many of the tests don't pass, but I want to get this up for review with the passing tests since i think many of the changes are good.
Reviewed By: @paroski
Differential Revision: D979397
It's not explicitly listed, but we can't have Catch, Fault or
DV entry offsets inside of FPI regions, so I added that. Also update
a little bit about Cuf iters.
Reviewed By: @edwinsmith
Differential Revision: D1019493
This was a little more convenient for the bytecode
representation I'm using (it's nice but not critical that all opcodes
with subops only have a single subop). Also hook up to assembler
while here.
Reviewed By: @alexmalyshev
Differential Revision: D1022933
If you don't run some of the optimization passes, sometimes
scalar arrays from UnaryOpExpression will have sub-members that are
other UnaryOpExpressions, which isn't handled here. It looks like
getScalarValue is there for this.
Reviewed By: @edwinsmith
Differential Revision: D1017234
Some cleanup of DCE, attempting to get rid of IRTrace where
it's not needed. A lot of DCE deals explicitly with traces so I'll
leave that for the another diff.
Reviewed By: @edwinsmith
Differential Revision: D1023480
postorderWalk() chooses which successor blocks to visit based on
trace; it visits main->exit edges first, to bias towards visiting
them sooner. (So they'll be later in reverse-postorder).
This diff uses block hints instead. This will result in slightly
different order for if/then/else regions with an Unlikely arm, that
were entirely on the same trace. But it should be equivalent for
main->exit edges since exit blocks are all marked Unlikely.
Reviewed By: @jdelong
Differential Revision: D1022275
There were two problems. First, jmpTarget() wasn't recognizing jumps
properly because I was looking at the wrong instruction bits. Then,
smashing unconditional jumps wasn't implemented.
Reviewed By: @jdelong
Differential Revision: D1021956
This is mainly what's holding us back in test/quick. There's a lot of
stuff going on here:
- Adding code-gen-helpers-arm.cpp. There's a practical need for this:
we're starting to write out a lot of calls to C++ functions, which
should be abstracted out because it happens differently depending on
whether we're simulating ARM or running on native ARM.
- Initialize rStashedAR when starting the simulator. This was a bug.
- Change the order of pushing x29 and x30 around calls to properly mimic
the x64 stack frame.
- Implement fcallHelperThunk.
- Templatize a couple of vixl functions to let us move pointers into
registers without reinterpret_cast. Also fill the simulator stack with
junk before starting up a simulator; in an early version of this diff
we were actually reading from the stack out-of-bounds. It wasn't
causing any bugs, but let's get out ahead of that.
Reviewed By: @jdelong
Differential Revision: D1019980
Prior to this change, Logger::Info and Logger::Verbose were going to
stdout, which can easily break scripts.
I didn't see any Logger::Info or Logger::Verbose call sites, which assume that
their output is going to stdout.
Reviewed By: @paroski
Differential Revision: D962372
Wow, our json parser has diverged so much from zend. This is basicaly what theirs does. More importantly, this is correct.
Sadly I don't think is the memory corruption bug.
Reviewed By: @scannell
Differential Revision: D1021678
This diff reimplements array_diff() and array_diff_key() to be more
performant and to support collections.
The new implementation is more than 5x faster the old implementation on a
number of micro-benchmarks I tried, with some of the micro-benchmarks
showing as much as a 40x improvement.
Reviewed By: @dariorussi
Differential Revision: D1019693
- Fix issue with composer timing out on downloading dependencies
- Try to reduce or eliminate deadlocking by using individual repos for each framework run
- Add Mediawiki to the frameworks; Remove typo3 since the tests are running correctly
- Simplified the expect files to just have test and status
- Other modifications
I have decided I need to refactor this thing a bit. May try to parallelize it more. Probably make some classes. Etc. For example, I should add a --jit and --nojit mode, probably.
Reviewed By: @ptarjan
Differential Revision: D1022337
UnpackCont is troublesome to interp-one; it doesn't even work in x64
mode. It translates to a single IR instruction, so this just implements
codegen for that.
In the process of debugging, I discovered that the stack-chasing for
UnpackCont was getting the order of its stack outputs wrong.
Reviewed By: @edwinsmith
Differential Revision: D1020297
IR translation for CGetL2 was assuming the top element on the stack was
a Gen, but it can also be a Cls. StackElem unifies these two types, and
is what we want.
Reviewed By: @swtaarrs
Differential Revision: D1022105
Why do I need that?
On devservers I need to be able to store certain APC keys without them
being automatically evicted when the TTLLimit expires, i.e. to simulate
the "primed" behavior in sandboxes, which don't have apc_prime.so.
The cost of rebuilding these keys can negatively impact the sandbox
performance.
The function name is intentionally scary do discourage the unintentional
use (which mimics the www conventions).
Reviewed By: @dariorussi
Differential Revision: D1016718
I think the need for m_func has been subsumed by every instruction
having a BCMarker. This is a mechanical change; m_func was dead.
Reviewed By: @ottoni
Differential Revision: D1019715
This is slightly less optimal than running the function enter event in
the exit trace, but it's significantly simpler and safer. I might investigate a
better solution some time in the future.
Reviewed By: @mikemag
Differential Revision: D1020793
Removed a superflous template argument for the Dispatcher,
replaced void* m_opaque for typed m_context.
Reviewed By: @jdelong
Differential Revision: D988558
I want to be able to run these headless, and with the `git@` urls it tries my public key first.
Reviewed By: @JoelMarcey
Differential Revision: D1020293
The list command was using the the string "line2", cunningly disguised as the static string variable 'line1' to look for the line where a func/class/method starts. Also, the file name it got for systemlib.php was expected to always be exactly "systemlib.php" but it turns out this is no longer the case, or at least not always.
Reviewed By: @mikemag
Differential Revision: D1018535
Changed cmd_step to check at onBeginInterrupt if the file line is empty i.e. returns as ":0"
In this case continue stepping
Reviewed By: @mikemag
Differential Revision: D1017420
While processing tiff tags, the end pointer was not updated
after a realloc. Also, while processing IFD tag, end and begin pointers
were switched.
Closes#1154Closes#1193
Reviewed By: @ptarjan
Differential Revision: D1019738
Pulled By: @scannell
Fix clowny error in zend-strtod.cpp on ARM platforms that passed through the PHP internals mailing list
Reviewed By: @JoelMarcey
Differential Revision: D1019758
In the region compiler we can create side exits due to
user-level control flow, and we'd like the side exit to not go through
Astubs after it's been chained, if possible. This optimization is
almost like what we already have for CheckStk and CheckLoc, but we
need it for Jcc's too.
Reviewed By: @jdelong
Differential Revision: D1019242
This diff adds two functions to the FBUnserializer API, which I need to use.
1. done(), check whether the whole string is unserialized (I need it to make sure the fbobject/assoc range unserialize consumes all the input and didn't leave anything undecoded (and lost parts of the data).
2. getSerializedMap. I ran into a case that the map (structure data) comes first in the result, but the needed info (structure data fbtype) comes after that. I need to record the serialized map somewhere and then redecode the map with the fbtype.
Reviewed By: andrii
Differential Revision: D1018331
'brew update' to a newer icu4c on OS X exposed that we aren't
being consistent in how we include it resulting in linker errors due to
confusion regarding what the icu namespace is.
Reviewed By: @sgolemon
Differential Revision: D1019529
In ArrayInit constructor, n is defined as ssize_t, but negative values
are not handled in any way. We should point that out to callers by
making n of type size_t.
Reviewed By: @edwinsmith
Differential Revision: D1017631
People keep asking me how to verify their upgrade worked and I tell them to print this constant. Then they always ask why is it still named HPHP. Good question.
I left the old one. Maybe we can kill it in 6 months?
Reviewed By: @sgolemon
Differential Revision: D1019640
I modded the OSS version of the repo last week to keep it
building on gcc 4.6. After much discussion we're setting the
minimum version at 4.7 and rather than sync these hacks internally
we'll be reverting them from the OSS side.
Makes doing IR dumps faster. (Ideally we'd combine this with
the one for Disasm but it's probably not a big difference and this
helped for now.)
Reviewed By: @swtaarrs
Differential Revision: D1013823
tc-print used to assume that all the bytecodes in a translation were
in the same function. This was a fine assumption, but now we have inlining so
that's often not true. TransBCMapping now holds an MD5 to identify the unit it
came from. This is then used while printing bytecodes to look in the correct
unit. I included a few other small tweaks:
- Better alignment for some output, and replace a lot of snprintf with
folly::format
- systemlib is embedded in the tc-print binary so it can be loaded at startup
(it's not in production repos)
- The native func and class units are generated at startup
- Function names are printed in translation summaries
- Bytecode offsets are printed in decimal instead of hex, to match conventions
elsewhere
Reviewed By: @ottoni
Differential Revision: D1016351
* @ eval() was not being silenced correctly
* If the string passed to eval() hits a parse error, then the runtime
is not supposed to fatal. We currently do.
* Errors in eval() code did not print a valid file name, they now
print it as "$FILENAME($LINE1) : eval()'d code on line $LINE2"
Closes#945
Reviewed By: @jdelong
Differential Revision: D1006603
The lower-level assembler infra is there, but this addressing mode
wasn't exposed in the public-facing API. This will allow us to generate
better code for stuff like smashable jumps, which I've included in this
diff. (Previously, it was one instruction to compute an address and
another one to load; now it's just a load.)
Reviewed By: @jdelong
Differential Revision: D1017834
Doctrine unit tests calls one of these two methods (sqliteCreateFunction). We fatal because we do not support it. The PHP docs says these functions are experimental, but let's not fatal if we don't have to.
http://www.php.net/manual/en/pdo.sqlitecreatefunction.php
With this diff (and a Doctrine patch that fixes some interface issues it was having), we no longer fatal in Doctrine! We do, however, fail a lot of tests.
Reviewed By: @ptarjan
Differential Revision: D1017386
Pear and Magento now run correctly with unit testing. I had to do an additional download for PEAR via the new
pull request mechanism, but it works out well. Neither fatal! :)
Reviewed By: @ptarjan
Differential Revision: D1018560
The interface problem ended up being a problem with Dbal (a dependency). This was fixed via a fork from the main dbal repo, but hasn't been merged into the main repo yet.
The script is updated to support pull requests.
Reviewed By: @ptarjan
Differential Revision: D1017683
This fixes a couple of asserts I hit running www in DEBUG mode with
-vEval.JitPGO=1 -vEval.JitRegionSelector=hottrace
-vEval.JitPGOHotOnly=0.
Reviewed By: @ottoni
Differential Revision: D1016284
For arrays that hold ~150 million or more elements, we need to
allocate more than 4GB of ram. computeAllocBytes used to return a uint32_t so
we were truncating the real size and allocating a lot less memory than we
needed.
Reviewed By: @jdelong
Differential Revision: D1016732
This is the last big chunk of code emission logic in tx64. The path to
getting stuff working in ARM is now blocked by function prologues, so
this needs to happen now.
Function prologues are delicate and messy, so this change isn't 100%
straight code motion.
- The call-array prologue stuff was quite smooth, and all the changes
are mechanical.
- funcPrologue() turned out to have a pretty big and easily separable
chunk of x64-specific code in the middle, sandwiched between big
chunks of platform-agnostic code. I pulled out the platform-specific
part into the new module I created.
- All the function-guard smashing stuff is very platform-specific so got
pulled out as well.
Reviewed By: @ottoni
Differential Revision: D1013868
Using names more in line with Func::prettyPrint and using full
names for builtins makes it a lot more clear what is going on.
Reviewed By: @hermanventer
Differential Revision: D1016225
This diff shouldn't change behavior at all; it just
initializes these values so that if you call fullName() on a
TypeConstraint where isTypeVar is true you get a predicatable result.
Reviewed By: @dariorussi
Differential Revision: D1015647
This test is testing that we don't assume that a successful
parameter type hint implies anything about the type of the parameter,
but we explicitly do this in repo mode.
Reviewed By: @dariorussi
Differential Revision: D1015116
This is currently only used to print the name of a type
constraint when an extended type hint is failing. I'm using it for
tracing in another context, so I want to it to print different things
for "?Foo" vs "Foo $x = null" hints.
Reviewed By: @dariorussi
Differential Revision: D1014903
Adding Type::StaticArr was breaking the simplification logic for
OpSame, since it was checking for precise equality of types.
Reviewed By: @edwinsmith
Differential Revision: D719215
I need access to the DataType field, and accessing metaType()
directly is more convenient than going through the isFoo functions
(and if you use switch it also means we can get warnings when people
add new metatypes). Some cleanup along the way (e.g. pull
equivDataTypes out of there, group related members a little more,
etc).
Reviewed By: @dariorussi
Differential Revision: D1014535
This function returned true if the type had isHHType(), which
it will always if EnableHipHopSyntax=1. The flag was 0x16 instead of
0x10, and isSoft() just does return m_flags & Soft.
Reviewed By: @dariorussi
Differential Revision: D1014812
... so that production builds (perflab) work for a bit.
Reverts commit ab87fc08420d56555ade1c5eec1ff4411edf5804.
Reviewed By: @swtaarrs
Differential Revision: D1013669
When the 'out' command is issued and flow is inside a called function that will not return value, debugging should continue from the line following the call. We do that by stepping over a PopR if we encounter one after performing 'out'.
Reviewed By: @hermanventer
Differential Revision: D1016061
The CheckBounds instruction used to emit two calls to the throw
helper, and we'd try to reference the same catch trace twice. I considered
supporting that but it's faster to just do a single unsigned comparison
anyway. This diff also fixes a case where we'd incorrectly think we were
specializing SetM with a Pair base.
Reviewed By: @jdelong
Differential Revision: D1013820
We added rate for tracking hhvm's response code. But this is not a good stats to
use. Rate is defined as (sum / time period). So that means, if we have 59 500s
in the last 1 minute, the rate will still be 0.
Switching to sum will give us better precision and better metric.
This will make it easier for us to monitor the RC roll out.
Reviewed By: jmarch
Differential Revision: D1015363
This diff fixes a few things I ran into while debugging an unrelated
issue:
- The request counter was global and not synchronized. It's not critical for
there to be no races on this counter but it's not a perf-sensitive path so I
can't see any reason to not fix it.
- The HeaderMangle warning is now more informative, including the entire set of
received headers. It also prints at most one warning per request, though that
warning may have multiple lines.
- The code to actually put the headers in $_SERVER['HTTP_*'] was looping over
the vector of values for each header, assigning each one to the same key in
$_SERVER. Unless I'm missing something really subtle, this is equivalent to
just assigning the final element of the vector to the key, so I changed it to
do that.
Reviewed By: @markw65
Differential Revision: D1010458
This removes some coupling between linear-scan.cpp and codegen.
The lifetime information is based on the linear numbering that
only matters to linear scan.
Reviewed By: @swtaarrs
Differential Revision: D1013874
I think this dates back to a time when member instructions
had arg types called "LA", which eventually got renamed, and now "LA"
means local argument. Rename this.
Reviewed By: @markw65
Differential Revision: D1011765
The NullUninit opcode implies that cells on the stack can be
uninit pretty much anywhere, but in practice we only need this for
default arguments to FCallBuiltin. Make that a bytecode invariant
using stack flavors.
Reviewed By: @markw65
Differential Revision: D1011749
They assert in debug builds in the interpreter, and cause the
JIT to assume the types are as specified. I only added a few types
based on my current needs; we can add more as needed, and I didn't
hook it up to any of our region selection or tracelet analyzer stuff.
Reviewed By: @markw65
Differential Revision: D1011114
It's nice to look at profiled CFG's with TRACE=pgo:5. This
makes it easier to find which one you want to look at.
Reviewed By: @jdelong
Differential Revision: D1013062
I had previously copied this file for ProxygenServer. Instead, make it generic so it can test any server. The "TestServer" test is now "TestLibEventServer". The new proxygen test includes this source file (as well as main.cpp), so they could perhaps be a library. I made two tests virtual because the current proxygen instantiation can't pass them.
Reviewed By: @markw65
Differential Revision: D1004360
Refactor the takeover logic to not be libevent specific, so it can be reused for ProxygenServer. Creates a takeover agent which handles the socket takeover procedure and ultimately hands off an fd for the caller to use.
Note: it seems to me that the old LibEventServerWithTakeover::stop() had a concurrency bug, because it accessed the eventBase outside of the dispatcher thread.
Reviewed By: @markw65
Differential Revision: D1004326
Collapsing the *WithFd functionality directly into LibEventServer. ProxygenServer will mirror this capability. Also changed the LibEventServer ctor to take a ServerOptions parameter.
Reviewed By: @markw65
Differential Revision: D1004307
We need to ensure that m_mode is reset after each
translation attempt.
There was already code in TranslatorX64::translate to reset
it, but after setting it in TranslatorX64::retranslateOpt,
its not certain that we'll get there.
Reviewed By: @swtaarrs
Differential Revision: D1012330
- Fix some of the tracelet-guard tests to actually be testing/comparing
the right thing. I wasn't paying enough attention to byte vs. word
loads before.
- Don't call EmitLiteralPool unless there are literals. Even if there
are no literals, if you call that function, vixl emits a "marker"
instruction so it knows how big the pool is, but that's not needed.
- Add support for stack-chasing through interp-ones of FPushCtor and
FPushCtorD. Without this, we assert-fail when anything consumes the
output type of one of these bytecodes, because we've forgotten that
the output type is Obj.
With this, 180 tests in test/quick fail. The lion's share of them are
due to unimplemented service requests, but there are a few crashes too.
I'll probably go after the unimplemented service requests next.
Reviewed By: @jdelong
Differential Revision: D1009911
In versions after 2.7.8 (the one we use) if you parse a poorly formatted xml document, it leaves the bad namespace as part of the node name. In this test, that means it was looking for a function named `ns1:sum`.
I'm making the xml document better formatted. As far as I can tell (from reading their code), zend has this same behavior. They don't have a test with a poorly formatted input.
Here is my cpp test the behaves differently on 2.7.8 and 2.8.0
#include <libxml/parserInternals.h>
#include <string.h>
int main() {
const char* buf = "<ns1:sum>1</ns1:sum>";
xmlParserCtxtPtr ctxt = xmlCreateMemoryParserCtxt(buf, strlen(buf));
ctxt->sax->error = NULL;
xmlParseDocument(ctxt);
printf("%s\n", ctxt->myDoc->children->name);
xmlFreeParserCtxt(ctxt);
}
compiled with
/usr/include/libxml2 a.cpp -lxml2 && ./a.out
Reviewed By: @markw65
Differential Revision: D1013435
Many people have asked what the message you get when you run `hhvm` is. I was thinking of making a real usage thing. Anyone have an idea for the most common use cases? What I have here is better than nothing.
I'm sure there is some fancy C++-ism so I don't need that stupid extra boolean constructor. Input welcome.
Reviewed By: @markw65
Differential Revision: D1013406
this test has nothing to do with the stderr, so lets not require that we can write to some random file
Reviewed By: @markw65
Differential Revision: D1013443
CMake uses rpath to make it easier to run built executables from the build
tree without installing prerequisite libraries first. This means that when
installing, CMake will re-link the binary in order to change the rpath so
it works properly in an install. Unfortunately, it's not smart enough to know
to re-embed the systemlib section, so the installed `hhvm` binary does not
have a systemlib section and doesn't work.
This commit adds a cmake function `HHVM_INSTALL` that effectively bypasses the
standard install command to ensure that the binary is not relinked. To help
with rpaths, this also checks for the existance of the `chrpath` tool. If it
exists, it uses it to either remove or replace the rpath entry in the file,
otherwise it just leaves the rpath entry alone.
This allows `make install` to work again.
HipHop VM (HHVM) is a new open-source virtual machine designed for executing programs written in PHP. HHVM uses a just-in-time compilation approach to achieve superior performance while maintaining the flexibility that PHP developers are accustomed to. HipHop VM (and before it HPHPc) has realized > 5x increase in throughput for Facebook compared with Zend PHP 5.2.
HHVM (aka the HipHop Virtual Machine) is a new open-source virtual machine designed for executing programs written in PHP. HHVM uses a just-in-time compilation approach to achieve superior performance while maintaining the flexibility that PHP developers are accustomed to. To date, HHVM (and its predecessor HPHPc before it) has realized over a 9x increase in web request throughput and over a 5x reduction in memory consumption for Facebook compared with the Zend PHP 5.2 engine + APC.
HipHop is most commonly run as a standalone server, replacing both Apache and modphp.
HHVM can be run as a standalone webserver (i.e. without the Apache webserver and the "modphp" extension). HHVM can also be used together with a FastCGI-based webserver, and work is in progress to make HHVM work smoothly with Apache.
## FAQ
Our [FAQ](https://github.com/facebook/hiphop-php/wiki/FAQ) has answers to many common questions about HHVM, from [general questions](https://github.com/facebook/hiphop-php/wiki/FAQ#general) to questions geared towards those that want to [use](https://github.com/facebook/hiphop-php/wiki/FAQ#users) or [contribute](https://github.com/facebook/hiphop-php/wiki/FAQ#contributors) to HHVM.
Our [FAQ](https://github.com/facebook/hhvm/wiki/FAQ) has answers to many common questions about HHVM, from [general questions](https://github.com/facebook/hhvm/wiki/FAQ#general) to questions geared towards those that want to [use](https://github.com/facebook/hhvm/wiki/FAQ#users) or [contribute](https://github.com/facebook/hhvm/wiki/FAQ#contributors) to HHVM.
## Installing
You can install a [prebuilt package](https://github.com/facebook/hiphop-php/wiki#installing-pre-built-packages-for-hhvm) or [compile from source](https://github.com/facebook/hiphop-php/wiki#building-hhvm).
You can install a [prebuilt package](https://github.com/facebook/hhvm/wiki#installing-pre-built-packages-for-hhvm) or [compile from source](https://github.com/facebook/hhvm/wiki#building-hhvm).
## Running
You can run standalone programs just by passing them to hhvm: `hhvm my_script.php`.
HipHop bundles in a webserver. So if you want to run on port 80 in the current directory:
HHVM bundles in a webserver. So if you want to run on port 80 in the current directory:
```
sudo hhvm -m server
```
For anything more complicated, you'll want to make a [config.hdf](https://github.com/facebook/hiphop-php/wiki/Runtime-options#server) and run `sudo hhvm -m server -c config.hdf`.
For anything more complicated, you'll want to make a [config.hdf](https://github.com/facebook/hhvm/wiki/Runtime-options#server) and run `sudo hhvm -m server -c config.hdf`.
## Contributing
We'd love to have your help in making HipHop better.
We'd love to have your help in making HHVM better.
Before changes can be accepted a [Contributor License Agreement](http://developers.facebook.com/opensource/cla) ([pdf](https://github.com/facebook/hiphop-php/raw/master/hphp/doc/FB_Individual_CLA.pdf) - print, sign, scan, link) must be signed.
Before changes can be accepted a [Contributor License Agreement](http://developers.facebook.com/opensource/cla) ([pdf](https://github.com/facebook/hhvm/raw/master/hphp/doc/FB_Individual_CLA.pdf) - print, sign, scan, link) must be signed.
If you run into problems, please open an [issue](http://github.com/facebook/hiphop-php/issues), or better yet, [fork us and send a pull request](https://github.com/facebook/hiphop-php/pulls). Join us on [#hhvm on freenode](http://webchat.freenode.net/?channels=hhvm).
If you run into problems, please open an [issue](http://github.com/facebook/hhvm/issues), or better yet, [fork us and send a pull request](https://github.com/facebook/hhvm/pulls). Join us on [#hhvm on freenode](http://webchat.freenode.net/?channels=hhvm).
If you want to help but don't know where to start, try fixing some of the [Zend tests that don't pass](hphp/test/zend/bad). You can run them with [hphp/test/run](hphp/test/run). When they work, move them to [zend/good](hphp/test/zend/good) and send a pull request.
All the open issues tagged [Zend incompatibility](https://github.com/facebook/hiphop-php/issues?labels=zend+incompatibility&page=1&state=open) are real issues reported by the community in existing PHP code and [frameworks](https://github.com/facebook/hiphop-php/wiki/OSS-PHP-Frameworks-Unit-Testing:-General) that could use some attention. Please add appropriate test cases as you make changes; see [here](hphp/test) for more information. Travis-CI is integrated with this GitHub project and will provide test results automatically on all pulls.
All the open issues tagged [Zend incompatibility](https://github.com/facebook/hhvm/issues?labels=zend+incompatibility&page=1&state=open) are real issues reported by the community in existing PHP code and [frameworks](https://github.com/facebook/hhvm/wiki/OSS-PHP-Frameworks-Unit-Testing:-General) that could use some attention. Please add appropriate test cases as you make changes; see [here](hphp/test) for more information. Travis-CI is integrated with this GitHub project and will provide test results automatically on all pulls.
## License
HipHop VM is licensed under the PHP and Zend licenses except as otherwise noted.
HHVM is licensed under the PHP and Zend licenses except as otherwise noted.
## Reporting Crashes
See [Reporting Crashes](https://github.com/facebook/hiphop-php/wiki/Reporting-Crashes) for helpful tips on how to report crashes in an actionable manner.
See [Reporting Crashes](https://github.com/facebook/hhvm/wiki/Reporting-Crashes) for helpful tips on how to report crashes in an actionable manner.
Alguns arquivos não foram exibidos porque demasiados arquivos foram alterados neste diff
Mostrar Mais
Referência em uma Nova Issue
Bloquear um usuário
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.