History log of /PHP-8.2/Zend/Optimizer/sccp.c (Results 1 – 25 of 37)
Revision Date Author Comments
# 631bc816 06-Feb-2024 Ilija Tovilo

Implement stackless internal function calls

Co-authored-by: Dmitry Stogov <dmitry@zend.com>

Closes GH-12461


# d8696f92 17-Jul-2023 George Peter Banyard

[RFC] Path to Saner Increment/Decrement operators (#10358)

* Add behavioural tests for incdec operators

* Add support to ++/-- for objects castable to _IS_NUMBER

* Add str_

[RFC] Path to Saner Increment/Decrement operators (#10358)

* Add behavioural tests for incdec operators

* Add support to ++/-- for objects castable to _IS_NUMBER

* Add str_increment() function

* Add str_decrement() function

RFC: https://wiki.php.net/rfc/saner-inc-dec-operators

Co-authored-by: Ilija Tovilo <ilija.tovilo@me.com>
Co-authored-by: Arnaud Le Blanc <arnaud.lb@gmail.com>

show more ...


# 0b1d750d 11-Aug-2022 Ilija Tovilo

Allow arbitrary expressions in static variable initializer

Closes GH-9301


# d5c649b3 23-Feb-2023 Max Kellermann

zend_compiler, ...: use `uint8_t` instead of `zend_uchar` (#10621)

`zend_uchar` suggests that the value is an ASCII character, but here,
it's about very small integers. This is misleadi

zend_compiler, ...: use `uint8_t` instead of `zend_uchar` (#10621)

`zend_uchar` suggests that the value is an ASCII character, but here,
it's about very small integers. This is misleading, so let's use a
C99 integer instead.

On all architectures currently supported by PHP, `zend_uchar` and
`uint8_t` are identical. This change is only about code readability.

show more ...


# 49c1e6eb 20-Feb-2023 Max Kellermann

Make various pointers const in Zend/ (#10608)

* Zend/zend_operators: pass const pointers to zend_is_identical()

* Zend/zend_operators: pass const pointers to zend_get_{long,double}(

Make various pointers const in Zend/ (#10608)

* Zend/zend_operators: pass const pointers to zend_is_identical()

* Zend/zend_operators: pass const pointers to zend_get_{long,double}()

* Zend/Optimizer/sccp: make pointers const

* Zend/Optimizer/scdf: make pointers const

* Zend/Optimizer/zend_worklist: make pointers const

* Zend/Optimizer/zend_optimizer: make pointers const

* Zend/zend_compile: make pointers const

show more ...


# 2f4973fd 16-Jan-2023 Christoph M. Becker

Revert GH-10279

Cf. <https://github.com/php/php-src/pull/10220#issuecomment-1383739816>.

This reverts commit 45a128c9de93bf60956102d85d15f1fe8913bb70.
This reverts commit 1eb71c

Revert GH-10279

Cf. <https://github.com/php/php-src/pull/10220#issuecomment-1383739816>.

This reverts commit 45a128c9de93bf60956102d85d15f1fe8913bb70.
This reverts commit 1eb71c3f155a42ad6867cd5e2f6d921a99506a37.
This reverts commit 492523a779dced91eb09215183287e0856b693bf.
This reverts commit c7a4633891392d16d40b08135598807b3f0443b0.
This reverts commit 308adb915c1b659ab377f752fb27b408a455d7ed.
This reverts commit cd27d5e07f01172ac8a701996d260a731489d856.
This reverts commit c5933409b47bea760977cf9c9ea04cbb63aaafe5.
This reverts commit 46371f4eb339f7e7615a8732d61f2369f8d9129e.
This reverts commit 623e2e9fc6a23b8eb7f22010eaf99bf6f638917d.
This reverts commit e7434c124772c05fe836832e02196d50bec10c23.
This reverts commit d28d323ca20976ed776171330b90588cc3857dd6.
This reverts commit 1a067b84ee423a6fb06a5debd92b4cafefeac4e4.
This reverts commit a55c0c5fc3f624a685f42281df26cf87f445be43.
This reverts commit b5aeb3a4d40dbf38da65975d12b9d2c593b83bdd.
This reverts commit f061a035e44d3f6bbc71774f2101525d74fbf16f.
This reverts commit b088575119b3244a4d08f6a300251111a221c66b.
This reverts commit b1d48774a79592e7fb1ba85d3a2bd6717f25acec.
This reverts commit 94f9a20ce6451b54e8346cc474de6b4f9b8897a4.
This reverts commit 4831e48708e19346ace0fa5f3f085ee8afd43267.
This reverts commit cd985de190534c8e3567a4c5547eb98c45337fa0.
This reverts commit 9521d21681b22a471f21b3c56e32b883acac3301.
This reverts commit d6136151e9f7fc40e753ac0ebe1790e0d0371b6b.

show more ...


# 308adb91 04-Jan-2023 Max Kellermann

Zend/Optimizer/sccp: include cleanup


# 2c53d631 08-Mar-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Fix GH-10801: Named arguments in CTE functions cause a segfault

Fixes GH-10801

Named arguments are not supported by the constant evaluation routine, in
the sense that they are i

Fix GH-10801: Named arguments in CTE functions cause a segfault

Fixes GH-10801

Named arguments are not supported by the constant evaluation routine, in
the sense that they are ignored. This causes two issues:
- It causes a crash because not all oplines belonging to the call are
removed, which results in SEND_VA{L,R} which should've been removed.
- It causes semantic issues (demonstrated in the test case).

This case never worked anyway, leading to crashes or incorrect behaviour,
so just prevent CTE of calls with named parameters for now.
We can choose to support it later, but introducing support for this in
a stable branch seems too dangerous.

This patch does not change the removal of SEND_* opcodes in remove_call
because the crash bug can't be triggered anymore with this patch as
there are no named parameters anymore and no variadic CTE functions
exist.

Closes GH-10811.

show more ...


# fa75bd07 20-Jun-2022 Dmitry Stogov

Fix incorrect constant propagation for VERIFY_RETURN_TYPE

This fixes oss-fuzz #48104


# 5a855ee8 02-Jun-2022 Ilija Tovilo

Fix GH-8661: Nullsafe in coalesce triggers undefined variable warning

Closes GH-8690


# 332bd037 13-May-2022 Arnaud Le Blanc

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


# 6ed3b57e 18-Apr-2022 Dmitry Stogov

Fix incorrect constant propagation for VERIFY_RETURN_TYPE

Fixes oss-fuzz #46616


# 4543cd32 30-Dec-2021 Nikita Popov

Remove JMPZNZ opcode

While JMPZNZ can avoid execution of a separate JMP opcode in some
cases, it also prevents smart branch optimization, so creating
JMPZNZ may actually have a negat

Remove JMPZNZ opcode

While JMPZNZ can avoid execution of a separate JMP opcode in some
cases, it also prevents smart branch optimization, so creating
JMPZNZ may actually have a negative effect. It also adds additional
complexity for optimizations.

Drop JMPZNZ in favor of JMPZ+JMP or JMPNZ+JMP.

Closes GH-7857.

show more ...


# e45653c0 26-Dec-2021 Nikita Popov

Make sure SCCP can evaluate all functions pass1 can

Move evaluation of ini_get() into eval_special_func_call() and
use this helper both in pass1 and sccp.


# c4334fc6 26-Dec-2021 Nikita Popov

Remove special chr/count handling in sccp function evaluation

These can be handled by the generic code. Worth noting that count
will usually go through ZEND_COUNT, and chr on constants i

Remove special chr/count handling in sccp function evaluation

These can be handled by the generic code. Worth noting that count
will usually go through ZEND_COUNT, and chr on constants is
evaluated in the compiler, so these are not particularly compile-time
sensitive either.

show more ...


# 7eae7e5e 25-Dec-2021 Nikita Popov

Remove FETCH_CLASS+INSTANCEOF special case

Instead propagate the FETCH_CLASS return value, so it can be
directly replaced if possible, which will also eliminate the
FETCH_CLASS subse

Remove FETCH_CLASS+INSTANCEOF special case

Instead propagate the FETCH_CLASS return value, so it can be
directly replaced if possible, which will also eliminate the
FETCH_CLASS subsequently.

show more ...


# 92e7cf59 25-Dec-2021 Nikita Popov

Move FETCH_CLASS+INSTANCEOF special case out of update_op1_const()

The generic code was rejecting this to go into a special code path
in SCCP. We should directly do that in SCCP instead,

Move FETCH_CLASS+INSTANCEOF special case out of update_op1_const()

The generic code was rejecting this to go into a special code path
in SCCP. We should directly do that in SCCP instead, to still allow
the generic (and valid) replacement.

show more ...


# 98dfde2c 25-Dec-2021 Nikita Popov

Remove unnecessary INSTANCEOF special case in sccp

While we can't replace the instanceof operand, we will evaluate
the instanceof to false and replace its result anyway. Even in
case

Remove unnecessary INSTANCEOF special case in sccp

While we can't replace the instanceof operand, we will evaluate
the instanceof to false and replace its result anyway. Even in
cases where the instanceof user cannot be replaced, we already
have generic code to convert the opcode to QM_ASSIGN in that
case.

show more ...


# 36dafade 25-Dec-2021 Nikita Popov

Remove unnecessary try_replace_op1() special cases

update_op1_const() can handle these nowadays.


# 32e2d97a 20-Dec-2021 Tyson Andre

Allow internal functions to declare if they support compile-time evaluation, add functions. (#7780)

https://wiki.php.net/rfc/strtolower-ascii means that these functions no longer
depend

Allow internal functions to declare if they support compile-time evaluation, add functions. (#7780)

https://wiki.php.net/rfc/strtolower-ascii means that these functions no longer
depend on the current locale in php 8.2. Before that, this was unsafe to
evaluate at compile time.

Followup to GH-7506

Add strcmp/strcasecmp/strtolower/strtoupper functions

Add bin2hex/hex2bin and related functions

Update test of garbage collection using strtolower to use something else to create a refcounted string

show more ...


# 902d6439 11-Oct-2021 Nikita Popov

Deprecate implicit dynamic properties

Writing to a proprety that hasn't been declared is deprecated,
unless the class uses the #[AllowDynamicProperties] attribute or
defines __get()/

Deprecate implicit dynamic properties

Writing to a proprety that hasn't been declared is deprecated,
unless the class uses the #[AllowDynamicProperties] attribute or
defines __get()/__set().

RFC: https://wiki.php.net/rfc/deprecate_dynamic_properties

show more ...


# 90b7bde6 03-Nov-2021 Dmitry Stogov

Use more compact representation for packed arrays.

- for packed arrays we store just an array of zvals without keys.
- the elements of packed array are accessible throuf as ht->arPacked[

Use more compact representation for packed arrays.

- for packed arrays we store just an array of zvals without keys.
- the elements of packed array are accessible throuf as ht->arPacked[i]
instead of ht->arData[i]
- in addition to general ZEND_HASH_FOREACH_* macros, we introduced similar
familied for packed (ZEND_HASH_PACKED_FORECH_*) and real hashes
(ZEND_HASH_MAP_FOREACH_*)
- introduced an additional family of macros to access elements of array
(packed or real hashes) ZEND_ARRAY_ELEMET_SIZE, ZEND_ARRAY_ELEMET_EX,
ZEND_ARRAY_ELEMET, ZEND_ARRAY_NEXT_ELEMENT, ZEND_ARRAY_PREV_ELEMENT
- zend_hash_minmax() prototype was changed to compare only values

Because of smaller data set, this patch may show performance improvement
on some apps and benchmarks that use packed arrays. (~1% on PHP-Parser)

TODO:
- sapi/phpdbg needs special support for packed arrays (WATCH_ON_BUCKET).
- zend_hash_sort_ex() may require converting packed arrays to hash.

show more ...


# 5bf088f6 28-Sep-2021 Nikita Popov

Move TYPE_CHECK handling from sccp to inference

The handling of TYPE_CHECK makes for an awkward special case,
because it is determined outside the usual SCCP framework. Instead
move

Move TYPE_CHECK handling from sccp to inference

The handling of TYPE_CHECK makes for an awkward special case,
because it is determined outside the usual SCCP framework. Instead
move the logic into type inference (to infer a more specific
may_be_true or may_be_false if possible). This will get picked up
by SCCP through the existing logic to make use of type and range
information.

However, this also requires us to make use of type info in
feasible edge marking, otherwise we would regress existing
optimization power.

show more ...


# 44bc9556 20-Sep-2021 George Peter Banyard

Check against FAILURE instead of different then SUCCESS


# 53d5420d 20-Sep-2021 George Peter Banyard

Use more appropriate types in Optimizer

Mainly using zend_result and bool instead of int


12