1
0
mirror of https://github.com/php/php-src.git synced 2026-04-05 07:02:33 +02:00
Commit Graph

425 Commits

Author SHA1 Message Date
Dmitry Stogov
eecbb60db6 Fix memory leak
Fixes oss-fuzz #52479
2022-10-17 15:08:21 +03:00
Dmitry Stogov
94b8c2da9f Fixed type inference
Fixes oss-fuzz #51640
2022-09-26 12:19:12 +03:00
Dmitry Stogov
7496a400aa Fix SSA construction and type inference
Fixes oss-fuzz #51476
2022-09-19 15:45:34 +03:00
George Peter Banyard
6c4d24e4f0 Update cache slot size calculation in compact_literals.c 2022-09-10 13:20:59 +01:00
Dmitry Stogov
c151e9b75b Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix type inference
2022-09-05 13:01:04 +03:00
Dmitry Stogov
c852e0fff9 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix type inference
2022-09-05 12:56:34 +03:00
Máté Kocsis
5210872747 Regenerate optimizer func info after preprocessor condition changes 2022-09-02 17:18:42 +02:00
Dmitry Stogov
218da70bcf Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix memory leak
2022-08-29 14:54:49 +03:00
Dmitry Stogov
172ac0a48d Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix memory leak
2022-08-29 14:54:40 +03:00
Dmitry Stogov
567213c32a Drop range inference for IS_NULL/IS_FALSE/IS_TRUE.
These values not always converted to IS_LONG (e.g. by -- and ++) and
this leads to incorrect range inferene and later to incorrect JIT code
generation.
2022-08-23 11:22:31 +03:00
Dmitry Stogov
e10d2c2bf9 Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix type inference
2022-08-22 21:12:49 +03:00
Dmitry Stogov
95befc786a Fix type inference
Fixes oss-fuzz #50272
2022-08-22 21:11:39 +03:00
Ilija Tovilo
a6f489b452 Fix mb_strimwidth RC info
Closes GH-9254
2022-08-05 17:06:23 +02:00
sji
3b62d66098 Implement constants in traits (#8888)
RFC: https://wiki.php.net/rfc/constants_in_traits
2022-08-04 20:08:40 +01:00
Bob Weinand
dc5475c191 Save previous observer on the VM stack
This avoids a possible significant performance penalty, when some leaf function was observed, deep in the stack.
As a side effect, we are not iterating over prev_execute_data anymore and thus, non-observed fake frames, possibly on stack, cannot have any impact on the observer anymore (especially within zend_observer_fcall_end_all).

Saving the previous observer happens now directly on the VM stack. If there is any observer, function frames are allocated an extra zval (the last temporary), which will, on observed frames, contain the previous observed frame address.
2022-08-04 17:16:27 +02:00
Dmitry Stogov
21507ef28a Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix SSA reconstruction when body of "foreach" loop is removed
2022-08-01 14:01:34 +03:00
Dmitry Stogov
4b19b85eb6 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix SSA reconstruction when body of "foreach" loop is removed
2022-08-01 14:01:11 +03:00
Dmitry Stogov
87cf05e8be Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix type inference
2022-07-25 15:55:15 +03:00
Dmitry Stogov
d50875c822 Fix type inference
Fixes oss-fuzz #49423 and #49474
2022-07-25 15:53:06 +03:00
Ilija Tovilo
d4a9cc8856 Fix rc info of iterator_to_array (#9080)
This function can now return a copy of the provided array, resulting in
a value of RC != 1.
2022-07-21 15:05:34 +02:00
Go Kudo
4d8dd8d258 Implement Random Extension
https://wiki.php.net/rfc/rng_extension
https://wiki.php.net/rfc/random_extension_improvement
2022-07-19 10:27:38 +01:00
Dmitry Stogov
71814e9d99 Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix type inference
2022-07-18 14:20:41 +03:00
Dmitry Stogov
82d3ad64df Fix type inference
Fixes oss-fuzz #48908
2022-07-18 14:20:06 +03:00
Dmitry Stogov
26d890e6ba Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix type inference for FETCH_DI_UNSET
2022-07-18 13:15:12 +03:00
Dmitry Stogov
b734d45626 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix type inference for FETCH_DI_UNSET
2022-07-18 13:15:03 +03:00
Ilija Tovilo
63912b5ecd Fix RC func info of str_split (#9016)
Introduced in GH-8945

With RETURN_EMPTY_ARRAY this function can now return an interned array which
has refcount 2.
2022-07-15 11:23:55 +02:00
George Peter Banyard
f905590764 Add support for Disjoint Normal Form (DNF) types (#8725)
RFC: https://wiki.php.net/rfc/dnf_types

This allows to combine union and intersection types together in the following form (A&B)|(X&Y)|T but not of the form (X|A)&(Y|B) or (X|A)&(Y|B)|T.

* Improve union type parsing

Co-authored-by: Sara Golemon <pollita@php.net>
2022-07-08 11:30:23 +01:00
Dmitry Stogov
fa75bd0785 Fix incorrect constant propagation for VERIFY_RETURN_TYPE
This fixes oss-fuzz #48104
2022-06-20 11:30:07 +03:00
Dmitry Stogov
3d4a55fea1 Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix memory leak
2022-06-20 11:00:41 +03:00
Dmitry Stogov
ee17296e7b Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix memory leak
2022-06-20 11:00:32 +03:00
Máté Kocsis
49d3dde211 Declare true return types (#8759) 2022-06-18 22:06:50 +02:00
Dmitry Stogov
20a902749a Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix type inference
2022-06-14 12:00:26 +03:00
Dmitry Stogov
729be469ae Fix type inference
This dixes oss-fuzz #47921
2022-06-14 11:59:35 +03:00
Dmitry Stogov
f56371bdd3 Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix type inference
2022-06-14 10:21:24 +03:00
Dmitry Stogov
1b45efb6fb Fix type inference
This fixes oss-fuzz #47920
2022-06-14 10:20:45 +03:00
Pierrick Charron
bbc0c4c5c8 Regen missing Zend/Optimizer/zend_func_infos.h 2022-06-13 09:49:41 -04:00
Ilija Tovilo
5a855ee8d6 Fix GH-8661: Nullsafe in coalesce triggers undefined variable warning
Closes GH-8690
2022-06-12 21:52:14 +02:00
George Peter Banyard
b40ae80804 Convert iterable into an internal alias for Traversable|array (#7309)
This does a compile time transformation of ``iterable`` into ``Traversable|array`` which simplifies some of the LSP variance handling.

The arginfo generation script from stubs is updated to produce a union type when it encounters the type ``iterable``
Extension functions which do not regenerate the arginfo, or write them manually are still supported by mimicking the compile time transformation while registering the function.

Type Reflection is preserved for single ``iterable`` (and ``?iterable``) to produce a ReflectionNamedType with name ``iterable``, however usage of ``iterable`` in union types will be converted to ``array|Traversable``
2022-06-07 13:35:34 +01:00
Dmitry Stogov
faf3410957 Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix type inference
2022-06-06 11:14:33 +03:00
Dmitry Stogov
b86c6245cc Fix type inference
This fixes oss-fuzz #47777
2022-06-06 11:13:53 +03:00
Máté Kocsis
3de1613b98 Regenerate optimizer function info 2022-06-01 16:09:57 +02:00
George Peter Banyard
8685a7f03c Remove custom alloca() (#8513)
* Use arena in DCE instead of multiple alloca()
  This requires passing the optimizer context

* Use our do_alloca() instead of alloca()

* Use emalloc in DEBUG builds instead of stack allocations for do_alloca()
  This helps detecting that we correctly free do_alloca()
2022-05-27 09:05:33 +01:00
Nikita Popov
cc506a81e1 Used string with biased hash for double deduplication
Rather than using a separate hash table for doubles, use the same
biases hash approach we use for everything else. Either way works
fine, but there doesn't seem to be any strong reason to use a
different approach for doubles than we use for other cases.
2022-05-21 21:58:06 +02:00
Nikita Popov
83e0a5d2a7 Assert no unrelated literals where unsupported
In the interest of being defensive.

Also drop an unnecessary check for a value that cannot be null.
2022-05-21 21:17:09 +02:00
Nikita Popov
82ab848daf Remove separate valid_T set
Rather than keeping track of a separate valid_T set (which must
always be in sync with map_T), use a dummy value in map_T to
denote unallocated temporaries.
2022-05-21 18:10:42 +02:00
Nikita Popov
ae1132b01a Remove unused temporaries from taken map
If the result has no uses we need to allocate it when visiting the
defining instruction. However, we should still go through the
logic to remove the temporary from the taken map afterwards,
as the temporary can still be reused prior to the defining
instruction.
2022-05-21 18:01:37 +02:00
Nikita Popov
517c01b79b Don't classify literals during compaction
This seems to be a leftover from when we were storing cache slots
inside literals and had to prevent merging of literals with
incompatible cache slots. Nowadays the LITERAL_* classification
is not actually used for anything, we're only interested in the
number of related literals.
2022-05-21 17:36:46 +02:00
Nikita Popov
8a37f6b96f Allow compacting LITERAL_VALUE with related literals
Nowadays we include the content of all the related literals in the
cache key, so DECLARE_CLASS (where both literals cannot be derived
from each other) no longer needs this special case.
2022-05-21 17:24:11 +02:00
Dmitry Stogov
462d00f548 Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix memory leak
2022-05-16 13:48:51 +03:00
Dmitry Stogov
c430116a11 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix memory leak
2022-05-16 13:48:40 +03:00