Commit Graph

161 Commits

Author SHA1 Message Date
Dmitry Stogov
4a475a4976 Replace legacy zval_dtor() by zval_ptr_dtor_nogc() or even more specialized destructors.
zval_dtor() doesn't make a lot of sense in PHP-7.* and it's used incorrectly in some places.
Its occurances should be replaced by zval_ptr_dtor() or zval_ptr_dtor_nogc(), or even more specialized destructors.
2018-07-04 19:22:24 +03:00
Nikita Popov
43c533d799 Merge branch 'PHP-7.2' 2018-06-29 23:23:08 +02:00
Nikita Popov
deb1bad80f Merge branch 'PHP-7.1' into PHP-7.2 2018-06-29 23:23:02 +02:00
Nikita Popov
962706d16c Fix nullable type pretty-printing 2018-06-29 23:22:41 +02:00
Dmitry Stogov
5eb1f92f31 Use zend_string_release_ex() instread of zend_string_release() in places, where we sure about string persistence. 2018-05-28 16:27:12 +03:00
Dmitry Stogov
1e00b767a4 Use iteration instead of recursion 2018-05-08 01:22:39 +03:00
Dmitry Stogov
db307eae03 Dereference child1 only after NULL check 2018-04-02 22:16:58 +03:00
Dmitry Stogov
4bbf200b4e Optmized AST creation 2018-03-15 15:40:04 +03:00
Dmitry Stogov
64f64cf0b7 zend_ast_destroy() optimization 2018-03-15 00:05:00 +03:00
Dmitry Stogov
73f7c84685 Mark zend_ast_export() as "cold". 2018-03-14 23:13:20 +03:00
Dmitry Stogov
5e8aa036f2 Access extra data stored in zval through macros 2018-01-23 12:56:22 +03:00
Dmitry Stogov
022e029984 Optimize zval_dtor_func() 2018-01-16 00:57:47 +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
d3fa900780 Removed workaraouns for inconsistent zvals (REFCOUNTED+INTERNED). They should be fixed now. 2017-11-03 21:02:55 +03:00
Nikita Popov
625d7075d6 Don't dup after fetch_dimension_const
Any duplication that may be necessary must have happened earlier
already. Also I'm not sure what the IS_REF branch was there for
originally, but it does not appear to be relevant anymore.
2017-11-02 19:20:14 +01:00
Dmitry Stogov
54ebab9640 Workaroud for inconsistent ZVALs in AST produced by compiler (strings may be REFCOUNTED and INTERNED at the same time). 2017-10-31 15:39:39 +03:00
Dmitry Stogov
fcc08ce19f Prevent reference-counting on persistent zvals (internal constants, default properties and constants of internal classes).
New macro ZVAL_COPY_OR_DUP() is used perform duplication, if necessary.
This should eliminate related race-coditions in ZTS build and prevent reference-counting bugs after unclean shutdown.
2017-10-30 23:13:10 +03: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
Dmitry Stogov
9cf87aa196 Avoid HashTable allocations for empty arrays (using zend_empty_array). 2017-10-24 17:27:31 +03:00
Dmitry Stogov
ef5ea48741 Always use IS_CONSTANT_AST (IS_CONSTANT is removed). 2017-10-10 10:11:05 +03:00
Dmitry Stogov
39ded1d5f8 Changed zend_ast_ref structure to use only one allocation, removing dichotomy between heap/arena ASTs. 2017-10-09 16:57:51 +03:00
Anatol Belski
bc5811f361 further sync for vim mode lines 2017-07-04 18:12:45 +02:00
Dmitry Stogov
8bb29704ea Refactored API for constant array element propagation 2017-06-15 22:50:04 +03:00
Nikita Popov
16861838a5 Merge branch 'PHP-7.1' 2017-03-23 22:50:21 +01:00
Nikita Popov
e3e3547627 Merge branch 'PHP-7.0' into PHP-7.1 2017-03-23 22:49:51 +01:00
Nikita Popov
f5951cc81b Fix lineno for AST_ZVAL nodes 2017-03-23 22:48:41 +01:00
Nikita Popov
329d4edff7 Merge branch 'PHP-7.1' 2017-03-17 13:36:03 +01:00
Nikita Popov
893bf7ecdd Merge branch 'PHP-7.0' into PHP-7.1 2017-03-17 13:35:50 +01:00
Nikita Popov
183cd048f1 Fix AST start lineno for list nodes
If the node is initialized with children, check if a child has a
lower start lineno, similar to what we do for fixed-sized nodes
as well.
2017-03-17 13:35:24 +01:00
Anatol Belski
1f22daeb0f Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  [ast] Fix exporting **= in expansion of assign op
2017-01-08 18:54:28 +01:00
Sara Golemon
5df97b339e [ast] Fix exporting **= in expansion of assign op
(cherry picked from commit 9c3865eb6a)
2017-01-08 18:43:47 +01: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
3e9bb03a62 Removed IS_TYPE_IMMUTABLE (it's the same as COPYABLE & !REFCOUED) 2016-11-28 22:59:57 +03:00
Nikita Popov
6ec5816899 Merge branch 'PHP-7.1' 2016-09-28 23:23:01 +02:00
Nikita Popov
56a7646ab2 Merge branch 'PHP-7.0' into PHP-7.1 2016-09-28 23:22:48 +02:00
Nikita Popov
e520b9e127 Merge branch 'PHP-5.6' into PHP-7.0 2016-09-28 23:22:11 +02:00
Sara Golemon
9c3865eb6a [ast] Fix exporting **= in expansion of assign op 2016-08-06 15:35:45 -07:00
Bob Weinand
4f077aee83 Allow for [] = $array; (alias for list()) 2016-05-20 01:51:05 +02:00
Sara Golemon
8523b1f8ed Merge branch 'PHP-7.0'
* PHP-7.0:
  Fix serializing ZEND_AST_SHELL_EXEC
2016-05-12 02:51:14 +00:00
Sara Golemon
a73b03edea Fix serializing ZEND_AST_SHELL_EXEC
Currently, `foo` is reserialized as `'foo'` due to misuse of zend_ast_export().
ZEND_AST_SHELL_EXEC can only contain ZEND_AST_ZVAL(string) or ZEND_AST_ENCAPS_LIST,
so just handle the ZEND_AST_ZVAL(string) case directly.
2016-05-12 02:47:56 +00:00
Dmitry Stogov
c19cb70dac Revert "Refactor zval cleanup into single function"
This reverts commit bac6fdb0c5.
2016-05-06 10:47:58 +03:00
Bob Weinand
bac6fdb0c5 Refactor zval cleanup into single function
Also use zval_ptr_dtor_nogc() everywhere in Zend in favor of zval_dtor()
2016-05-05 23:31:57 +02:00
Nikita Popov
9b99a1c9fb Fix compile warning in ast.c 2016-05-02 11:55:49 +02:00
Pierrick Charron
0aed2cc2a4 Allow catching multiple exception types in a single catch statement
This commit add the possibility to catch multiple exception types in
a single catch statement to avoid code duplication.

try {
	   // Some code...
} catch (ExceptionType1 | ExceptionType2 $e) {
	   // Code to handle the exception
} catch (\Exception $e) {
	   // ...
}
2016-05-01 18:47:08 -04: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
69efeb1223 Fix constant expr coaleasce with protected mode opcache 2016-04-21 21:51:00 +02:00