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
Switches Map and Set to use tracked allocators. Vector uses
smart_realloc which will require a bit more work.
Reviewed By: @edwinsmith
Differential Revision: D1146939
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
Update SimpleXML to be compliant with Zend and fix a bunch of
tests.
Closes#1387Closes#1530
Reviewed By: @ptarjan
Differential Revision: D1135882
Pulled By: @scannell
Intel VTune Amplifier XE
(http://software.intel.com/en-us/intel-vtune-amplifier-xe), the
performance analysis tool, supports mapping of performance data from IP
addresses to function names and source file/lines for custom JIT
engines; the engine should provide mapping from generated code to source
using JIT API (http://software.intel.com/en-us/node/458070). This patch
add the reporting to hhvm, allowing to profile PHP code execution and
see both generated assembly and PHP source for hotspots.
The reporting is controlled via Eval.JitUseVtuneAPI runtime option, so
the default behaviour is not affected. If the option is set and hhvm is
profiled by VTune, the information on compiled code is reported via JIT
API and stored in data file which is used during postprocessing and data
visualization.
The patch includes some files from VTune; the are distrubuted under BSD
license.
Closes#1254
Reviewed By: @ottoni
Differential Revision: D1133559
Pulled By: @scannell
After LdLoc went down, this is the next top punt. This forced me to get
the bind-call machinery working, and a bunch of other stuff -- it kind
of snowballed on me. Redispatching from prologues and handling stack
overflow also had to work. We were also forgetting to rewind the
globalData frontier if translation failed, and this change combined with
that to actually blow out globalData in a couple of tests.
Small bonus: deleting a bunch of "JIT::" that used to be "Transl::".
Reviewed By: @edwinsmith
Differential Revision: D1134414
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
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
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
This diff updates the implementation of array_shift to support mutable
collections. A very simple scheme was used to make Vector and Set support
adding elements to the front similar to what HphpArray currently does. I
leave improving the data structures' perf when adding elements to the front
to a subsequent diff.
Reviewed By: @elgenie
Differential Revision: D1140008
... attempting to use diff on expect files containing
non-printing characters doesn't seem like a good idea, and having
.expect that are treated as binary makes them hard to review.
Reviewed By: @hermanventer
Differential Revision: D1144149
(flaky www test)
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
If XLS spills a SIMD register, we need the spill slot to
be 16-byte aligned. Also the checkShuffle() assertions weren't
quite right when spilling/loading SIMD registers.
Reviewed By: @jdelong
Differential Revision: D1144168
SpillFrame is the next top punt after Call. This diff is preparation to
get the Call diff to pass all the tests. Also:
- I removed some code that I said I was going to remove in my last diff
but forgot. :/
- There was a bug in emitStore, where I was failing to zero-extend bool
srcs. This caused some interesting test failures once CallBuiltin was
implemented, because if you call a builtin that returns bool from C++,
you'll get garbage in the higher-order bytes.
- I had to increase the max number of arguments you can pass to a host
call.
- Finally, I moved the reserved-stack-space constants out of the X64
namespace and strengthened some of the asserts around the simulator's
stack pointer (I ran into this while working).
Reviewed By: @edwinsmith
Differential Revision: D1139057
Also rename linear-scan.h to reg-alloc.h, it still contains
a few leftover definitions and it's a useful place to put
declarations that don't depend on the implementation.
Reviewed By: @swtaarrs
Differential Revision: D1135081
This diff updates the implementation of array_unshift to support Vector
and Set for the first parameter. A very simple scheme was used to make
Vector and Set support adding elements to the front similar to what
HphpArray currently does. I leave improving the data structures' perf
when adding elements to the front to a subsequent diff.
Along the way, I fixed the behavior of array_unshift() to match PHP 5.5
in the case where the first parameter is not an array, Vector, or Set.
Reviewed By: @elgenie
Differential Revision: D1139932
Reported on freenode by nelt. The deepInitHelper code
assumes the result of any deep-initialized property is reference
counted. Since we recently changed opcodes that push static strings
to push KindOfStaticString, this means in the interpreter we'd hit an
assertion here. (The JIT was unaffected, and neither case does
anything wrong in an opt build.)
Reviewed By: @paroski
Differential Revision: D1144110
A straight-forward delegation to ArrayIter does the job.
After analysis of the uses of slicing code, it seems that slicing can
be confined to just the ext_array function, since the other uses for
func_get_args have been subsumed by special purpose bytecodes. Thus,
this diff also removes Array::slice, ArrayUtil::Slice, func_get_arg,
and func_get_args.
Reviewed By: @jdelong
Differential Revision: D1142189
... since StableMap is an alias for Map (as of {D1116834}),
there can be no collections of this type.
Reviewed By: @jdelong
Differential Revision: D1119658
* Turns ##c_StableMap## into a typedef for ##c_Map##
* ## StableMap ## and ## Map ## are both parse-time aliases for ## HH\Map ## (auto-imported under HipHopSyntax)
* Incorporates anietoro's {D1105491}.
Note: this cannot be committed until we're sure about the equality
semantics that make the most sense for the Map/StableMap hybrid (see {D1116829})
Reviewed By: @paroski
Differential Revision: D1116834
Same big-O complexity, but smaller constant factors ... iterate
~1/2 as many elements, generate 1 instead of n random numbers.
Reviewed By: @jdelong
Differential Revision: D1142089
Doing block->next() on an empty block causes an assertion
failure. While that should never happen in normal operation, it's
kind of annoying when you're in gdb and want to print a block without
checking first whether it's empty.
Reviewed By: @ottoni
Differential Revision: D1143080
Rather than building a way of iterating every collection in
reverse, `array_reverse` is accomplished by reversing the result of
converting the collection to an array.
Reviewed By: @paroski
Differential Revision: D1142062
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
- Disable sleep_await.php and curlUpload.php for being flaky
- Remove potentially flaky parts from ext_network.php
Reviewed By: @bertmaher
Differential Revision: D1143085
These were all causing me trouble with my upcoming diffs -- punting on
these was causing some tests to time out due to punting so much.
Reviewed By: @edwinsmith
Differential Revision: D1142730
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
Mainly interested in the perflab here, as looping over all the values
is certainly less efficient O(autoload-depth) as opposed to O(1).
Also, gets rid of the last use of Array::valueExists
Reviewed By: @scannell
Differential Revision: D1137619
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
DbgAssertRetAddr was useful when I was debugging a specific issue but
I think it's a bit excessive for general use. Don't emit it unless we ask for
extra asserts.
Reviewed By: @bertmaher
Differential Revision: D1140555
There's no case in ir-translator to get here, so this is dead
code. It looks like it was maybe trying to use a LdMem as a guard, so
I'm not going to try to turn this on---we can implement it later.
Reviewed By: @bertmaher
Differential Revision: D1136590
I didn't realize but of course they are generally
implied-nullable right now. (I think we'll eventually want a way to
plumb the nullability through and require things like ?array if it can
be null.) cc @Alite404Exception
Reviewed By: @dariorussi
Differential Revision: D1135647
I think this hasn't shown up yet because nothing has been
getting constprop'd with two inputs of different eval stack flavors.
Reviewed By: @dariorussi
Differential Revision: D1135575
A TODO was to look a the type of bases that aren't inside the
frame. I did this, but then I realized neither of these changes can
kick in yet. The couldBeThisObj needs support for unrelated object
types knowing they aren't related (#3343798), and the mustBeThisObj
will always say false if the base isn't in the FrameThis anyway,
because anything we know about a heap type must include InitNull at
least right now.
We might as well put this in as a test case for #3343798 though. (And
I clarified some comments about how refs work, and fixed something
wrong with BaseR wrt this.)
Reviewed By: @dariorussi
Differential Revision: D1135320
The JIT wasn't really able to use the private property
information from HHBBC, because by the time we saw an AssertT opcode
the property was already extracted.
This diff changes the hphpcType in each class' property info to a new
RepoAuthType struct which can contain both the kind of information
hhbbc can provide as well as what hphpc can provide. Sets the JIT up
to use it, and update prediction-opts to handle the hhbbc case (which
will now generate things like LdMem<Obj<Foo>|InitNull> instead of
LdMem<Cell>.)
A later diff will use the same RepoAuthType flag (plus the repo global
data) to fix the issue with unserialize() being able to break inferred
private property types.
Reviewed By: @ottoni
Differential Revision: D1135298
Many cURL extension tests require an HTTP server to be running
with a specific PHP file available.
Travis will now run this script using the built-in HHVM web server.
I've add skip files so if the user doesn't have the required environment
variable set it will skip the tests, just like PHP does.
Closes#1487
Reviewed By: @ptarjan
Differential Revision: D1117179
Pulled By: @scannell
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
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
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
Now that we removed the options from the config files we can remove the options in the code as well
Reviewed By: @jdelong
Differential Revision: D1135707
- This mostly just moves stuff around. The idea was to put everything that is f_mysql_ in ext_mysql and move everything else into mysql_common
- It also breaks up the query function into two parts because I need it for mysqli
- Doing the query
- And getting the result part
Reviewed By: @ptarjan
Differential Revision: D1106027
There's one test case that's giving me fits in trying to implement Call,
and if we were just codegen'ing these opcodes, the problem would just go
away. So here they are.
StLoc happens to be third most frequent punt. CheckStk forced me to get
the jump-chaining machinery working, and it's surprisingly simple.
Reviewed By: @ottoni
Differential Revision: D1136517
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
std::list is inconvenient for three reasons:
1. when splitting, we have to iterate to find the split position
even though we already have the interval we care about.
2. Loops that visit each split interval must do work for the
parent, then a separate loop for the child.
3. we never need the "prev" pointers
A plain 'next' pointer (aka intrusive singly-linked list) solves
all three problems.
Reviewed By: @bertmaher
Differential Revision: D1135956
In trying to implement codegen for the Call opcode, I'm running into
problems with the differences between ARM and x64's calling conventions,
specifically with regard to how they save return addresses.
Until now, our ARM code hasn't been treating the link register (the
return address register) like it's supposed to be treated. The register
is technically caller-saved, but normal ARM programs (such as C programs
compiled by gcc) don't save and restore it around callsites. Instead,
non-leaf functions just save it at the very beginning and restore it
just before returning, simply as part of setting up and tearing down the
frame.
What this means for us is that we're now saving it on the stack
immediately on entry to the TC, since, viewed through the traditional
calling-convention lens, the entire TC is a non-leaf function. This
means that we no longer need to save/restore around host calls.
Reviewed By: @edwinsmith
Differential Revision: D1133438
Summary: This splits the larger Travis test runs roughly evenly to
increase the chance that the tests will pass before hitting the timeout.
Reviewed By: ptarjan
Bytecodes that resolve strings to a class or a function need to normalize the string so it never starts with '\'
Reviewed By: @jdelong
Differential Revision: D1135085
Also, change the default size to match cli.hdf, so we don't
do a resize on command line scripts.
Reviewed By: @edwinsmith
Differential Revision: D1126293
This has been disabled since shortly after it was added,
since hphpc doesn't handle exception edges correctly and reports wrong
information.
Reviewed By: @swtaarrs
Differential Revision: D1135310
Quite a while back I perflabbed turning this off and saw red,
but I think it must've been noise. I ran perflabs with an
always_assert(0) in applyInputMetaData here and it never triggered.
Reviewed By: @edwinsmith
Differential Revision: D1133071
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
2013-12-02 13:27:17 -08:00
13017 arquivos alterados com 370874 adições e 113952 exclusões
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 precedessor 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.
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.
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.
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.