History log of /PHP-8.2/ext/opcache/zend_file_cache.c (Results 1 – 25 of 195)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 310b5283 11-Oct-2023 Dmitry Stogov

Merge branch 'PHP-8.1' into PHP-8.2

* PHP-8.1:
Reset inheritance_cache pointer of zend_class_entry upon serialization (#12401)


# 90f2e760 11-Oct-2023 Sergei Turchanov

Reset inheritance_cache pointer of zend_class_entry upon serialization (#12401)

to opcache filecache. Usually, when a class is being loaded, a dependency
tracking is performed after the

Reset inheritance_cache pointer of zend_class_entry upon serialization (#12401)

to opcache filecache. Usually, when a class is being loaded, a dependency
tracking is performed after the call to zend_file_cache_script_store.
But sometimes, when opcache cache is empty and there are many simultaneous
outstanding requests for compilation, some classes do have their
inheritance_cache initialized before the call to zend_file_cache_script_store,
and in that case this pointer is serialized as-is. And when such a class
is loaded from opcache filecache this pointer also loaded as-is, and now
it points to some random location in memory. This causes segfaults occuring
when traversing inheritance_cache of such classes.

We need to reset inheritance_cache pointer of zend_class_entry
upon serialization. This should have been done anyway since it is a sensible
strategy to sanitize any memory pointer upon serialization (either by calling
SERIALIZE_x macros or setting to NULL or any other deterministic value).

show more ...

# f2328302 31-Jul-2023 Ilija Tovilo

Merge branch 'PHP-8.1' into PHP-8.2

* PHP-8.1:
Check if restart is pending before trying to lock SHM


# 3e9792f4 27-Jul-2023 Mikhail Galanin

Check if restart is pending before trying to lock SHM

This reduces lock contention when Opcache restart is scheduled
but not yet started.

Closes GH-11805

# ea1287b0 03-Sep-2022 Arnaud Le Blanc

Log the cause of error when opcache cannot write to file cache (#9258)

# ddc0b490 10-Mar-2022 Ilija Tovilo

Allow arbitrary const expressions in backed enums

Closes GH-7821
Closes GH-8190
Closes GH-8418

# 04a4864b 24-Mar-2022 Max Kellermann

ext/opcache: merge redundant code and "bool" refactoring (#8237)

* ext/opcache/ZendAccelerator: make check_persistent_script_access() static

* ext/opcache/ZendAccelerator: convert "

ext/opcache: merge redundant code and "bool" refactoring (#8237)

* ext/opcache/ZendAccelerator: make check_persistent_script_access() static

* ext/opcache/ZendAccelerator: convert "int" to "bool"

* ext/opcache/zend_file_cache: convert "int" to "bool"

* ext/opcache: use true/false for zend_persistent_script.corrupted

* ext/opcache/ZendAccelerator: move duplicate code to zend_accel_discard_script()

* ext/opcache/ZendAccelerator: convert accel_deactivate_now() to function

Simplify the #iddef ZEND_WIN32.

* ext/opcache/zend_file_cache: simplify iovec initializer

* ext/opcache/zend_file_cache: add local zend_string* variables

Eliminates lots of redundant casts and avoids reloading the variable
from RAM into registers.

* ext/opcache/zend_file_cache: use ZSTR_VAL()

* ext/opcache/zend_file_cache: move code to zend_file_cache_script_write()

This eliminates duplicate error handling code.

show more ...

# 63281763 18-Mar-2022 Max Kellermann

ext/opcache/zend_shared_alloc: add zend_shared_alloc_aligned()

Eliminate some duplicate code.

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

# 024d5f4b 01-Dec-2021 Tyson Andre

Cache method overrides of ArrayAccess in zend_class_entry

Previously, code such as subclasses of SplFixedArray would check for method
overrides when instantiating the objects.

T

Cache method overrides of ArrayAccess in zend_class_entry

Previously, code such as subclasses of SplFixedArray would check for method
overrides when instantiating the objects.

This optimization was mentioned as a followup to GH-6552

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

# ddaf64b5 14-Oct-2021 Dmitry Stogov

Avoid non-immutable map_ptr indirection

# c19977d0 27-Sep-2021 Nikita Popov

Fix delayed early binding with optimization

It's possible for delayed early binding opcodes to get optimized
away if they are "unreachable". However, we still need to attempt
early b

Fix delayed early binding with optimization

It's possible for delayed early binding opcodes to get optimized
away if they are "unreachable". However, we still need to attempt
early binding for them. (In some cases we also corrupt the early
binding list outright during optimization, which is how I got here.)

Fix this by storing information about delayed early binding
independently of DECLARE_CLASS_DELAYED opcodes, so early binding is
performed even after the opcode has been dropped.

show more ...

# ba8e5d33 18-Aug-2021 Nikita Popov

Merge branch 'PHP-8.0'

* PHP-8.0:
Test file_cache prime shm + use file combination
Fix repeated file cache unserialization of zval string


# de7ba3e7 18-Aug-2021 Nikita Popov

Fix repeated file cache unserialization of zval string

The IS_UNSERIALIZED check here does not work if the string is
interned (serialized with file_cache_only=0) but unserialization

Fix repeated file cache unserialization of zval string

The IS_UNSERIALIZED check here does not work if the string is
interned (serialized with file_cache_only=0) but unserialization
happens with file_cache_only=1. In this case the unserializde
string will be in the str area after mem, which is not included
in the script size, and which is also not accessible at this
point without threading through more information. Work around
the problem by checking for the serialized representation instead.

show more ...

# e86a0a90 17-Aug-2021 Nikita Popov

Assert that file cache does not contain references

# 315f4094 11-Aug-2021 Nikita Popov

Always use CE_CACHE, remove TYPE_HAS_CE (#7336)

Currently, CE_CACHE on strings is only used with opcache interned strings. This
patch extends usage to non-opcache interned strings as wel

Always use CE_CACHE, remove TYPE_HAS_CE (#7336)

Currently, CE_CACHE on strings is only used with opcache interned strings. This
patch extends usage to non-opcache interned strings as well. This means that
most type strings can now make use of CE_CACHE even if opcache is not loaded,
which allows us to remove TYPE_HAS_CE kind, and fix some discrepancies
depending on whether a type stores a resolved or non-resolved name.

There are two cases where CE_CACHE will not be used:

* When opcache is not used and a permanent interned string (that is not an
internal class name) is used as a type name during the request. In this case
we can't allocate a map_ptr index for the permanent string, as it would be
not be in the permanent map_ptr index space.
* When opcache is used but the script is not cached (e.g. eval'd code or
opcache full). If opcache is used, we can't allocate additional map_ptr
indexes at runtime, because they may conflict with indexes allocated by
opcache.

In these two cases we would end up not using CE caching for property types
(argument/return types still have the separate cache slot).

show more ...

# 5e997ec3 10-Aug-2021 Nikita Popov

Remove special self/parent handling in get_class_name_map_ptr() (#7330)

zend_accel_get_class_name_map_ptr() for "self" and "parent" will
currently try to determine which class these refe

Remove special self/parent handling in get_class_name_map_ptr() (#7330)

zend_accel_get_class_name_map_ptr() for "self" and "parent" will
currently try to determine which class these refer to, and then
initialize the CE_CACHE on those strings.

However, this shouldn't be necessary: We already initialize
CE_CACHE on all class declaration names, so it should be covered
through that already.

show more ...

# 3eb97a45 22-Jul-2021 Nikita Popov

Always use separate static_members_table

When running without opcache, static_members_table is shared with
default_static_members_table. This is visible in reflection output,
because

Always use separate static_members_table

When running without opcache, static_members_table is shared with
default_static_members_table. This is visible in reflection output,
because ReflectionProperty::getDefaultValue() will return the
current value, rather than the default value.

Address this by never sharing the table, which matches the behavior
we already see under opcache.

Fixes bug #80821.

Closes GH-7299.

show more ...

# 570d9b63 20-Jul-2021 Joe Watkins

Not serializable flag permeation

# 01b3fc03 06-May-2021 KsaR

Update http->https in license (#6945)

1. Update: http://www.php.net/license/3_01.txt to https, as there is anyway server header "Location:" to https.
2. Update few license 3.0 to 3.01 as

Update http->https in license (#6945)

1. Update: http://www.php.net/license/3_01.txt to https, as there is anyway server header "Location:" to https.
2. Update few license 3.0 to 3.01 as 3.0 states "php 5.1.1, 4.1.1, and earlier".
3. In some license comments is "at through the world-wide-web" while most is without "at", so deleted.
4. fixed indentation in some files before |

show more ...

# e8e7c04a 29-Apr-2021 Nikita Popov

Use common struct to store error information

This is needed by both fibers and opcache (and GH-6903 also uses it),
so make it a common structure that can be used by any functionality

Use common struct to store error information

This is needed by both fibers and opcache (and GH-6903 also uses it),
so make it a common structure that can be used by any functionality
storing warnings/errors.

show more ...

# f1ce44d1 15-Apr-2021 Nikita Popov

Fix static variables in main script with file cache

If the script will be cached in SHM (!corrupted), then we cannot
allocate the static variables on the arena. Instead do the same
t

Fix static variables in main script with file cache

If the script will be cached in SHM (!corrupted), then we cannot
allocate the static variables on the arena. Instead do the same
thing we do during normal persistence and allocate a map ptr slot.

show more ...

# bd3ba546 10-Apr-2021 Nikita Popov

Revert "Don't allocate temporary file cache memory on arena"

This reverts commit 4440ac3ed67e7d32f40be0968dbe8d89bef76f1b.

This fix wasn't correct, as we do retain the arena-allocat

Revert "Don't allocate temporary file cache memory on arena"

This reverts commit 4440ac3ed67e7d32f40be0968dbe8d89bef76f1b.

This fix wasn't correct, as we do retain the arena-allocation
for the file cache only case. This will need some other way to
reconcile both modes.

show more ...

# 4440ac3e 09-Apr-2021 Nikita Popov

Don't allocate temporary file cache memory on arena

During unserialization, static_variables and runtime_cache may be
allocated on the arena, and then later freed when the checkpoint

Don't allocate temporary file cache memory on arena

During unserialization, static_variables and runtime_cache may be
allocated on the arena, and then later freed when the checkpoint
is released.

As we're only doing a single large allocation here, simply move
this to the normal allocator, so there is no interference with
other arena allocations.

show more ...

12345678