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

390 Commits

Author SHA1 Message Date
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
Dmitry Stogov adc8155119 Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix type inference
2022-05-16 12:42:14 +03:00
Dmitry Stogov aad5fbac85 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix type inference
2022-05-16 12:42:04 +03:00
Arnaud Le Blanc 298c1ab92e Merge branch 'PHP-8.1' 2022-05-13 12:48:51 +02:00
Arnaud Le Blanc 332bd03782 Do not optimize out ini_get() when the entry does not exist during compilation (#8507)
The entry may exist later if dl is enabled

Fixes GH-8466
2022-05-13 12:35:00 +02:00
Dmitry Stogov 89fa77516c Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix type inference
2022-05-11 12:40:16 +03:00
Dmitry Stogov 84c1e99ecf Fix type inference
This fizes oss-fuzz #47044
2022-05-11 12:39:26 +03:00
Dmitry Stogov 2495459e50 Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix type inference
2022-05-11 12:10:00 +03:00
Dmitry Stogov f1fc58ed8d Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix type inference
2022-05-11 12:09:53 +03:00
Dmitry Stogov 27efd125ed Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix ISSET_ISEMPTY_VAR missoptimization
2022-04-25 13:31:40 +03:00
Dmitry Stogov 948ef10dd0 Fix ISSET_ISEMPTY_VAR missoptimization
This fixes oss-fuzz #46909
2022-04-25 13:31:01 +03:00
Dmitry Stogov 73514d6e4f Merge branch 'PHP-8.1'
* PHP-8.1:
  Reorder optimization passes to avoid miss-optimization
2022-04-25 13:12:03 +03:00
Dmitry Stogov 1aa5e9392d Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Reorder optimization passes to avoid miss-optimization
2022-04-25 13:09:31 +03:00
Dmitry Stogov 992c8061b4 Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix type inference
2022-04-25 12:17:17 +03:00
Dmitry Stogov e14dc15e13 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix type inference
2022-04-25 12:17:07 +03:00
Dmitry Stogov 9e6eb9d5a5 Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix type narrowing warning during type inference of ZEND_FETCH_DIM_W
2022-04-25 11:18:37 +03:00
Dmitry Stogov 2cff0e674d Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix type narrowing warning during type inference of ZEND_FETCH_DIM_W
2022-04-25 11:17:04 +03:00
Nikita Popov 1254aa4f3e Avoid setting ce for ref return_info
This is unlikely to matter in practice (due to short lifetime),
but necessary to satisfy the SSA integrity check.

Fixes oss-fuzz #46980.
2022-04-24 17:35:51 +02:00
Nikita Popov 8f02d7b7e4 Remove unnecessary bailout in fcall optimization
Even if we can't optimize the SEND_VAL_EX, there is no reason to
skip the INIT_FCALL/DO_FCALL optimizations, those should be entirely
orthogonal.
2022-04-18 18:30:36 +02:00
Nikita Popov a8b6aea5a2 Remove unused macros 2022-04-18 18:24:52 +02:00
Nikita Popov 2aba4f8235 Merge branch 'PHP-8.1'
* PHP-8.1:
  Move check for named params in fcall optimization earlier
2022-04-18 18:22:04 +02:00
Nikita Popov 18b4e36df1 Move check for named params in fcall optimization earlier
I don't think this is strictly necessary, but I think it makes
sense to check this before interpreting opline->op2.num as an
argument number.

This also adds one more has_known_send_mode() check that I had
missed before.
2022-04-18 18:21:24 +02:00
Nikita Popov 4dc669a74d Merge branch 'PHP-8.1'
* PHP-8.1:
  Don't optimize trailing args for prototype fbc
2022-04-18 17:57:59 +02:00
Nikita Popov 11f950e77e Don't optimize trailing args for prototype fbc 2022-04-18 17:57:16 +02:00
Nikita Popov 462dc9da6a Don't specify ce for MAY_BE_REF STATIC_PROP_FETCH
This is unlikely to matter in practice (due to the short lifetime),
but we should not specify a CE for a potential ref result.

Fixes oss-fuzz #46810.
2022-04-18 10:45:57 +02:00
Dmitry Stogov 6ed3b57e67 Fix incorrect constant propagation for VERIFY_RETURN_TYPE
Fixes oss-fuzz #46616
2022-04-18 10:33:52 +03:00
Nikita Popov df4c27642e Check opcode rather than result_type for R/IS type inference
We may sometimes create FETCH_*_R opcodes with VAR type (e.g. if a
FUNC_ARG opcode is converted to BP_VAR_R fetch kind). Make sure we
don't infer overly conservative types in that case.
2022-04-16 22:42:20 +02:00
Nikita Popov 4bd7f4e0ad Check that MAY_BE_REF variables cannot have a ce 2022-04-15 23:57:21 +02:00
Nikita Popov 701e10c3b9 Merge branch 'PHP-8.1'
* PHP-8.1:
  Don't set ce for by-ref return type
2022-04-15 23:56:04 +02:00
Nikita Popov b0ab5d0fb0 Don't set ce for by-ref return type
For the case where we upgrade a prototype to a possible by-ref
return from an inheriting method.
2022-04-15 23:55:48 +02:00
Nikita Popov 7408da7ac0 Merge branch 'PHP-8.1'
* PHP-8.1:
  Move MAY_BE_REF check into COPY_SSA_OBJ_TYPE
2022-04-15 23:15:06 +02:00
Nikita Popov 4026daee2b Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Move MAY_BE_REF check into COPY_SSA_OBJ_TYPE
2022-04-15 23:14:59 +02:00
Nikita Popov 01996d1534 Merge branch 'PHP-8.1'
* PHP-8.1:
  Don't use CE for by-ref arguments
2022-04-15 23:01:05 +02:00
Nikita Popov 38547b996a Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Don't use CE for by-ref arguments
2022-04-15 23:00:59 +02:00
Nikita Popov bc24c62030 Merge branch 'PHP-8.1'
* PHP-8.1:
  Don't use CE info from pi node for MAY_BE_REF var
2022-04-15 22:39:13 +02:00
Nikita Popov f1814e6a1f Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Don't use CE info from pi node for MAY_BE_REF var
2022-04-15 22:37:29 +02:00