Commit Graph

1295 Commits

Author SHA1 Message Date
Dmitry Stogov
ff8337b783 Merge branch 'PHP-7.0'
* PHP-7.0:
  More effecient fix for bug #71756
2016-03-10 13:34:00 +03:00
Dmitry Stogov
f8506c062f More effecient fix for bug #71756 2016-03-10 13:33:36 +03:00
Francois Laupretre
370b7039e4 Add support for negative string offsets (syntax) 2016-03-09 14:41:37 +01:00
Nikita Popov
55c0de8f95 Merge branch 'PHP-7.0' 2016-02-24 17:44:33 +01:00
Nikita Popov
3ea877ca15 Fix "Call to member function on unknown"
Should be "on null".
2016-02-24 17:00:25 +01:00
Dmitry Stogov
0f39f080d1 Fixed incorrrect merge (regenrate zend_vm_execute.h) 2016-02-19 00:09:17 +03:00
Dmitry Stogov
8a6c5be106 Merge branch 'PHP-7.0'
* PHP-7.0:
  Better fix for bug #71622 (Strings used in pass-as-reference cannot be used to invoke C::$callable())
2016-02-18 23:15:28 +03:00
Dmitry Stogov
25fbb06e2d Better fix for bug #71622 (Strings used in pass-as-reference cannot be used to invoke C::$callable()) 2016-02-18 23:14:46 +03:00
Bob Weinand
2dc9aa9bea Merge branch 'PHP-7.0' 2016-02-18 13:54:19 +01:00
Bob Weinand
3ce6ad9d13 Fixed bug #71622 (Strings used in pass-as-reference cannot be used to invoke C::$callable()) 2016-02-18 13:53:15 +01:00
Xinchen Hui
4eb4a78bf0 Combine conditions (good for other VM kinds) 2016-02-15 11:12:04 +08:00
Nikita Popov
44ed1cb5c0 Remove ZEND_CALL_CTOR_RESULT_UNUSED
Instead emit a FREE on the result of NEW.
2016-02-11 22:15:11 +01:00
Nikita Popov
5faedf5b3e Remove EXT_TYPE_UNUSED in favor of IS_UNUSED
This means we no longer allocate an unused VAR for the retval of
instructions that support unused results.

Nearly all instructions already used the result variable only if
it was used. The only exception to this was the return value
variable for internal function call results. I've adjusted the code
to use a stack zval for the unused return case now. As we have
retval specialization now, we know that it doesn't matter.
2016-02-11 18:02:19 +01:00
Nikita Popov
68516091c1 Merge branch 'PHP-7.0' 2016-02-11 16:33:23 +01:00
Nikita Popov
9cebdc5d47 Fix yield-by-ref of constant
Typo in the condition...
2016-02-11 16:32:45 +01:00
Nikita Popov
7453348ca8 Merge branch 'PHP-7.0' 2016-02-11 16:25:55 +01:00
Nikita Popov
1322672c0b Fix dangling send target when using yield from
Also drop some unnecessary TRY_DELREFs -- leftovers from the days
when null was refcounted.
2016-02-11 16:25:16 +01:00
Dmitry Stogov
81721a7ddd Specialize DO_FCALL (and variations) according to used/unused return value 2016-02-05 15:46:52 +03:00
Dmitry Stogov
2f5a119281 Use extra specialization to eliminate run-time checks for conditions known at compile time in SEND_VAL_EX and SEND_VAR_EX. 2016-02-05 15:07:58 +03:00
Dmitry Stogov
ef98adce30 Specialize ASSIGN according to used/unused return value 2016-02-05 13:18:58 +03:00
Bob Weinand
00a2c30c59 Add extra VM operand specialization
For now RETVAL and OP_DATA= are supported
2016-02-04 16:49:50 +01:00
Dmitry Stogov
d510255879 Rename IS_ERROR into _IS_ERROR (to prevent redefinition on Windows). 2016-02-01 11:12:28 +03:00
Xinchen Hui
08e5dc461d Merge branch 'PHP-7.0' 2016-01-29 22:05:59 -08:00
Xinchen Hui
e062759401 Fixed bug #71485 (Return typehint on interanal func causes Fatal error when it throws exception). 2016-01-29 22:05:52 -08:00
Dmitry Stogov
86f54fcdf7 Use special type IS_ERROR instread of EG(error_zval). (we still need EG(error_zval) for SPL support). 2016-01-28 18:00:06 +03:00
Dmitry Stogov
e99fe9865e Merge branch 'PHP-7.0'
* PHP-7.0:
  Fixed bug #71474 (Crash because of VM stack corruption on Magento2).
2016-01-28 11:54:48 +03:00
Dmitry Stogov
6039d2d914 Fixed bug #71474 (Crash because of VM stack corruption on Magento2). 2016-01-28 11:41:15 +03:00
Dmitry Stogov
6579e48417 Introduced BIND_STATIC opcode instead of FETCH_R/FETCH_W(static)+ASSIGN/ASSIGN_REF (similar to BIND_GLOBAL).
In the future we may refer to static variable by index instead of name, to eliminate hash lookup.
2016-01-12 12:20:35 +03:00
Xinchen Hui
563659822d Merge branch 'PHP-7.0' 2016-01-02 17:56:54 +08:00
Xinchen Hui
97a9470d97 bump year which is missed in rev 49493a2 2016-01-02 17:56:11 +08:00
Nikita Popov
65e456f364 Introduce BIND_LEXICAL
This opcodes inserts a local CV into the closure static variable
table. This replaces the previous mechanism of having static
variables marked as LEXICAL, which perform a symtable lookup
during copying.

This means a) functions which contain closures no longer have to
rebuild their symtable (better performance) and b) we can now track
used variables in SSA.
2015-12-29 23:14:53 +01:00
Dmitry Stogov
00a3714e05 Support for optimization introduced in DFA pass (it may change type of instruction return oprand to IS_CV) 2015-12-23 19:02:14 +03:00
Xinchen Hui
70f9ba00f7 This check become useless after 98885bfa1e 2015-12-23 20:56:49 +08:00
Dmitry Stogov
98885bfa1e Consolidate indirect string offset modification checks (Nikita, Dmitry)
Check it once, instead of dozens of times.
2015-12-23 13:52:15 +03:00
Dmitry Stogov
6e6280a388 Corrected error messages:
- we don't use NULL for overlaoded objects for ages
- fixed array/object mess
2015-12-22 20:55:11 +03:00
Nikita Popov
88eae43ff9 Remove uses of VARs in extended_value
The DECLARE_(ANON_)INHERITED_CLASS(_DELAYED) opcodes were
referencing the parent ce VAR through extended_value. This is
hacky and we can't track the def-use chain in SSA.

To avoid this, the layout of declaration opcodes is changed
as follows: op1 points to the lcname and rtd_key literals, in
that order. (For anon/lambda declarations only one of lcname or
rtd_key is present.) This frees up op2, which is now used to
reference the parent ce VAR in inheriting declarations. The
jmp offset for anon class declarations is moved frop op2 to
extended_value.

The changes were applied both to class and function declarations
to keep everything symmetric.
2015-12-21 14:44:42 +01:00
Dmitry Stogov
1fe8a1dec9 Merge branch 'PHP-7.0'
* PHP-7.0:
  Fixed possible crash on Zend/tests/bug71154.phpt
2015-12-21 15:58:58 +03:00
Dmitry Stogov
0402f05ba3 Fixed possible crash on Zend/tests/bug71154.phpt 2015-12-21 15:57:53 +03:00
Nikita Popov
679fa3e03d Merge branch 'PHP-7.0' 2015-12-17 23:23:59 +01:00
Nikita Popov
a917840f38 Fixed iter leak on by-ref foreach over const/tmp array
FE_FREE does not unregister the iter for plain arrays. So always
wrap into a REF wrapper, even if not strictly necessary, in
RESET_RW. Alternatively we could use a flag to distinguish plain
positions and interators.

Also added a check for leaked iterators in shutdown_executor.
2015-12-17 23:21:48 +01:00
Dmitry Stogov
fe1c4e033f Merge branch 'PHP-7.0'
* PHP-7.0:
  Fixed incorrect exception handling
2015-12-17 14:17:01 +03:00
Dmitry Stogov
9e44b6a61e Fixed incorrect exception handling 2015-12-17 14:16:19 +03:00
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