Commit Graph

1253 Commits

Author SHA1 Message Date
Nikita Popov
56f1106162 Use FETCH_CLASS_EXCEPTION for instanceof
This does not collide with NO_AUTOLOAD -- missing classes will be
silenced, but invalid use of self etc will result in an exception
instead of a fatal error.
2015-12-14 17:50:20 +01:00
Nikita Popov
7078627d22 Fix leaks due to UNUSED CE fetch 2015-12-14 17:31:37 +01:00
Nikita Popov
0919178963 Add result op for ASSERT_CHECK to fix SSA
Otherwise one source of the phi node at the join point will be
borked.

I'm marking the ASSERT_CHECK result as unused in pass2, which is
a bit ugly.
2015-12-14 12:31:00 +01:00
Nikita Popov
e8864c39e8 Don't check non-CVs for UNDEF in BOOL(_NOT) 2015-12-14 00:32:40 +01:00
Nikita Popov
2589dd121e Drop superfluous assignment
And fix a branch annotation.
2015-12-12 23:21:36 +01:00
Nikita Popov
8e5e3301a1 Make ZEND_CLONE return a TMP_VAR
As the return value can't be reference and it's unlikely to be
unused.

Also remove some unnecessary checks for ce==NULL. A ce is required
nowadays.
2015-12-10 22:16:25 +01:00
Nikita Popov
3d4a2d2002 Merge branch 'PHP-7.0'
Conflicts:
	Zend/zend_vm_def.h
	Zend/zend_vm_execute.h
2015-12-10 18:24:29 +01:00
Nikita Popov
37f3425263 Fix Foo::${42} and similar
Fixes segfault on direct use, segfault on opcache evaluated use,
leak on temporary use.

Fixes analogeous segfault for ${42} on opcache eval as well.
2015-12-10 18:14:40 +01:00
Dmitry Stogov
a75c195000 Implemented the RFC Support Class Constant Visibility.
Squashed commit of the following:

commit f11ca0e7a5
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Tue Dec 8 12:38:42 2015 +0300

    Fixed test expectation

commit 211f873f54
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Tue Dec 8 12:28:38 2015 +0300

    Embed zend_class_constant.flags into zend_class_constants.value.u2.access_flags

commit 51deab84b2
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Mon Dec 7 11:18:55 2015 +0300

    Fixed issues found by Nikita

commit 544dbd5b47
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Sat Dec 5 02:41:05 2015 +0300

    Refactored immplementation of https://wiki.php.net/rfc/class_const_visibility
    @reeze created an RFC here and I emailed internals here and didn't get any responses positive/negative.
2015-12-08 12:40:42 +03:00
Dmitry Stogov
868c3775c6 Merge branch 'PHP-7.0'
* PHP-7.0:
  Fixed bug #70997 (When using parentClass:: instead of parent::, static context changed)
2015-11-30 16:54:37 +03:00
Dmitry Stogov
25c5d185fc Fixed bug #70997 (When using parentClass:: instead of parent::, static context changed) 2015-11-30 16:52:57 +03:00
Xinchen Hui
7d80ab2e12 Addtional fixes of #70918 2015-11-16 18:19:22 +08:00
Xinchen Hui
06fe956460 Fixed Bug #70918 (Segfault using static outside of class scope) 2015-11-14 18:41:55 -08:00
Dmitry Stogov
3a5fa926bf Squashed commit of the following:
commit afe963e6cc289696e60c6c679796ba2197c52b3b
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Nov 13 15:32:29 2015 +0300

    Added news entry

commit a126b891c97848dd7ef8f1abf716328c46e0f19c
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Nov 13 15:29:21 2015 +0300

    VERIFY_RETURN_TYPE doesn't have to cleanup operand on exception, bacause now, live temporary variables are released by exception unwinder.

commit 0db475e98786e6bcaa8401ee3e0b33743b9a2f2b
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Nov 12 22:55:39 2015 +0300

    Fixed copy/paste

commit 0ac73fe7174bec9de9a610319a98b259bea67f7f
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Nov 11 16:11:50 2015 +0300

    Fixed bug #62210 (Exceptions can leak temporary variables)
2015-11-13 15:35:07 +03:00
Dmitry Stogov
948b7f5421 Changed ZEND_FREE.op2.num and ZEND_FE_FREE.op2.num back to use live_range_offset (try_catch_offset does't work) 2015-11-11 11:12:44 +03:00
Dmitry Stogov
71092b7c2b Make FE_FETCH and following assignments to be a part of a loop. 2015-11-10 20:11:05 +03:00
Dmitry Stogov
86a96f2cf1 Changed meaning of "op2" for ZEND_FREE, ZEND_FE_FREE, ZEND_FAST_CALL, ZEND_FAST_RET.
Previously it was an instruction number.
Now it's an index in op_array->try_cacth_array[].
2015-11-10 19:13:54 +03:00
Dmitry Stogov
6fe457f323 Merge branch 'PHP-7.0'
* PHP-7.0:
  Fixed incorrect order of free/finally on exception
2015-11-10 10:11:46 +03:00
Dmitry Stogov
d66d1b97aa Fixed incorrect order of free/finally on exception 2015-11-10 10:10:39 +03:00
Xinchen Hui
a4a767e6da Merge branch 'PHP-7.0'
Conflicts:
	Zend/zend_vm_execute.h
2015-11-03 17:56:05 -08:00
Xinchen Hui
2f2653aa77 Fixed bug #70805 (Segmentation faults whilst running Drupal 8 test suite) 2015-11-03 17:53:56 -08:00
Dmitry Stogov
3e89c883bb Changed ZEND_CLONE->extended_value meaning to relative offset (previously it was absolute opline number) 2015-10-30 14:53:53 +03:00
Dmitry Stogov
eb7be5379d Speed up fetching of class entries for self:: parent:: and static::
This is generalized solution for Bob's idea of speed up self::method() calls without ZEND_FETCH_CLASS.

At first, it adds few new opcodes to separate class related behaviour:
	FETCH_STATIC_PROP_R
	FETCH_STATIC_PROP_W
	FETCH_STATIC_PROP_RW
	FETCH_STATIC_PROP_FUNC_ARG
	FETCH_STATIC_PROP_UNSET
	FETCH_STATIC_PROP_IS
	UNSET_STATIC_PROP
	ISSET_ISEMPTY_STATIC_PROP
	FETCH_CLASS_CONSTANT

At seconds, it enables IS_UNUSED operand to fetch (self, parent or static without separate FETCH_CLASS) for new opcodes and the following ones:
	INIT_STATIC_METHOD_CALL
	NEW
	END_INSTANCEOF

Finaly, opcache optimizer had to be fixed to support new opcodes.
2015-10-28 21:26:52 +03:00
Dmitry Stogov
0172f198e3 Fixed inconsistent exception handling (uopz/tests/006.phpt was failed when PHP build with --disable-gcc-global-regs). 2015-10-26 16:01:20 +03:00
Xinchen Hui
5767f2b648 Fixed bug #70785 (Infinite loop due to exception during identical comparison) 2015-10-26 11:15:17 +08:00
Xinchen Hui
6ad2c3eb33 Revert "Ensure proper exception handling and EX(opline) state in USER_OPCODE handler"
read: http://news.php.net/php.internals/88887

This reverts commit 808f62bb4d.
2015-10-20 08:12:04 -07:00
Xinchen Hui
a8ae88162f Fixed bug #70689 (Exception handler does not work as expected) 2015-10-13 17:40:58 +08:00
Nikita Popov
cc3c425af8 Fix bug #70662
This replaces add_new with update for the RW case. This should not
be problematic for performance, as this branch throws a notice.

Alternatively add_new could also be replaced with add. I went with
update, because it makes $a[0] += 1 behavior the same as
$a[0] = $a[0] + 1.
2015-10-08 11:03:39 +02:00
Dmitry Stogov
24e88348f3 Revert "Merge branch 'array_keys_strict_refs' of https://github.com/tony2001/php-src"
This reverts commit a6be0f3fd6.
2015-10-06 23:48:12 +03:00
Dmitry Stogov
524d00e005 Revert "Allow random $this on non-internal Closures again"
This reverts commit 35d0405c47.
2015-10-06 23:48:10 +03:00
Dmitry Stogov
3c0348056a Revert "Speed up self::method() calls (no ZEND_FETCH_CLASS)"
This reverts commit 8c33bdb976.
2015-10-06 23:48:08 +03:00
Bob Weinand
8c33bdb976 Speed up self::method() calls (no ZEND_FETCH_CLASS) 2015-10-05 21:16:52 +02:00
Bob Weinand
35d0405c47 Allow random $this on non-internal Closures again
As it turns out, there is actually no reason to prevent this, it even was a bigger BC break than expected...

Also fixes a memory leak (the Closure leaks) when calling internal functions via Closure by moving it out of leave helper onto caller side for TOP_CODE:

$z = new SplStack; $z->push(20);
$x = (new ReflectionMethod("SplStack", "pop"))->getClosure($z);
var_dump($x());
2015-10-05 17:49:32 +02:00
Bob Weinand
a6be0f3fd6 Merge branch 'array_keys_strict_refs' of https://github.com/tony2001/php-src 2015-10-05 14:50:04 +02:00
Dmitry Stogov
7e797f1302 Allow an experimental VM with tail call dispatch technique (disabled by default).
This VM may work only if all tail calls are optimized, otherwaise it will crach because of stack overflow.
Unfortunately, we can't guarantee tail call optimization in C.
2015-09-25 12:54:51 +03:00
Bob Weinand
abf6a0b376 Fix missing LOAD_OPLINE() for ZEND_USER_OPCODE_LEAVE 2015-09-24 21:06:07 +02:00
Bob Weinand
808f62bb4d Ensure proper exception handling and EX(opline) state in USER_OPCODE handler 2015-09-24 20:33:57 +02:00
Xinchen Hui
1e3333e4bd Fixed Bug #70557 (Memleak on return type verifying failed) 2015-09-23 14:10:23 +08:00
Dmitry Stogov
f9ec5be888 Properly cleanup on wrong ZEND_OVERLOADED_FUNCTION call 2015-09-22 23:51:30 +03:00
Bob Weinand
b8f56013b5 Force compiler to prefer ZEND_CALL_NESTED_FUNCTION
It is by far the most used branch; compilers tended here to split the branches via an &2, &1 check, now it only does an &3 check and prefers ZEND_CALL_NESTED_FUNCTION branch
2015-09-19 19:49:44 +02:00
Xinchen Hui
517c59bfcb Suppressed warning -Wvolatile-register-var 2015-09-15 08:23:21 -07:00
Bob Weinand
b0174a14c0 Fixed bug #70478 (**= does no longer work)
Reordered ZEND_(ASSIGN_)POW opcodes in zend_vm_def.h so that it won't be missed in future
2015-09-12 00:54:48 +02:00
Dmitry Stogov
51aa1b5a1d Manual CSE to avoid double read 2015-09-11 14:13:41 +03:00
Dmitry Stogov
c174e4cd73 Change array sorting implementation to avoid two level callbacks system.
Simplify zval comparion API.
2015-09-10 02:51:23 +03:00
Dmitry Stogov
b1be126788 Avoid useless EG(exception) checks 2015-09-09 11:54:44 +03:00
Dmitry Stogov
c7dffb5673 Don't inline "Undefined variable" warning reporting. 2015-09-09 03:18:52 +03:00
Dmitry Stogov
bfab74d574 Check EG(exception) only if it's really necessary 2015-09-08 17:20:52 +03:00
Dmitry Stogov
745753eacb Prevent double load on fast path (manual common subexpression elimination) 2015-08-27 23:02:15 +03:00
Bob Weinand
c1e9bd27fe Fix zend_vm_call_opcode_handler (e.g. Generators throwing exceptions) with IP/FP registers 2015-08-26 00:25:25 +01:00
Dmitry Stogov
db5898c9e5 Optimize fast path 2015-08-24 12:47:06 +03:00