Commit Graph

381 Commits

Author SHA1 Message Date
Dmitry Stogov
d7f2dc4ec6 Improve HashTable iterators handling:
- Avoid iterators check/update on each HashTable update opration
- Keep position equal (or above) nNumUsed instead of HT_INVALID_IDX
- Fixed iterators handling in array_unshift()
2018-03-22 02:41:49 +03:00
Dmitry Stogov
feb22b24cf Micro optimization 2018-03-21 12:39:56 +03:00
Dmitry Stogov
28ab2060ee Micro optimization 2018-03-21 11:57:54 +03:00
Dmitry Stogov
47f5f87826 Merge branch 'PHP-7.2'
* PHP-7.2:
  Don't keep HashTable.pDestructor in SHM and always set it into ZVAL_PTR_DTOR in zval_array_dup(). Keeping pointer to a function in SHM is not safe because of ASLR.
2018-03-06 01:02:31 +03:00
Dmitry Stogov
b48d2f6d10 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Don't keep HashTable.pDestructor in SHM and always set it into ZVAL_PTR_DTOR in zval_array_dup(). Keeping pointer to a function in SHM is not safe because of ASLR.
2018-03-06 01:00:14 +03:00
Dmitry Stogov
b711a96acb Don't keep HashTable.pDestructor in SHM and always set it into ZVAL_PTR_DTOR in zval_array_dup().
Keeping pointer to a function in SHM is not safe because of ASLR.
2018-03-06 00:56:16 +03:00
Dmitry Stogov
baa9890112 Completely hide GC implementation details into zend_gc.c 2018-02-27 21:08:26 +03:00
Dmitry Stogov
9794272f3e Micro optimization 2018-02-13 00:56:48 +03:00
Dmitry Stogov
6fb5568b2d Merge HashTable.u.v.consistency into HashTable.u.v.flags 2018-01-22 15:32:34 +03:00
Dmitry Stogov
6634d5e313 Use HT_FLAGS() macro 2018-01-22 14:58:16 +03:00
Dmitry Stogov
ebf900a9eb Introduce mcros to access HashTable iterators counter 2018-01-22 14:14:35 +03:00
Dmitry Stogov
9cbb521094 Access HashTable.u.flags through HT_FLAGS() macro. 2018-01-22 13:36:15 +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
Li-Wen Hsu
72ec23d823 Fix bug #75677: Drop fastcall attribute on variadic function
Fastcall generally doesn't make sense on variadic functions. For
clang in particular this eliminates a "fastcall calling convention
ignored on variadic function" warning.
2017-12-15 21:56:08 +01:00
Dmitry Stogov
74c84cd7f0 Use zend_string_equal*() API for zend_string equality check instead of direct memcmp() usage. 2017-12-04 17:17:02 +03:00
Dmitry Stogov
ec2dde0c0b Introduced zend_hash_find_ex() that may avoid unnecessary hash value check. 2017-11-24 14:01:19 +03:00
Dmitry Stogov
ed7f396721 Avoid second hash value check 2017-11-24 12:03:59 +03:00
Dmitry Stogov
6de54703f0 Improved zend_hash_str_add/update functions 2017-10-31 10:35:28 +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
f18638ca2d Fixed incorrect recursion detection 2017-10-06 11:47:11 +03:00
Dmitry Stogov
254b74b85f HASH_FLAG_PERSISTENT renamed into IS_ARRAY_PERSISTENT and moved into GC_FLAGS (to be consistent with IS_STR_PERSISTENT). 2017-10-06 02:54:14 +03:00
Dmitry Stogov
cb9d81ef4f Refactored recursion pretection 2017-10-06 01:34:50 +03:00
Dmitry Stogov
44e0b79ac6 Refactored array creation API. array_init() and array_init_size() are converted into macros calling zend_new_array(). They are not functions anymore and don't return any values. 2017-09-20 02:25:56 +03:00
Thomas Punt
d938a769b2 Use ZEND_HASH_APPLY_SHIFT macro instead of hard-coded literal 2017-08-23 22:15:14 +02:00
Anatol Belski
bc5811f361 further sync for vim mode lines 2017-07-04 18:12:45 +02:00
Joe Watkins
5796fff344
Merge branch 'PHP-7.1'
* PHP-7.1:
  Remove superfluous branch
2017-06-23 07:51:59 +01:00
Joe Watkins
b903733762
Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Remove superfluous branch
2017-06-23 07:51:46 +01:00
Thomas Punt
b1301a0686
Remove superfluous branch 2017-06-23 07:51:32 +01:00
Nikita Popov
fd4025069d
Enable HT RC assertions with escape-hatch
HT functions that modify the array now assert that rc=1. As we don't
respect this COW constraint everywhere, either for a good reason or
because fixing it would take more work, we provide an escape hatch
in the form of HT_ALLOW_COW_VIOLATION(ht). If this macro is called
assertions on this ht are disabled. The macro is a no-op in release
mode.
2017-01-23 17:19:06 +00: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
1e3624290a Resolve conflict 2017-01-03 08:01:05 -06:00
Stanislav Malyshev
13c18d4601 Merge branch 'PHP-7.1'
* PHP-7.1:
  Fix #73832 - leave the table in a safe state if the size is too big.
  Fix bug #73831 - NULL Pointer Dereference while unserialize php object
2017-01-02 21:37:10 -08:00
Stanislav Malyshev
ca72faa2c5 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fix #73832 - leave the table in a safe state if the size is too big.
  Fix bug #73831 - NULL Pointer Dereference while unserialize php object
2017-01-02 21:37:06 -08:00
Stanislav Malyshev
4cc0286f2f Fix #73832 - leave the table in a safe state if the size is too big. 2017-01-02 20:14:05 -08:00
Sammy Kaye Powers
9e29f841ce Update copyright headers to 2017 2017-01-02 09:30:12 -06:00
Nikita Popov
a1fd1053f5 Merge branch 'PHP-7.1' 2016-12-21 21:19:28 +01:00
Nikita Popov
9afc61c214 Merge branch 'PHP-7.0' into PHP-7.1 2016-12-21 21:19:10 +01:00
David Walker
5733fd1caf Fix #73753 - Unpacked Arrays and Duplication 2016-12-21 21:18:20 +01:00
Andrea Faulds
a0502b89a6 Convert numeric keys in object/array casts
RFC: https://wiki.php.net/rfc/convert_numeric_keys_in_object_array_casts

This converts key types as appropriate in object to array and array to object
casts, as well as in get_object_vars().
2016-11-14 18:20:45 +00:00
Dmitry Stogov
d6c332eb51 Turn IS_TYPE_COLLECTABLE zval flag into GC_COLLECTABLE zend_refcounted flag.
This simplifies checks and allows reset this flag for "acyclic" arrays and objects.
2016-10-21 17:47:30 +03:00
Dmitry Stogov
65ea250022 Merge branch 'PHP-7.1'
* PHP-7.1:
  Introduced HT_IS_PACKED() and HT_IS_WITHOUT_HOLES() macros. (Benjamin Coutu)
2016-10-19 23:12:17 +03:00
Dmitry Stogov
9ded1b4edb Introduced HT_IS_PACKED() and HT_IS_WITHOUT_HOLES() macros. (Benjamin Coutu) 2016-10-19 23:10:42 +03:00
Nikita Popov
2083007813 Merge branch 'PHP-7.1' 2016-09-27 19:49:01 +02:00
Nikita Popov
21f0be4792 Merge branch 'PHP-7.0' into PHP-7.1 2016-09-27 19:48:50 +02:00
Nikita Popov
b7cbaa7f43 Fix bug #73181 2016-09-27 19:47:48 +02:00
Dmitry Stogov
42db69058a Removed impossible condition 2016-09-22 17:58:45 +03:00