#
dce6ed31 |
| 26-Feb-2024 |
Tim Düsterhus |
random: Adjust `status` to `state` (#13521) * random: Rename `status` local to `state` * random: Rename `php_random_algo_with_state`'s `status` member to `state`
|
#
79133df1 |
| 25-Feb-2024 |
Tim Düsterhus |
random: Pass algorithm and state together as `php_random_algo_with_state` (#13350) * random: Remove `php_random_status` Since 162e1dce9870168cb8c65c013f2b5a510b6536b1, the `php_rand
random: Pass algorithm and state together as `php_random_algo_with_state` (#13350) * random: Remove `php_random_status` Since 162e1dce9870168cb8c65c013f2b5a510b6536b1, the `php_random_status` struct contains just a single `void*`, resulting in needless indirection when accessing the engine state and thus decreasing readability because of the additional non-meaningful `->state` references / the local helper variables. There is also a small, but measurable performance benefit: <?php $e = new Random\Engine\Xoshiro256StarStar(0); $r = new Random\Randomizer($e); for ($i = 0; $i < 15; $i++) var_dump(strlen($r->getBytes(100000000))); goes from roughly 3.85s down to 3.60s. The names of the `status` variables have not yet been touched to keep the diff small. They will be renamed to the more appropriate `state` in a follow-up cleanup commit. * Introduce `php_random_algo_with_state`
show more ...
|
#
631bc816 |
| 06-Feb-2024 |
Ilija Tovilo |
Implement stackless internal function calls Co-authored-by: Dmitry Stogov <dmitry@zend.com> Closes GH-12461
|
#
45b99f6b |
| 03-Feb-2024 |
David Carlier |
Forgotten piece of GH-13309/GH-13310 previous PR
|
#
d91224cd |
| 03-Feb-2024 |
David Carlier |
Fix GH-13309 and GH-13310: array hashes comparison, wrong buffer len calculation. php_array_key_compare_string_case_unstable_i has a typo for the second operand resulting in a wrong buff
Fix GH-13309 and GH-13310: array hashes comparison, wrong buffer len calculation. php_array_key_compare_string_case_unstable_i has a typo for the second operand resulting in a wrong buffer size calculation. Issue reported by @AlexRudyuk Close GH-13315
show more ...
|
#
d65c3950 |
| 31-Jan-2024 |
Ilija Tovilo |
Fix instable array during in-place modification in uksort The array isn't just observable if the array has RCn, but also if it is inside a reference that is RCn. By-ref parameters are al
Fix instable array during in-place modification in uksort The array isn't just observable if the array has RCn, but also if it is inside a reference that is RCn. By-ref parameters are always RCn and as such always observable. Fixes GH-13279 Closes GH-13285
show more ...
|
#
d6536468 |
| 18-Jan-2024 |
Ilija Tovilo |
Fix iterator position resetting Previously, when an array was converted from packed to hashed, iterators would not be correctly reset to 0. Similarly, removing the last element from an a
Fix iterator position resetting Previously, when an array was converted from packed to hashed, iterators would not be correctly reset to 0. Similarly, removing the last element from an array would decrease nNumUsed but not actually fix the iterator position, causing the element to be skipped in the next iteration. Some code was also removed that skips over IS_UNDEF elements for nInternalPointer and iterator positions. This is unnecessary, as this already happens during iteration. Closes GH-13178 Closes GH-13188
show more ...
|
#
fe064d7f |
| 19-Jan-2024 |
Niels Dossche <7771979+nielsdos@users.noreply.github.com> |
Fix GH-13142: Undefined variable name is shortened when contains \0 Uses the new %S formatter and introduces the necessary changes and helpers.
|
#
00ea756c |
| 14-Jan-2024 |
Tim Düsterhus |
random/standard: Adjust #13138 for PHP 8.3
|
#
97c6da1d |
| 14-Jan-2024 |
Tim Düsterhus |
random/standard: Correctly handle broken engines in php_array_pick_keys (#13138)
|
#
1d6f344b |
| 09-Jan-2024 |
Niels Dossche <7771979+nielsdos@users.noreply.github.com> |
Fix GH-13094: range(9.9, '0') causes segmentation fault `start_type + end_type < 2*IS_STRING` is not right, in this test case the types are start_type==5 (IS_DOUBLE), end_type==7 (IS_ARR
Fix GH-13094: range(9.9, '0') causes segmentation fault `start_type + end_type < 2*IS_STRING` is not right, in this test case the types are start_type==5 (IS_DOUBLE), end_type==7 (IS_ARRAY). The IS_ARRAY type is a sentinel to disambiguate single-byte strings. The path must be taken when one of the types is not a string nor a single-byte string. Therefore, use < IS_STRING with an OR condition. Closes GH-13105.
show more ...
|
#
2053af66 |
| 19-Jul-2023 |
Ilija Tovilo |
Fix uouv in array_column column_long and index_long might not be set, but are still used as arguments. They are not actually used if column_str is set, but it's better to initialize
Fix uouv in array_column column_long and index_long might not be set, but are still used as arguments. They are not actually used if column_str is set, but it's better to initialize them anyway, if only to make MemorySanitizer happy.
show more ...
|
#
798c40a7 |
| 19-Jun-2023 |
George Peter Banyard |
[RFC] Define proper semantics for range() function (#10826) RFC: https://wiki.php.net/rfc/proper-range-semantics
|
#
d5ad7510 |
| 08-Jun-2023 |
George Peter Banyard |
More usage of known zend_str instead of C string (#11381)
|
#
a02f7f24 |
| 06-Jun-2023 |
George Peter Banyard |
Use more appropriate types for php_array_walk() function
|
#
15402454 |
| 02-Jun-2023 |
George Peter Banyard |
ext/standard/array.c: Optimize min/max functions for int/float (#11194) Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
|
#
eb7ec15a |
| 24-May-2023 |
Ilija Tovilo |
Use single allocation for indirect values in array_multisort Closes GH-11309
|
#
b2ec6c24 |
| 23-May-2023 |
Ilija Tovilo |
Fix exception handling in array_multisort() Closes GH-11302
|
#
f5c54fd8 |
| 23-May-2023 |
Ilija Tovilo |
Fix access on NULL pointer in array_merge_recursive() Closes GH-11303
|
#
646f54b5 |
| 06-May-2023 |
George Peter Banyard |
ext/standard/array.c: use uint32_t instead of incorrect int type Drive-by indentation fixes and bool usage
|
#
947eb952 |
| 24-Apr-2023 |
Niels Dossche <7771979+nielsdos@users.noreply.github.com> |
Allow array functions to operate in-place if the refcount is 1 (#11060) This allows array_merge, array_intersect, array_replace, array_unique and usort to avoid taking a copy and do the
Allow array functions to operate in-place if the refcount is 1 (#11060) This allows array_merge, array_intersect, array_replace, array_unique and usort to avoid taking a copy and do the transformation in-place. ** Safety ** There are some array functions which take a copy of the input array into a temporary C array for sorting purposes. (e.g. array_unique, array_diff, and array_intersect do this). Since we no longer take a copy in all cases, we must check if it's possible that a value is accessed that was already destroyed. For array_unique: cmpdata will never be removed so that will never reach refcount 0. And when something is removed, it is the previous value of cmpdata, not the one user later. So this seems okay. For array_intersect: a previous pointer (ptr[0] - 1) is accessed. But this can't be a destroyed value because the pointer is first moved forward. For array_diff: it's possible a previous pointer is accessed after destruction. So we can't optimise this case easily.
show more ...
|
#
e8b8341d |
| 04-Apr-2023 |
Ilija Tovilo |
Support enums in array_unique Fixes GH-9775 Closes GH-11015
|
#
a0476fd3 |
| 14-Apr-2023 |
Niels Dossche <7771979+nielsdos@users.noreply.github.com> |
Micro-optimize double comparison (#11061) When using ZEND_NORMALIZE_BOOL(a - b) where a and b are doubles, this generates the following instruction sequence on x64: subsd xmm0, xmm
Micro-optimize double comparison (#11061) When using ZEND_NORMALIZE_BOOL(a - b) where a and b are doubles, this generates the following instruction sequence on x64: subsd xmm0, xmm1 pxor xmm1, xmm1 comisd xmm0, xmm1 ... whereas if we use ZEND_THREEWAY_COMPARE we get two instructions less: ucomisd xmm0, xmm1 The only difference is that the threeway compare uses *u*comisd instead of comisd. The difference is that it will cause a FP signal if a signaling NAN is used, but as far as I'm aware this doesn't matter for our use case. Similarly, the amount of instructions on AArch64 is also quite a bit lower for this code compared to the old code. ** Results ** Using the benchmark https://gist.github.com/nielsdos/b36517d81a1af74d96baa3576c2b70df I used hyperfine: hyperfine --runs 25 --warmup 3 './sapi/cli/php sort_double.php' No extensions such as opcache used during benchmarking. BEFORE THIS PATCH ----------------- Time (mean ± σ): 255.5 ms ± 2.2 ms [User: 251.0 ms, System: 2.5 ms] Range (min … max): 251.5 ms … 260.7 ms 25 runs AFTER THIS PATCH ---------------- Time (mean ± σ): 236.2 ms ± 2.8 ms [User: 228.9 ms, System: 5.0 ms] Range (min … max): 231.5 ms … 242.7 ms 25 runs
show more ...
|
#
3b066188 |
| 07-Mar-2023 |
George Peter Banyard |
RFC: Saner array_(sum|product)() (#10161) RFC: https://wiki.php.net/rfc/saner-array-sum-product Moreover, the internal fast_add_function() function was removed.
|
#
3ff83334 |
| 07-Feb-2023 |
Niels Dossche <7771979+nielsdos@users.noreply.github.com> |
Cleanup dead code in array_slice (#10539) We can only get to this if condition if at least preserve_keys is true. Therefore, the else branch of this check can never execute.
|