Commit Graph

1453 Commits

Author SHA1 Message Date
Nikita Nefedov
19759a5602 Fix RECV opcode to handle all kinds of exceptions
fix RECV opcode to handle exceptions thrown from user-defined error handler
as a result Notice error from failed type coercion
2016-04-20 08:40:44 -07:00
Xinchen Hui
f768a2ea3b Merge branch 'fix-recv-opcode-handle-exception' of https://github.com/nikita2206/php-src 2016-04-20 08:40:11 -07:00
Nikita Nefedov
ed9a1a9d68 Fix RECV opcode to handle all kinds of exceptions
fix RECV opcode to handle exceptions thrown from user-defined error handler
as a result Notice error from failed type coercion
2016-04-20 11:56:07 +03:00
Dmitry Stogov
f484801483 Reduced amount of code generated for interrupt handling.
Improved ZEND_VM_INTERRUPT_CHECK() placement (always perform checks after opcode handler completion, when instruction pointer value is alredy changed to the next opcode).
2016-04-20 11:06:52 +03:00
Nikita Popov
d79288c6bb Merge branch 'PHP-7.0' 2016-04-18 22:46:36 +02:00
Nikita Popov
73958ca62d Fix SEND_USER as well
Missed copy&paste code here
2016-04-18 22:45:38 +02:00
Nikita Popov
5a538e1d82 Merge branch 'PHP-7.0' 2016-04-18 18:26:30 +02:00
Nikita Popov
a8792158bd Fix SEND_ARRAY+PREFER_REF SHM corruption
Make the behavior consistent between namespaced and not and with
PHP 5.6.
2016-04-18 18:26:20 +02:00
Xinchen Hui
b5d01ab5a1 Merge branch 'PHP-7.0'
* PHP-7.0:
  combine conditions
2016-04-18 19:14:30 +08:00
Xinchen Hui
aa9f8e695c combine conditions 2016-04-18 19:13:54 +08:00
Nikita Popov
12f42346a8 Merge branch 'PHP-7.0' 2016-04-16 22:34:32 +02:00
Nikita Popov
d1a38743a5 Fix SEND_UNPACK array separation
Separating only immutable arrays is not enough.
2016-04-16 22:33:23 +02:00
Bob Weinand
3ed4a592aa Merge branch 'PHP-7.0' 2016-04-16 20:38:10 +02:00
Bob Weinand
15d1d4f45b Fixed bug #72038 (Function calls with values to a by-ref parameter don't always throw a notice) 2016-04-16 20:36:19 +02:00
Nikita Popov
dd6c6b1c48 Cleanup condition in SEND_VAR_NO_REF
Was overly convoluted after the IS_VAR_RET_REF removal.
2016-04-16 14:32:48 +02:00
Nikita Popov
64f91774f2 Remove IS_VAR_RET_REF flag
Instead decide whether a function returned by reference or by value
by checking whether the return value has REFERENCE type. This means
that functions returning by reference must always return a reference
and functions returning by value must not return a reference.
2016-04-15 15:32:20 +02:00
Dmitry Stogov
562d6315b1 Optimize zend_binary_assign_op_dim_helper() 2016-04-14 02:35:53 +03:00
Dmitry Stogov
e95efb6312 Move rare cases of DO_FCALL into separate helpers. 2016-04-13 20:13:17 +03:00
Dmitry Stogov
85f35a8fc1 Separate unspecializeble code of INCLIDE_OR_EVAL into helper functions 2016-04-13 15:29:01 +03:00
Dmitry Stogov
f48b20721c ASSIGN_ADD micro optimization 2016-04-13 02:47:17 +03:00
Dmitry Stogov
a809444b64 Delay IS_UNDEF check for FETCH_DIM_W and family 2016-04-13 01:19:20 +03:00
Dmitry Stogov
0b3e2fe2b1 Delay IS_UNDEF check for FETCH_DIM_R and family 2016-04-13 00:05:19 +03:00
Dmitry Stogov
23b65bf732 Reuse zend_fetch_dimension_address_read() for FETCH_LIST 2016-04-12 22:53:01 +03:00
Dmitry Stogov
43b1618023 Added missing "goto" 2016-04-12 22:15:16 +03:00
Dmitry Stogov
eaf489ac2b Optimize ASSIGN_DIM (separate common unspecializeble code into helper functions). 2016-04-12 19:36:24 +03:00
Nikita Popov
fea822fe1b Merge branch 'PHP-7.0' 2016-04-12 14:44:43 +02:00
Nikita Popov
4e585eb429 Fix ZEND_SEPARATE for by-val func returning ref zval 2016-04-12 14:44:29 +02:00
Nikita Popov
6a2eee520a Drop unnecessary ZEND_SEPARATE code
The following write ops will separate if necessary.
2016-04-12 14:44:29 +02:00
Dmitry Stogov
ef0099918f Separate unspecializeble code of INIT_DYNAMIC_CALL into separate helper functions. 2016-04-12 14:41:06 +03:00
Dmitry Stogov
8453b78113 Improve zend_leave_helper() by checking all rare conditions at once. 2016-04-11 13:17:24 +03:00
Dmitry Stogov
513b9929a1 removed useless ckeck (ZEND_HANDLE_EXCEPTION never uses RETURN_VALUE) 2016-04-08 16:12:32 +03:00
Dmitry Stogov
a186ac0e47 IS_CONST operands don't have to be separated. Use reference-counting instead of duplication.
- with opcache all IS_CONST operands are not refcounted (scalars, interned strings or immutable arrays)
- without opcache IS_CONST operands are not shared between processes or threads and may use common reference counters
2016-04-05 20:09:14 +03:00
Dmitry Stogov
32d6ac4ddf RETURN micro optimization 2016-04-05 16:45:15 +03:00
Dmitry Stogov
d0c6c179cd Initialize op_array->run_time_cache on slow path of INIT_FCALL opcode and omit corresponding check on fast path of DO_FCALL. 2016-04-05 00:01:00 +03:00
Dmitry Stogov
7abfaac901 Merge zend_execute_data->called_scope into zend_execute_data->This.
"called_scope" made sense only for static method calls, for dynamic calls it was always equal to the class of $this.
Now EG(This) may store IS_OBJECT + $this or IS_UNUSED + "called_scope" (of course, "called_scope" may be NULL).
Some code might need to be adopted to support this change.
Checks (Z_OBJ(EX(This))) might need to be converted into (Z_TYPE(EX(This)) == IS_OBJECT).
2016-04-01 16:17:49 +03:00
Dmitry Stogov
86a1aeed22 Flags ZEND_CALL_RELEASE_THIS and ZEND_CALL_CLOSURE should never be set together.
Closures keep responsibility for releasing $this theirselves.
2016-03-31 18:58:13 +03:00
Dmitry Stogov
fcbe1e8edf Use CALL_INFO flag to check if we need to destroy symbol_table.
This saves one memory load on most RETURN opcodes.
2016-03-31 18:47:25 +03:00
Xinchen Hui
0a2746fb4b Merge branch 'PHP-7.0'
* PHP-7.0:
  Fixed bug #71914 (Reference is lost in "switch")
2016-03-29 17:14:48 +08:00
Xinchen Hui
2e6d70787c Fixed bug #71914 (Reference is lost in "switch") 2016-03-29 17:14:36 +08:00
Nikita Popov
8e5b139732 Evaluate arguments of new for classes without ctor
ML: http://markmail.org/message/4b3mk7jid64zvz34
2016-03-25 19:11:37 +01:00
Andrea Faulds
37c8bb5868 Allow specifying keys on list() elements
Squashed commit of the following:

commit 0361dbe356
Author: Andrea Faulds <ajf@ajf.me>
Date:   Fri Mar 25 16:59:20 2016 +0000

    UPGRADING and NEWS

commit dca9d4a36c
Author: Andrea Faulds <ajf@ajf.me>
Date:   Fri Mar 25 16:45:18 2016 +0000

    Add tests contributed by @jesseschalken

commit e557f77eab
Author: Andrea Faulds <ajf@ajf.me>
Date:   Fri Mar 25 16:44:51 2016 +0000

    Rebuild VM

commit 70942e4c3c
Author: Andrea Faulds <ajf@ajf.me>
Date:   Wed Feb 24 13:12:26 2016 +0000

    Add test for evaluation order of nested list() keys

commit ed3592e80c
Author: Andrea Faulds <ajf@ajf.me>
Date:   Wed Feb 24 12:42:04 2016 +0000

    Add test for evaluation order

commit 589756cbcc
Author: Andrea Faulds <ajf@ajf.me>
Date:   Tue Jan 19 17:29:34 2016 +0000

    Allow arbitrary expressions for key

commit 3f622077c3
Author: Andrea Faulds <ajf@ajf.me>
Date:   Tue Jan 19 17:45:10 2016 +0000

    Remove compile-time HANDLE_NUMERIC (see bug #63217)

commit bab758119a
Author: Andrea Faulds <ajf@ajf.me>
Date:   Sun Jan 17 01:20:26 2016 +0000

    Handle numeric strings

commit 14bfe93ddc
Author: Andrea Faulds <ajf@ajf.me>
Date:   Sun Jan 17 01:09:36 2016 +0000

    Allow trailing comma

commit f4c8b2cb30
Author: Andrea Faulds <ajf@ajf.me>
Date:   Sat Jan 16 23:47:11 2016 +0000

    Add tests

commit 0085884a61
Author: Andrea Faulds <ajf@ajf.me>
Date:   Sat Jan 16 22:24:23 2016 +0000

    Handle non-integer/string opcodes

commit e572d2d0ad
Author: Andrea Faulds <ajf@ajf.me>
Date:   Sat Jan 16 21:10:33 2016 +0000

    Disallow mixing keyed and unkeyed list() elements

commit cede13ccfe
Author: Andrea Faulds <ajf@ajf.me>
Date:   Sun Jan 10 20:46:44 2016 +0000

    list() with keys (no foreach or tests)
2016-03-25 17:18:42 +00:00
Dmitry Stogov
60b72e434b Avoid data bypass delays between integer and floating point execution units on x86 CPUs. 2016-03-21 13:03:30 +03:00
Dmitry Stogov
fc7cbdce61 Squashed commit of the following:
commit 98471821a8
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Mar 17 21:56:04 2016 +0300

    Fixed wrong constant usage

commit 8183b811e7
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Mar 17 21:10:23 2016 +0300

    Added ability to serialize and serialize opcode handlers for file-cache

commit 3516b261de
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Mar 17 10:11:59 2016 +0300

    Added missed file

commit f4475a2360
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Mar 17 10:00:45 2016 +0300

    Transparently introduce type-specialized opcode handlers.
    This affects only PHP VM, and doesn't change anything else.
2016-03-17 22:00:27 +03:00
Xinchen Hui
f3dd50d650 Merge branch 'PHP-7.0'
* PHP-7.0:
  Fixed test script
  Update NEWS
  Fixed bug #71841 (EG(error_zval) is not handled well)
  Fixed bug #71840 (Unserialize accepts wrongly data)

Conflicts:
	Zend/zend_vm_def.h
	Zend/zend_vm_execute.h
2016-03-17 15:26:40 +08:00
Xinchen Hui
fe1a3fc08b Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  Fixed bug #71841 (EG(error_zval) is not handled well)
  Fixed bug #71840 (Unserialize accepts wrongly data)

Conflicts:
	Zend/zend_vm_def.h
	Zend/zend_vm_execute.h
	ext/standard/var_unserializer.c
2016-03-17 15:22:44 +08:00
Xinchen Hui
5546f8be56 Fixed bug #71841 (EG(error_zval) is not handled well) 2016-03-17 15:16:47 +08:00
Xinchen Hui
73e8c08788 Sorry for that... Merged by accident....
Revert "Transparently introduce type-specialized opcode handlers."

This reverts commit 59d00b8bcc.
2016-03-17 11:59:15 +08:00
Xinchen Hui
a4b2f7f3a9 Revert "Taking into account "undefined" variables"
This reverts commit 9020086a13.
2016-03-17 11:58:59 +08:00
Xinchen Hui
b9aed47a7a Fixed Bug #71824 (null ptr deref _zval_get_string_func (zend_operators.c:851)) 2016-03-17 11:56:32 +08:00
Dmitry Stogov
9020086a13 Taking into account "undefined" variables 2016-03-16 04:20:43 +03:00
Dmitry Stogov
59d00b8bcc Transparently introduce type-specialized opcode handlers.
This affects only PHP VM, and doesn't change anything else.
2016-03-16 03:36:58 +03:00
Dmitry Stogov
827a7a180b Added possibility for extra specialization for SMART_BRANCH (e.g. IS_EQUAL+JMPZ superinstruction). 2016-03-11 12:17:03 +03:00
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
Xinchen Hui
3537e95dae bump year which is missed in rev 49493a2 2016-01-02 17:51:24 +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
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
Xinchen Hui
f56534e4b9 Fixed Bug #70332 (Wrong behavior while returning reference on object)
This fix is actually made for array acessing bug fix (#70262) which is
discarded since we have another better fix, anyway now seems this is still useful
2015-08-23 20:17:51 +08:00
Dmitry Stogov
9b1570a378 Removed deprecated comments and added expectations (overloaded properties and array elements are less frequently used than regular ones) 2015-08-19 12:21:14 +03:00
Xinchen Hui
e543769fa4 Fixed bug #70288 (Apache crash related to ZEND_SEND_REF) 2015-08-18 21:45:19 +08:00
Xinchen Hui
8df3461086 Improved fix for bug #70262 2015-08-18 18:07:31 +08:00
Dmitry Stogov
ce89fd9758 Fixed bug #70262 (Accessing array crashes PHP 7.0beta3) 2015-08-17 12:58:14 +03:00