Commit Graph

1154 Commits

Author SHA1 Message Date
Aaron Piotrowski
ffd36e0fc8 Throw Error on dynamic call to instance method when called statically 2015-06-30 07:07:17 +02:00
Dmitry Stogov
4a2e40bb86 Use ZSTR_ API to access zend_string elements (this is just renaming without semantick changes). 2015-06-30 04:05:24 +03:00
Dmitry Stogov
4bd22cf1c1 Improved zend_string API (Francois Laupretre)
Squashed commit of the following:

commit d96eab8d79
Author: Francois Laupretre <francois@tekwire.net>
Date:   Fri Jun 26 01:23:31 2015 +0200

    Use the new 'ZSTR' macros in the rest of the code.

    Does not change anything to the generated code (thanks to compat macros) but cleaner.

commit b352643910
Author: Francois Laupretre <francois@tekwire.net>
Date:   Thu Jun 25 13:45:06 2015 +0200

    Improve zend_string API

    Add missing methods
2015-06-29 16:44:54 +03:00
Dmitry Stogov
1bba4452e7 Reverted wrong fb08798c9f 2015-06-29 12:20:09 +03:00
Dmitry Stogov
8e923197b4 Fixed bug #69955 (Segfault when trying to combine [] and assign-op on ArrayAccess object). (Laruence) 2015-06-29 11:17:56 +03:00
Bob Weinand
fb08798c9f Fix bug #69957 (Different ways of handling div/mod by zero) 2015-06-28 18:22:59 +02:00
Xinchen Hui
a486294e7d Unused ret 2015-06-28 19:16:00 +08:00
Aaron Piotrowski
ba67fc2218 Fix 'Class::method' indirect call with empty method name 2015-06-25 19:37:52 -05:00
Nikita Popov
ddf41d3aeb Fix generator memory leak
Make sure HANDLE_EXCEPTION and generator unwinds stay in sync in
the future by extracting a common function.
2015-06-20 18:37:28 +02:00
Nikita Popov
c7f4c5a2fe Avoid unnecessary separations in VERIFY_RETURN_TYPE 2015-06-20 14:12:59 +02:00
Dmitry Stogov
a524a375d9 Improved class type hints checks, by caching resolved class entries in run-time cache. 2015-06-17 12:07:43 +03:00
Dmitry Stogov
3e57e50fb0 Removed useless #ifdef 2015-06-16 17:17:49 +03:00
Dmitry Stogov
48ed660cdf Make CALL VM with FP and IP in global registers not to return anything from opcode handlers.
Set OPLINE to NULL to terminate VM loop instead.
This saves 1 CPU instruction for each opcode handler.
2015-06-16 14:11:16 +03:00
Nikita Popov
5d3cf577aa Make convert_to_* safe with rc>1
This only involves switching zval_dtor to zval_ptr_dtor for arrays
and making the convert_to_object for arrays a bit more generic.

All the other changes outside zend_operators.c just make use of
this new ability (use COPY instead of DUP).

What's still missing: Proper references handling. I've seen many
convert_to* calls that will break when a reference is used.

Also fixes bug #69788.
2015-06-11 23:23:57 +02:00
Dmitry Stogov
51dbf73954 Fetch operands of opceodes for binary operators in certain order (from left to right). 2015-06-10 22:25:24 +03:00
Dmitry Stogov
7f39ee7159 Delay checks for undefined CV variables after checks for fast paths. 2015-06-05 01:53:32 +03:00
Dmitry Stogov
aca6a1a1c9 Convert "switch" into series of "if". This allows better fast-path placement, additional specialization and makes final code less. 2015-06-04 19:14:16 +03:00
Dmitry Stogov
0040efb170 Avoid useless copying and duplication 2015-06-04 19:13:40 +03:00
Dmitry Stogov
f07d770f0b Specialize out useless checks. Only IS_VAR may be EG(error). 2015-06-04 17:20:37 +03:00
Dmitry Stogov
2fcdad6a58 Removed useless code (there is nothing to free for string offsets). 2015-06-03 22:23:06 +03:00
Dmitry Stogov
36c36ee56d Removed dead code (IS_CONST operand can't be IS_OBJECT) 2015-06-03 19:29:03 +03:00
Dmitry Stogov
544fb5c7bc Separate rare used increment/decrement/assign_op of overloaded properies into non inlined functions. 2015-06-03 18:44:25 +03:00
Dmitry Stogov
58dc22cc13 Reorder conditions to check for fast paths first 2015-06-03 17:20:47 +03:00
Dmitry Stogov
ce2a78939d isset() micro-optimisation 2015-06-03 16:27:38 +03:00
Dmitry Stogov
b21191ba78 Removed commented code 2015-06-03 14:49:29 +03:00
Dmitry Stogov
c09698753e CONCAT optimization 2015-06-03 11:15:28 +03:00
Dmitry Stogov
0d054f5faf Avoid useless duplication. Constant values have to be duplicated only for internal constants in ZTS build, to prevent simultaneous modification of reference counters from different threads. 2015-06-02 12:01:34 +03:00
Dmitry Stogov
ce862a25d5 Reorder conditions to check for fast paths first. 2015-06-01 17:22:04 +03:00
Bob Weinand
b73f87b1e4 Add test for memory leak with wrong return type 2015-05-27 01:37:00 +02:00
Bob Weinand
f7f7d6e385 Fix memory leak with return types upon failure
TMP/VAR wasn't being freed in VERIFY_RETURN
2015-05-27 01:18:06 +02:00
Dmitry Stogov
18cd4b17cc Fixed typo 2015-05-25 19:20:52 +03:00
Dmitry Stogov
c436e25fd5 Fixed bug #69700 (tests/lang/this_assignment.phpt memory errors) 2015-05-25 18:29:31 +03:00
Nikita Popov
8542befa7b Remove ZEND_BRK/ZEND_CONT from VM
These are no longer used at run-time now, only temporarily during
compilation.
2015-05-23 10:51:33 +02:00
Nikita Popov
9325ada725 Embed break/continue depth into opline
Previously a separate lval literal was used - this is probably a
leftover from the time where the break level could still be
specified dynamically.
2015-05-23 10:51:33 +02:00
Nikita Popov
d0e265392f Drop FREE_ON_RETURN flag, check brk_cont->start instead
Start >= 0 already tells us whether or not the loop has a loop
variable, no need to add extra flags to opcodes.

Also added a test for a case where FREE_ON_RETURN is relevant,
we didn't seem to have any coverage for this.
2015-05-23 10:51:33 +02:00
Dmitry Stogov
d6bcf2bf2e Micro optimization 2015-05-20 22:51:45 +03:00
Dmitry Stogov
cee88571d9 Fixed bug #69649 (segfault with --enable-dtrace) 2015-05-18 12:44:40 +03:00
Nikita Popov
0df2f470fa Don't write prop if read prop threw exception 2015-05-17 13:46:54 +02:00
Dmitry Stogov
fc75d07652 Fixed memory leak 2015-05-14 17:07:32 +03:00
Dmitry Stogov
d72a94468e Merged FE_FETCH_R[W] with the following ASSIGN[_REF] when assigne to CV. 2015-05-13 12:55:42 +03:00
Dmitry Stogov
0586702d32 Mark first call frames of stack segment with ZEND_CALL_ALLOCATED flag to simplify checks on stack deallocation. 2015-05-12 15:56:42 +03:00
Aaron Piotrowski
071111ecfc Add support for $callable() sytnax with 'Class::method'
Using the $callable() syntax when used with a string of
the form 'Class::method' would error as an undefined
function, even if the string passed is_callable() or the
callable type-hint. The fix adds support for the $callable()
syntax for any string accepted by is_callable() or the
callable type-hint.

Fix bug 68475 test with deprecated notice

Reduced scope of unit test.

Added tests with arguments.
2015-05-12 13:33:28 +02:00
Nikita Popov
8f9f21e8d2 Fix static closure error in call_user_func opcode
I'm assuming this is the only error that is_callable() can generate
with retval=1.

This problem manifested after making closures in static methods
not implicitly static, but would also occur when binding any non-static
closure to a scope without a $this.
2015-05-08 15:17:15 +02:00
Dmitry Stogov
a989c0a1a9 Improved fast path locality 2015-05-07 17:26:35 +03:00
Dmitry Stogov
ab4ccffc4c Avoid unnecessary reference counter incrementation on $this when call methods 2015-05-07 16:28:23 +03:00
Nikita Popov
d9c2959c27 Fix LSB handling for closures
Closures will now use the called_scope from their instantiation
site. If they are rebound either the class of $this is used or if
no $this is provided the bound scope is used.

With this change the scope for static closures can be changed back
to use EG(scope) rather than EX(called_scope), thus fixing
bug #69568.
2015-05-05 21:14:03 +02:00
Nikita Popov
dc546bdc4d Throw exception from FETCH_CLASS_NAME
Instead of empty strings.

This does not affect the existing case of __CLASS__ in traits as
a scope will always exists in that case.
2015-05-05 21:14:03 +02:00
Nikita Popov
dd1fdfb17c Use ZEND_FETCH_CLASS_NAME for dynamic self::class etc
Extend the opcode to support getting the parent and static name and
then use it for dynamic ::class resolution.
2015-05-05 21:14:03 +02:00
Dmitry Stogov
a8172353ba Micro optimization 2015-05-05 18:50:47 +03:00
Xinchen Hui
ce9248b6ef Merge branch 'PHP-5.6' 2015-05-04 19:26:07 +08:00