Commit Graph

660 Commits

Author SHA1 Message Date
Dmitry Stogov
745504ea2a Make current() and key() receive argument by value. 2015-02-24 17:40:25 +03:00
Dmitry Stogov
e10e151e9b Merged zend_array and HashTable into the single data structure.
Now each HashTable is also zend_array, so it's refcounted and may be a subject for Copy on Write
zend_array_dup() was changed to allocate and return HashTable, instead of taking preallocated HashTable as argument.
2015-02-13 22:20:39 +03:00
Anatol Belski
07fdc1c78b fix data types 2015-02-12 18:39:40 +01:00
Dmitry Stogov
97fe15db43 Fix "forech" statemt behaviour according to https://wiki.php.net/rfc/php7_foreach
Squashed commit of the following:

commit 1e41295097
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Sat Jan 31 07:28:58 2015 +0300

    Generalize HashTableIterator API to allows its usage without involvement of HashTable.nInternalPonter

commit 5406f21b11
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Jan 30 18:08:43 2015 +0300

    Reduced alghorithms complexity

commit b37f1d58d2
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Jan 30 18:08:30 2015 +0300

    Fixed test name

commit fb2d079645
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Jan 30 18:08:05 2015 +0300

    API cleanup

commit 08302c0d6d
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Jan 30 14:20:46 2015 +0300

    Make array_splice() to preserve foreach hash position

commit cc4b7be41e
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Jan 30 12:24:31 2015 +0300

    Make internal function, operation on array passed by reference, to preserve foreach hash position

commit 5aa9712b0a
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Jan 30 09:49:35 2015 +0300

    Implement consistent behavior for foreach by value over plain object

commit 4c5b385ff5
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Jan 30 07:56:37 2015 +0300

    More careful iterators update.

commit 721fc9e80d
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Jan 29 21:43:28 2015 +0300

    Added new test

commit 15a23b1218
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Jan 29 21:05:02 2015 +0300

    Reimplement iteration magic with HashTableIterators (see https://wiki.php.net/rfc/php7_foreach#implementation_details)

commit 10a3260b1f
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Jan 29 21:04:44 2015 +0300

    New test

commit eef80c5837
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Jan 28 16:52:21 2015 +0300

    Fixed foreach by reference iteration over constant array

commit 61e7391873
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Jan 28 14:59:54 2015 +0300

    Fixed temporary variable re-allocation pass

commit 92e90c09f0
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Jan 28 12:44:57 2015 +0300

    Fixed operand destruction in case of exceptions in iterator

commit dd2a36a207
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Jan 28 10:02:34 2015 +0300

    Use GET_OP1_ZVAL_PTR_DEREF() (IS_TMP_VAR and IS_CONST can't be IS_REFERENCE)

commit 4638f7b914
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Jan 28 07:43:28 2015 +0300

    Change "foreach" statement behavior (this is just a PoC yet)

    - "foreach by value" don't relay on internal array/object pointer and doesnt perform array duplication. It just locks it incrementing reference counter. If the original array is modified by some code, the copy on write is performed and "foreach" still work with the old copy.

    - it makes no difference if array given to "foreach by value" is reference itself

    - "foreach by reference" still use internal array/object pointer and should work similar to PHP-5. (This id not completely implemented)
2015-02-12 13:57:12 +03:00
Xinchen Hui
a98fd7125a Fixed bug #68897 (Using variable for sort flag in array_multisort cause wrong results) 2015-01-24 22:51:37 +08:00
Xinchen Hui
afa666f650 Optimized range 2015-01-20 22:02:11 +08:00
Xinchen Hui
47b7d90703 NUM_KEY is useless here 2015-01-20 16:51:20 +08:00
Xinchen Hui
d917484ab7 Micro optimization for array_diff 2015-01-19 08:08:35 -05:00
Xinchen Hui
396e9cdb7f Optimized extract
symbol table already be rebuilt.. no need use set_local_var
2015-01-16 18:12:33 +08:00
Xinchen Hui
865749e7b1 Optimized array_slice 2015-01-16 17:54:50 +08:00
Xinchen Hui
98a2498383 Revert "Optimize array_unique to save some comparation calls"
Unsafe optimization

This reverts commit b57dc41e07.
2015-01-16 15:21:21 +08:00
Xinchen Hui
1c9f91e682 Revert "We could do more...."
This reverts commit 11f615b311.
2015-01-16 15:21:12 +08:00
Xinchen Hui
fc33f52d8c bump year 2015-01-15 23:27:30 +08:00
Xinchen Hui
9aac41753b Save one condition 2015-01-15 18:41:25 +08:00
Xinchen Hui
11f615b311 We could do more.... 2015-01-15 04:29:01 -05:00
Xinchen Hui
b57dc41e07 Optimize array_unique to save some comparation calls 2015-01-15 13:57:06 +08:00
Xinchen Hui
2193de0d18 Faster sorting algo 2015-01-14 18:02:41 +08:00
Dmitry Stogov
c5047d1f11 Use FAST_ZPP in few more frequently used functions 2015-01-12 19:26:12 +03:00
Dmitry Stogov
b277d360e9 Fixed reference support 2015-01-12 14:43:32 +03:00
Stanislav Malyshev
b7a7b1a624 trailing whitespace removal 2015-01-10 15:07:38 -08:00
Levi Morrison
bb7ceb046e Fix bug #55416
Remove extra, unnecessary warning when the callback fails for
array_map, array_reduce and array_filter
2015-01-05 17:27:25 -07:00
Nikita Popov
1266515e19 Fix uses of zval_add_ref and add comment on usage
zval_add_ref should be used as a copy ctor, after the value was
already copied.

In particular when used with hash insertions, it should be applied
to the return value of the insert function.
2015-01-05 17:02:11 +01:00
Dmitry Stogov
aa8ecbedcb Simplify array_splice() 2014-12-30 18:15:15 +03:00
Dmitry Stogov
c6bc209e50 Simplify array_unshift() 2014-12-30 17:04:24 +03:00
Dmitry Stogov
f9a70c50a4 Simplify array_pad() 2014-12-30 17:03:38 +03:00
Dmitry Stogov
107ae86ca6 Introduce specialized functions to compare with integer and string, to eliminate repeatable checks on each loop iteration in in_array() function. 2014-12-27 11:11:40 +03:00
Xinchen Hui
31e978ff5c Fixed tests fails 2014-12-25 11:33:07 +08:00
Xinchen Hui
94d26ad4b9 Add php_string_tolower/toupper which is locale depened 2014-12-25 11:29:11 +08:00
Xinchen Hui
3139ba6116 FAST_ZPP for hot functions 2014-12-23 23:07:55 -05:00
Dmitry Stogov
106b1017d4 API for fast construction of packed arrays 2014-12-23 19:08:28 +03:00
Xinchen Hui
62e2973602 Revert "Improve Hash foreach macros"
This reverts commit 95bb0a0f7a.
2014-12-23 03:51:06 -05:00
Xinchen Hui
95bb0a0f7a Improve Hash foreach macros 2014-12-23 00:50:39 -05:00
Dmitry Stogov
dedf44bacc Improved array_keys() 2014-12-23 04:29:27 +03:00
Xinchen Hui
b5b617674e Micro optimaztion (yeah, I know compiler supposed to do that) 2014-12-22 00:10:46 -05:00
Xinchen Hui
201e1b8a8d Micro optimizations 2014-12-21 22:35:25 -05:00
Xinchen Hui
abb98080c7 Make it inline 2014-12-20 05:17:56 -05:00
Dmitry Stogov
f7b6518d10 don't sort array with single element 2014-12-19 13:07:35 +03:00
Dmitry Stogov
dae53dfc69 Improved array_diff() function (use simple and more efficient algorithm). 2014-12-19 05:06:54 +03:00
Anatol Belski
bd76a50019 Merge remote-tracking branch 'origin/master' into native-tls
* origin/master:
  Removed deprecated checks
2014-12-15 20:18:40 +01:00
Dmitry Stogov
4e48bff3ce Removed deprecated checks 2014-12-15 16:42:28 +03:00
Anatol Belski
bdeb220f48 first shot remove TSRMLS_* things 2014-12-13 23:06:14 +01:00
Dmitry Stogov
381438e5df Improved array_merge() and array_replace() (1-st array may be added using simple procedure). 2014-12-11 19:18:31 +03:00
Veres Lajos
4b9535341a typo fixes - https://github.com/vlajos/misspell_fixer 2014-11-19 20:23:00 +00:00
Anatol Belski
53560ca06b rework the previous fix for var names with size_t, no ugly casts anymore 2014-10-23 16:50:35 +02:00
Anatol Belski
09a01a834e this should be uint32 2014-10-22 17:56:26 +02:00
Anatol Belski
36ce467402 fix datatype mismatches 2014-10-22 17:56:25 +02:00
Anatol Belski
1ea5982d07 fixing datatype mismatches 2014-10-22 17:56:23 +02:00
Dmitry Stogov
35dc0a2e30 array_pop/array_shift optimization 2014-10-17 12:30:27 +04:00
Nikita Popov
fc6ce7d1c1 Fix array_keys() on $GLOBALS 2014-10-16 14:44:35 +02:00
Nikita Popov
ee5b30fa19 Remove support for classes without class entries
get_class_entry must be non-NULL and return non-NULL.
2014-10-09 13:58:14 +02:00