Gráfico de Commits

166 Commits

Autor SHA1 Mensagem Data
Sara Golemon 65a6125580 Match PHP's numeric type conversion rules for math functions
Null/Bool/Object get converted to numeric values.
Touches abs(), floor(), ceil(), and round().
2013-07-19 12:57:30 -07:00
Paul Tarjan 0335e335b7 build setAccessible
This implementation feels a bit haphazard with all the forces in the `o_*`. Is this stuff all changing dario?
2013-07-18 17:28:42 -07:00
Paul Tarjan 22f908f1d7 add some more constants that zend defines
`composer.phar` was using these, so we should probably define them. I made them match what we were giving for `PHP_VERSION`.
2013-07-18 17:28:40 -07:00
Joel Marcey ffab2c17f8 Implement SplObjectStorage::getInfo()
Implement SplObjectStorage::getInfo(). PHPUnit requires this method.
2013-07-15 15:46:32 -07:00
Sara Golemon ee8da60efa Releasing HipHop 2.1.0 2013-07-12 11:00:55 -07:00
Mike Magruder d1553bda9e Add simple functions to determine if a debugger is attached
Added two simple functions to determine if a debugger is attached, and to provide info about where the debugger is connected from. Also fixed a minor bug in ext_socket where the name for an unbound AF_UNIX socket would come back from getsocketname()/getpeername() as garbage.
2013-07-10 11:16:52 -07:00
Drew Paroski 84b9d9a3a2 Separate resources from objects, part 1
In HHVM (and HPHPc before it) we've been piggybacking resources on the
KindOfObject machinery. At the language level, resource is considered to
be a different type than object, and there are a number of differences
in behavior between objects and resources (ex. resources don't allow for
dynamic properties, resources don't work with the clone operator, the
"(object)" cast behaves differently for resources vs. objects, etc).

Piggybacking resources on the KindOfObject machinery has some downsides.
Code that deals with KindOfObject values often needs to check if the value
is a resource and go down a different code path. This makes things harder
to maintain and harder to keep parity with Zend. Also, these extra branches
hurt performance a little, and they make it harder for the JIT to do a good
job in some cases when its generating machine code that operates on objects.

This diff prepares the code base for a new KindOfResource type by adding a
new "Resource" smart pointer type (currently a typedef for the Object smart
pointer type) and it updates the C++ code and the idl files appropriately.
This diff is essentially a cosmetic change and should not impact run time
behavior. In the next diff (part 2) we'll actually add a new KindOfResource
type, detach ResourceData from the ObjectData inheritence hierarchy, and
provide a real implementation for the Resource smart pointer type (instead
of just aliasing the Object smart pointer type).
2013-07-10 11:16:33 -07:00
Kyle Delong 772c0cef17 Fix native Exception::setPreviousChain() fatal
Fixes a fatal in native Exception, which is missing parentheses on this method call.
2013-07-09 13:45:39 -07:00
Drew Paroski d336b46cc7 Merge ObjectData and Instance together, part 2
When object support was first added to HHVM, a class named "Instance"
was introduced (deriving from ObjectData) to represent instances of user
defined classes. Since then, things have evolved and HPHPc and HPHPi have
been retired, and now there really is no needed to have ObjectData and
Instance be separate classes anymore.

This diff moves all of the functionality from the Instance class to the
ObjectData and removes the Instance class. In the process, I got rid of
a bunch of dead methods and fixed some indentation and other style issues.
2013-07-08 10:30:57 -07:00
Drew Paroski 9edc07112b Merge ObjectData and Instance together, part 1
When object support was first added to HHVM, a class named "Instance"
was introduced (deriving from ObjectData) to represent instances of user
defined classes. Since then, things have evolved and HPHPc and HPHPi have
been retired, and now there really is no needed to have ObjectData and
Instance be separate classes anymore.

As a first step towards merging ObjectData and Instance together, this diff
puts their definitions in the same .h file and puts their implementations
in the same .cpp file. A few small changes were necessary to fix issues
with cyclical includes: (1) Repo/emitter related parts of class.cpp and
class.h were moved to class-emit.cpp and class-emit.h; (2) the contents of
"vm/core_types.h" was moved to "base/types.h"; and (3) a few functions that
didn't appear to be hot were moved from .h files and the corresponding .cpp
files.
2013-07-06 11:12:29 -07:00
mwilliams 74ca5cd27f fb_enable_code_coverage needs an ActRec
It tries to unwind the top, builtin frame, making
various assumptions that aren't true if it was called by
FCallBuiltin. In dbg builds, it asserts.
2013-07-02 11:46:26 -07:00
Eric Caruso 97a23e5ea7 Support for yield k => v;
Updates continuations to allow yielding of a key-value
pair from a generator. Adds bytecode instructions (PackContK,
ContKey) for using the new feature, and adds IR instructions
(ContUpdateIdx, ContIncKey) to help get it down to the metal
(in particular, ContIncKey attempts to keep the current use-cases
as fast as possible).
2013-07-01 13:41:00 -07:00
Sean Cannella 22c5361a24 redis fixes from github comments
- applying github comment fixes (thanks @staabm )
2013-06-27 13:00:37 -07:00
mwilliams 2c1919505f Allow hhas files to set the MayUseVV flag
If the last parameter is '...', set the MayUseVV flag
2013-06-27 12:59:28 -07:00
mwilliams 0632fb3a11 Allow .hhas to specify default values
It only matters for reflection, but hhas parameters with
default values need to specify the text of the string.

In addition, change reflection to report parameters with no
default value string as not having a default value, to avoid
crashing when trying to access it.

Update the "func" parameter of array_filter to have a valid
default. The other uses of defaults in array_map and array_filter
are just to get the proper behavior on too few/too many args,
and don't really correspond to default values.
2013-06-27 10:50:22 -07:00
Sara Golemon 2811e9da94 Implement Redis extension
PHP implementation of Redis
2013-06-25 13:19:10 -07:00
Eric Caruso 4a86eb9f1f Implement EmptyIterator, InfiniteIterator, NoRewindIterator
This makes 14 zend tests happy. It also requires some
real stupidity, but PHP iterators are weird.
2013-06-25 13:19:09 -07:00
Paul Tarjan 506f21c4b5 Allow extension functions to match zend calling convention
Introducing `ZendParamMode` to as a idl flag. We are not consistent with zend on how they do their params for builtins. We cast to the expected data type. They do some checks, and if the checks don't pass they issue a warning and return (usually) `null`. This diff starts us down that path.

I'm introducing the param and using it in the places where we were emulating the calling convention in the `f_foo` functions. I'm going to follow up with converting as many as I can and then eventually this becomes the default. I also want this to be applied to php files in systemlib.

Many of the conversions are from https://github.com/php/php-src/blob/master/Zend/zend_API.c#L305
2013-06-25 13:19:04 -07:00
Eric Caruso 533ed5d493 Implement LimitIterator
Implements LimitIterator from SPL.

Closes #788
2013-06-25 13:19:03 -07:00
bill fumerola 2096cd0acc GenMapWaitHandle - a BlockableWaitHandle that wait for a Map of WaitHandles
add GenMapWaitHandle, a compliment to GenVectorWaitHandle and GenArrayWaitHandle.
2013-06-25 12:22:59 -07:00
Paul Tarjan 63fc74a751 reflection for namespaced constants
In repo mode this does the right thing and returns the right constant, but for non-repo it thinks it is an undefined non-namespace constant. I'll have to do something more hardcore if that starts to matter

While I was in there, I made the correct name for `ReflectionParameter` that was added in 5.4 instead of the draft we copied.
2013-06-25 12:22:52 -07:00
Paul Tarjan b9058d036e add SessionHandler
In PHP 5.4 they added this class that encased the callback functions. The difficulty came with needing to fallback to the previously registered session handler.

Closes #792
2013-06-25 11:42:33 -07:00
Paul Tarjan 23c8e35811 make sysdoc.php not write WarningThis
Also, while I was in there I made the script not spew anything on the terminal.

@markw65 `array_filter` doesn't match the signature from php.net. Should it?
2013-06-25 11:42:32 -07:00
Paul Tarjan 3cbf137805 small fixes to SplFixedArray
`is_numeric` is a superset of `is_int` and 2 of these tests don't pass until we get Zend calling convention over stdlib.
2013-06-21 16:37:12 -07:00
Jordan DeLong 811b11711b Put a lid on test_ext for now
Hopefully stops the php file from auto-generating test stubs,
and adds a comment discouraging adding more of them.  For now I'll
stop porting the remaining ones to php: the left over tests mostly
start test servers, except TestExtTao and TestExtServiceRouter.
TestExtTao is kinda big, so I'm skipping it for now, and ServiceRouter
actually tests C++ functions (although it has a lot of use of the
smart pointer API), not extension functions.
2013-06-21 11:45:51 -07:00
Sean Cannella d1b3172352 remove hphp_process_abort
- Remove questionable hphp_process_abort debugging method
2013-06-21 11:44:40 -07:00
Joel Marcey 530efd6760 Add default values to parameters of SplFileObject::flock(),fwrite()
Trying to get CakePHP running on HHVM revealed warnings around SplFileObject flock() and fwrite(). E.g., HipHop Warning: flock() expects exactly 2 parameters, 1 given. Added default values for those particular parameters
2013-06-21 11:44:40 -07:00
Paul Tarjan 9fbfca6510 fix typo in SplFixedArray 2013-06-21 11:26:04 -07:00
parent5446 61ec6703fc Added missing PHP SPL classes
Added PHP implementations for PHP SPL classes that are currently missing from HHVM. These include:

- SplDoublyLinkedList
- SplQueue and SplStack
- SplFixedArray
- SplHeap, SplMinHeap, and SplMaxHeap
- SplPriorityQueue
- SplTempFileObject

Closes #807
2013-06-21 11:21:43 -07:00
Paul Tarjan fe323e4821 add filter extension 2013-06-19 09:56:50 -07:00
Paul Tarjan 28bbefa14d actually implement SplObjectStorage 2013-06-19 09:56:39 -07:00
Jordan DeLong 4cebdbe47d Remove the ImageSprite extension
Believed to be unused now.
2013-06-19 09:54:36 -07:00
Paul Tarjan 77cf51fb32 add session_register_shutdown
added in 5.4. The comments on http://php.net/manual/en/function.session-register-shutdown.php said this was equivilent.
2013-06-18 16:23:27 -07:00
Benjamin Strahs e35bded5b3 Add hash algos to openssl_verify
A bunch of hash algos are missing from openssl_verify(), this was fixed in PHP ( https://bugs.php.net/patch-display.php?patch=openssl-add-sig-algs.txt&bug_id=61421&revision=1340052451 ) and should be fixed in hhvm
2013-06-18 16:23:25 -07:00
bill fumerola 8b80373f17 expose Vector->reserve(size) to php space
example usage: genv() takes a Vector of Awaitable and creates a
Vector of WaitHandles. resize() requires a default value, reserve allows us to hint proper allocation.
2013-06-17 17:31:33 -07:00
Sara Golemon 27ef4c02cc Rename hphp/tools/gen-ext-hhvm to hphp/tools/bootstrap
gen-ext-hhvm actually contains three different
bootstrapping utilities:
* gen-ext-hhvm
* gen-infotabs
* gen-class-map

This move is just to give it a more contextually appropriate name.
2013-06-17 11:08:04 -07:00
Paul Tarjan 613295121f make debug_backtrace 5.4 compatible
This was spewing on mediawiki and we need to update. It is backwards compat.

I tried to put the constants in PHP but failed. I spent 30 mins on it. I'll come back to it next time I get the itch.

Closes #812
2013-06-15 23:32:07 -07:00
Paul Tarjan 140c537a90 add JSON_UNESCAPED_UNICODE
This is giving warnings on wikimedia and was implemented in 5.4
2013-06-15 23:32:07 -07:00
Drew Paroski e6b6aa0b09 Clean up the hphp/system folder
I noticed that directorty structure of hphp/system was a bit scattered, so
I consolidated things to reduce the total number of folders and to put
related things together with each other.

This diff moves the contents of "hphp/system/classes_hhvm" into
"hphp/system", it moves the contents of "hphp/system/lib" into
"hphp/system", moves "hphp/idl" to "hphp/system/idl", and moves the
contents of "hphp/system/globals" into "hphp/system/idl".
2013-06-15 23:29:49 -07:00
Herman Venter af0f28532a Cache the contents of systemlib.php for use by the debugger, if debugging.
Instead of calling get_systemlib every time the debugger client needs to list source from systemlib.php, use a cached copy of the source string. Only do this if debugging is enabled.
2013-06-15 19:33:45 -07:00
Sara Golemon c01bbf22de Translate gen_systemlib.php to bash
Remove another piece of PHP-dependant bootstrapping
2013-06-13 12:13:09 -07:00
Drew Paroski 7252c636ac Fix: Vector, Map, and StableMap should implement the Indexish interface 2013-06-13 10:25:47 -07:00
Paul Tarjan 6e62230978 RecursiveFilterIterator
simple
2013-06-13 10:25:42 -07:00
Sara Golemon 13a055efa4 Add gen-class-map.cpp for bootstrapping constants.h and class_map.cpp
Conversion of PHP versions so we don't need PHP to build HHVM

For the most part, the generated files haven't changed from the
PHP sourced versions (apart from minor indentation and whitespace
changes).

Except for one major exception:
An IDL's function/method argument list includes a "value" field
for default parameters which takes psuedo-serialized values in
several forms. Most are simple scalarish values like:
  "true", "null", "null_array", "null_variant",
  "123", "0x456", "0123", "1.23", "\"foo\""
However referencing other constants is also supported:
  "k_FOO", "q_Bar$$BAZ"
Or even bitmask compositions like:
  "k_FOO|k_BAR|k_BAZ"

Runtime uses of these values are encoded directly into *.ext_hhvm.cpp
files, so they reach userspace code just fine.

The value placed in g_class_map are used exclusively by ext_reflection
to allow introspection at runtime.  Under the old class_map.php parameter
default constant references would be resolved in a (somewhat buggy) eval(),
since we don't have eval within gen-class-map, we reuse the
kUnserializable deferral.

This diff provides a mechanism to resolve this in ReflectionMethod
uses (an improvement from previous behavior), and leaves the current
eval-on-demand behavior for ReflectionFunction.  These two code paths
are different due to the partial state of migration away from using
ClassInfo.
2013-06-12 15:38:53 -07:00
Owen Yamauchi 79224cdd38 Remove the hardcoded globals from GlobalNameValueTableWrapper
The ultimate goal is to de-virtualize ArrayData. To do this, we need a
single ArrayData subclass that has all the capabilities we need. This
2013-06-12 11:35:00 -07:00
mwilliams b967e102a0 Get rid of BuiltinSymbols at runtime
We were using BuiltinSymbols at runtime to identify
potential FCallBuiltin sites. Instead, we can lookup the Func*,
which already has all the information we need.
2013-06-11 11:48:24 -07:00
Jan Oravec 9662396bf0 Store variable arguments in optional local
Save 8 bytes of m_args and its initialization for Continuations without
func_get_args() call (does not save real memory due to 16-byte alignment).
Store variable arguments in optional local.
2013-06-11 11:48:06 -07:00
Paul Tarjan 7b6d06074c just thorw a regular exception
I'm not expecting a user to do anything actionable (other than open an issue) on this error so a regular Exception should be ok.
2013-06-10 10:14:11 -07:00
Sean Cannella 543927cc35 make PHP_SAPI dynamic based on execution mode
It isn't really a constant anyways.

Closes #757
2013-06-07 12:41:50 -07:00
Paul Tarjan 20ad8ba931 fix SplFileInfo->openFile
without a default class, opening a file doens't work so well

Closes #802
2013-06-06 12:00:08 -07:00