Commit Graph

233 Commits

Author SHA1 Message Date
Nikita Popov
6aa045e174 Merge branch 'PHP-7.2' 2018-01-13 11:06:58 +01:00
Nikita Popov
cf70e1910b Merge branch 'PHP-7.1' into PHP-7.2 2018-01-13 11:06:46 +01:00
Nikita Popov
8c07170ddb Fix generator GC if yield from parent chain does not reach root
Parents may be unlinked while another generator sharing part of the
chain is running. As such, we cannot assume that the parent chain
goes all the way to the root. Instead walk backwards from root to
leaf, like we also do during destruction.
2018-01-13 11:04:26 +01:00
Nikita Popov
47e6c1491b Merge branch 'PHP-7.2' 2018-01-12 22:51:29 +01:00
Nikita Popov
d00f52b6a9 Merge branch 'PHP-7.1' into PHP-7.2 2018-01-12 22:51:20 +01:00
Nikita Popov
cab0a814bd Try to fix yield from GC issues
Make sure we always update root and parent references before
releasing the old root object.

This fixes some crashes under aggressive cycle collection, so
hopefully this will also fix bug #75351.
2018-01-12 22:51:03 +01:00
Nikita Popov
d8d20020f5 Merge branch 'PHP-7.2' 2018-01-12 21:28:31 +01:00
Nikita Popov
e112b8474a Merge branch 'PHP-7.1' into PHP-7.2 2018-01-12 21:28:24 +01:00
Nikita Popov
420d11e8ca Fixed bug #75396
Do not run finally blocks in generators on unclean shutdown (e.g.
caused by exit). This is consistent with how finally blocks outside
of generators behave.
2018-01-12 21:27:23 +01:00
Nikita Popov
5fef837c28 Simplify non-linear generator yield from tree
Remove special handling for 2-4 children. Now the three possible
cases are no children, one child, or many children (HT).

The non-linear (many children) case is extremely rare, so there is
no point in trying to optimize it.
2018-01-12 21:14:50 +01:00
Nikita Popov
27f09efa11 Avoid duplicate addition of generators in yield from tree 2018-01-12 18:37:47 +01:00
Dmitry Stogov
12c386f5b9 Use ZEND_CLOSURE_OBJECT() macro to resolve closure op_array to closure object through address calculation, instead of op_array->prototype reuse. (reapply 781e1573af, now it should be OK). 2018-01-11 22:15:45 +03:00
Dmitry Stogov
6ba10a03e7 Revert "Use ZEND_CLOSURE_OBJECT() macro to resolve closure op_array to closure object through address calculation, instead of op_array->prototype reuse." (this patch is incomplete or wrong)
This reverts commit 781e1573af.
2018-01-11 17:27:26 +03:00
Dmitry Stogov
781e1573af Use ZEND_CLOSURE_OBJECT() macro to resolve closure op_array to closure object through address calculation, instead of op_array->prototype reuse. 2018-01-11 16:25:28 +03:00
Xinchen Hui
a6519d0514 year++ 2018-01-02 12:57:58 +08:00
Xinchen Hui
7a7ec01a49 year++ 2018-01-02 12:55:14 +08:00
Xinchen Hui
ccd4716ec7 year++ 2018-01-02 12:53:31 +08:00
Dmitry Stogov
1db8402208 Move zend_object_iterator_funcs structures into read-only data segment 2017-12-14 14:21:22 +03:00
Nikita Popov
7b16205f8b Remove some unnecessary duplications 2017-10-30 22:48:20 +01:00
Dmitry Stogov
49ea143bbd Encapsulate reference-counting primitives.
Prohibit direct update of GC_REFCOUNT(), GC_SET_REFCOUNT(), GC_ADDREF() and GC_DELREF() shoukf be instead.
Added mactros to validate reference-counting (disabled for now).
These macros are going to be used to eliminate race-condintions during reference-counting on data shared between threads.
2017-10-27 01:28:58 +03:00
Bob Weinand
76ce874422 Merge branch 'PHP-7.1' into PHP-7.2 2017-07-22 11:16:48 +02:00
Bob Weinand
134e713be2 Merge branch 'PHP-7.0' into PHP-7.1 2017-07-22 11:14:54 +02:00
Bob Weinand
bad5d0d6c5 Fixed bug #74954 (null deref and segfault in zend_generator_resume()) 2017-07-22 11:14:00 +02:00
Anatol Belski
bc5811f361 further sync for vim mode lines 2017-07-04 18:12:45 +02:00
Bob Weinand
ccb5591728 Merge branch 'PHP-7.1' 2017-05-17 19:59:36 +02:00
Bob Weinand
649494c0ee Fixed bug #74606 (Segfault within try/catch/finally nesting in Generators)
Thanks to Nikita for pointing out the error source.
2017-05-17 19:58:51 +02:00
Sammy Kaye Powers
dac6c639bb Update copyright headers to 2017 2017-01-04 11:23:42 -06:00
Sammy Kaye Powers
478f119ab9 Update copyright headers to 2017 2017-01-04 11:14:55 -06:00
Sammy Kaye Powers
9e29f841ce Update copyright headers to 2017 2017-01-02 09:30:12 -06:00
Dmitry Stogov
fac95658b3 Improved VM stack unwinding on exception.
Now zend_throw_exception_hook() is going to be called only when exception is actually thrown and not going to be recalled for each unwinded finction.
2016-12-12 10:55:32 +03:00
Bob Weinand
ad5038bfee Merge branch 'PHP-7.0' into PHP-7.1 2016-12-01 15:21:49 +01:00
Bob Weinand
fcaccbaa22 Fix valgrind issue when throwing due to yield from aborted generator 2016-12-01 15:21:28 +01:00
Anatol Belski
22a3d55e9a fix exports which are now referenced by phpdbg
(cherry picked from commit cd0f1c8a5e)
2016-09-28 21:29:53 +02:00
Bob Weinand
e5d75d7268 Add phpdbg generator command 2016-09-28 13:26:08 +02:00
Andrea Faulds
fc5497cb92 Merge branch 'PHP-7.0' into PHP-7.1 2016-09-11 22:46:20 +01:00
Andrea Faulds
d690014bf3 Remove zpp fallback code (always use Fast ZPP)
Squashed commit of the following:

commit 3e27fbb3d2
Author: Andrea Faulds <ajf@ajf.me>
Date:   Sun Sep 11 19:14:37 2016 +0100

    Keep dummy FAST_ZPP macro for compatibility

commit 8a7cfd00de
Author: Andrea Faulds <ajf@ajf.me>
Date:   Mon Sep 5 22:36:03 2016 +0100

    Remove FAST_ZPP macro and plain zpp fallback code
2016-09-11 22:44:46 +01:00
Kalle Sommer Nielsen
8a1fbdda43 Fixed C89 build 2016-08-17 13:43:50 +02:00
Bob Weinand
35764e3579 Merge remote-tracking branch 'origin/PHP-7.0' into PHP-7.1 2016-07-23 16:40:02 +02:00
Bob Weinand
6046acf93e Fix ClosedGeneratorException possibly thrown into wrong scope 2016-07-23 16:39:21 +02:00
Dmitry Stogov
ccf18da450 Eliminated checks for (func->op_array.fn_flags & ZEND_ACC_GENERATOR) in fast path of DO_FCALL* handlers.
This slightly improves calls to regular function and method calls in cost of a bit slower generator initialization.
Separate call frame for generators, allocated on heap, now created by ZEND_GENERATOR_CREATE instruction.
2016-05-13 01:40:15 +03:00
Dmitry Stogov
8a7a913a7a Use main VM stack for generators. Only single call frame for generator itself is allocated on heap, call frames for nested functions are allocated on main VM stack. In case "yield" used in context of another function call, call stack has to be frozen and then restored. 2016-05-12 00:44:18 +03:00
Dmitry Stogov
2578d08033 Fixed compilation warnings 2016-04-29 14:44:56 +03:00
Dmitry Stogov
747a482b9c Don't initialize EX(call)->symbol_table on each function call.
Keep it uninitialized, and check ZEND_CALL_HAS_SYMBOL_TABLE flag when necessary.
2016-04-28 15:17:24 +03:00
Dmitry Stogov
6499162ff0 - get rid of EG(scope). zend_get_executed_scope() should be used instead.
- ichanged zval_update_constant_ex(). Use IS_TYPE_IMMUTABLE flag on shared constants and AST, instead of "inline_change" parameter.
2016-04-28 04:13:34 +03:00
Bob Weinand
5085352464 Fix generator being a cycle to itself 2016-04-18 23:55:16 +02:00
Nikita Popov
2eff141444 Merge branch 'PHP-7.0' 2016-04-07 12:30:06 +02:00
Nikita Popov
aad4ecebf8 Fixed bug #71980 2016-04-07 12:29:59 +02:00
Dmitry Stogov
e7730fece6 Fised possible use-after-free 2016-04-04 09:35:48 +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