History log of /PHP-8.3/Zend/Optimizer/zend_optimizer.c (Results 1 – 25 of 41)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# a18df90a 22-Jul-2024 Bob Weinand

Fix GH-13817: Segmentation fault for enabled observers after pass 4

Instead of fixing up temporaries count in between observer steps, just apply the additional temporary in the two affected

Fix GH-13817: Segmentation fault for enabled observers after pass 4

Instead of fixing up temporaries count in between observer steps, just apply the additional temporary in the two affected observer steps.

Closes GH-14018.

show more ...


# 731734da 18-Dec-2023 Dmitry Stogov

Fixed type inference

Fixes oss-fuzz #65150


Revision tags: php-8.2.0RC1, php-8.1.10, php-8.0.23, php-8.0.23RC1, php-8.1.10RC1, php-8.2.0beta3
# 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 ...


# 821fc55a 22-Feb-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Implement GH-9826: Make class_alias() work with internal classes (#10483)

We can't increase the refcount of internal classes during request time.
To work around this problem we simply do

Implement GH-9826: Make class_alias() work with internal classes (#10483)

We can't increase the refcount of internal classes during request time.
To work around this problem we simply don't refcount aliases anymore and
add a check in the destruction to skip aliases entirely.
There were also some checks which checked for an alias implicitly by
comparing the refcount, these have been replaced by checking the type of
the zval instead.

show more ...


# 2e78c080 20-Feb-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Improve the optimizer's check if a function is a prototype or not (#10467)

Currently, a function is considered a prototype if the function is not
marked as final. However, a class marked

Improve the optimizer's check if a function is a prototype or not (#10467)

Currently, a function is considered a prototype if the function is not
marked as final. However, a class marked as final also make it
impossible for a function to be overridden. Therefore, we know in this
case too that the function is not a prototype.
This allows the type inference algorithm to determine some types more
precisely, and can allow for more optimizations of the instructions.
Additionally, place some computation of the flags in their respective
blocks as a micro-optimization.

Note: anonymous classes *can* be extended (see test
Zend/tests/anon/011.phpt). Therefore we don't optimize this case.

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 ...


# 1a067b84 04-Jan-2023 Max Kellermann

Zend/Optimizer/zend_optimizer: include cleanup


Revision tags: php-8.2.0beta2, php-8.1.9, php-8.0.22
# dc5475c1 28-Jul-2022 Bob Weinand

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 itera

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.

show more ...


Revision tags: php-8.1.9RC1, php-8.2.0beta1, php-8.0.22RC1, php-8.0.21, php-8.1.8, php-8.2.0alpha3, php-8.1.8RC1, php-8.2.0alpha2, php-8.0.21RC1, php-8.0.20, php-8.1.7, php-8.2.0alpha1, php-7.4.30, php-8.1.7RC1, php-8.0.20RC1, php-8.1.6, php-8.0.19, php-8.1.6RC1, php-8.0.19RC1
# 948ef10d 25-Apr-2022 Dmitry Stogov

Fix ISSET_ISEMPTY_VAR missoptimization

This fixes oss-fuzz #46909


Revision tags: php-8.0.18, php-8.1.5, php-7.4.29, php-8.1.5RC1, php-8.0.18RC1, php-8.1.4, php-8.0.17, php-8.1.4RC1, php-8.0.17RC1, php-8.1.3, php-8.0.16, php-7.4.28, php-8.1.3RC1, php-8.0.16RC1, php-8.1.2, php-8.0.15, php-8.1.2RC1, php-8.0.15RC1
# 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 ...


# 0698bf79 30-Dec-2021 Nikita Popov

Add helper for convertion to CHECK_VAR/FREE/NOP

This is a recurring pattern whenever an instruction with an
operand is deleted.


# a066b809 27-Dec-2021 Dmitry Stogov

Skip abstract methods


# 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.


# 1050edae 26-Dec-2021 Nikita Popov

Extract special function evaluation from pass1

Pass1 handles a number of special functions that can be evaluated
under some circumstances. Move the core logic into a separate
helper,

Extract special function evaluation from pass1

Pass1 handles a number of special functions that can be evaluated
under some circumstances. Move the core logic into a separate
helper, as I believe that SCCP should reuse this.

show more ...


# 206d80e1 25-Dec-2021 Nikita Popov

Reuse get_class_entry_from_op1() helper

Export and reuse this helper in places that fetch a class entry
from op1.


# 2cf93032 25-Dec-2021 Nikita Popov

Sink op_array scope case into get_class_entry()

This handles references to the current class through its name
rather than self (and for cases where is is not linked yet and
thus not

Sink op_array scope case into get_class_entry()

This handles references to the current class through its name
rather than self (and for cases where is is not linked yet and
thus not covered by the context lookup). Rather than handling this
only for FETCH_CLASS_CONSTANT optimization, integrate this into
the generic get_class_entry() utility.

show more ...


# 52676f2b 25-Dec-2021 Nikita Popov

Remove unnecessary wrapper function

This seems to date back to a time where zval_ptr_dtor was a macro
implicitly passing additional parameters.


# 08840484 25-Dec-2021 Nikita Popov

Don't exclude arrays from constant collection

These are supported as constants nowadays, so we can drop the
string check.

Also fix a potential leak, though I believe this doesn'

Don't exclude arrays from constant collection

These are supported as constants nowadays, so we can drop the
string check.

Also fix a potential leak, though I believe this doesn't matter in
current usage, as it will effectively be suppressed during persist.

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 ...


# 4ad9dbba 25-Dec-2021 Nikita Popov

Don't replace SEND opcodes with different by-ref behavior

update_op1_const() implements the right logic here -- these cannot
be replaced by different opcodes, as the by-ref passing behav

Don't replace SEND opcodes with different by-ref behavior

update_op1_const() implements the right logic here -- these cannot
be replaced by different opcodes, as the by-ref passing behavior
is not the same.

show more ...


# 46d1e503 25-Dec-2021 Nikita Popov

Remove redundant code in zend_optimizer_replace_by_const()

zend_optimizer_update_op1_const() already handles these cases.


Revision tags: php-8.0.14, php-8.1.1, php-7.4.27, php-8.1.1RC1, php-8.0.14RC1, php-7.4.27RC1, php-8.1.0, php-8.0.13, php-7.4.26, php-7.3.33
# f313b65a 15-Nov-2021 Dmitry Stogov

Optimize closures nested in other closures


Revision tags: php-8.1.0RC6
# 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 ...


12