#
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 ...
|
#
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
|
Revision tags: php-8.1.7RC1, php-8.1.4RC1, php-8.1.3, php-8.1.2RC1, php-8.1.0, php-7.3.33, php-7.3.32, php-7.3.31, php-7.3.30 |
|
#
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 |
Revision tags: php-7.3.29 |
|
#
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 ...
|
Revision tags: php-7.3.28 |
|
#
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 ...
|
#
e0e19fd9 |
| 09-Apr-2021 |
Nikita Popov |
Fix file cache We should only access xlat if this is called from persist, not when it is called from file cache. |
#
d8e4fbae |
| 08-Apr-2021 |
Dmitry Stogov |
Fast Class Cache This is generalization of idea, that was previously usesd for caching resolution of class_entries in zend_type. Now very similar mechanizm is used for general zend_s
Fast Class Cache This is generalization of idea, that was previously usesd for caching resolution of class_entries in zend_type. Now very similar mechanizm is used for general zend_string into zend_class_entry resolution. Interned zend_string with IS_STR_CLASS_NAME_MAP_PTR GC_FLAG uses its refcount to adress corresponding zend_class_entry cache slot. The refcount keeps an offset to this slot from CG(map_ptr_base). Flag may be checked by ZSTR_HAS_CE_CACHE(str), cache slot may be read by ZSTR_GET_CE_CACHE(str) and set by ZSTR_SET_CE_CACHE(str, ce).
show more ...
|
#
8ed8cf86 |
| 22-Mar-2021 |
Dmitry Stogov |
Use zend_string* instead of char* |
Revision tags: php-7.3.27, php-7.3.26, php-7.3.26RC1, php-7.3.25, php-7.3.25RC1, php-7.3.24, php-7.3.24RC1, php-7.3.23, php-7.3.23RC1, php-7.3.22, php-7.3.22RC1, php-7.3.21, php-7.3.21RC1, php-7.3.20, php-7.3.20RC1 |
|
#
269c8dac |
| 10-Jun-2020 |
Ilija Tovilo |
Implement enums RFC: https://wiki.php.net/rfc/enumerations Co-authored-by: Nikita Popov <nikita.ppv@gmail.com> Closes GH-6489. |
#
709e45d8 |
| 17-Mar-2021 |
Nikita Popov |
Avoid unnecessary static_variables persistence static_variables should be treated the same way as all other op_array components nowadays (only static_variables_ptr is special). There
Avoid unnecessary static_variables persistence static_variables should be treated the same way as all other op_array components nowadays (only static_variables_ptr is special). There's no need to persist/serialize it is separately per shared op_array.
show more ...
|
Revision tags: php-7.3.19, php-7.4.7RC1, php-7.3.19RC1 |
|
#
47a2e5c7 |
| 18-May-2020 |
Nikita Popov |
Reference dynamic functions through dynamic_defs Currently, dynamically declared functions and closures are inserted into the function table under a runtime definition key, and then late
Reference dynamic functions through dynamic_defs Currently, dynamically declared functions and closures are inserted into the function table under a runtime definition key, and then later possibly renamed. When opcache is not used and a file containing a closure is repeatedly included, this leads to a very large memory leak, as the no longer needed closure declarations will never be freed (https://bugs.php.net/bug.php?id=76982). With this patch, dynamic functions are instead stored in a dynamic_func_defs member on the op_array, which opcodes reference by index. When the parent op_array is destroyed, the dynamic_func_defs it contains are also destroyed (unless they are stilled used elsewhere, e.g. because they have been bound, or are used by a live closure). This resolves the fundamental part of the leak, though doesn't completely fix it yet due to some arena allocations. The main non-obvious change here is to static variable handling: We can't destroy static_variables_ptr in destroy_op_array, as e.g. that would clear the static variables in a dynamic function when the op_array containing it is destroyed. Static variable destruction is separated out for this reason (we already do static variable destruction separately for normal functions, so we only need to handle main scripts). Closes GH-5595.
show more ...
|
#
23afc620 |
| 24-Feb-2021 |
Nikita Popov |
Allow pointer to end of memory in IS_UNSERIALIZED() We already use <= for IS_SERIALIZED(), but the same general problem can also occur for IS_UNSERIALIZED(). We don't seem to hit thi
Allow pointer to end of memory in IS_UNSERIALIZED() We already use <= for IS_SERIALIZED(), but the same general problem can also occur for IS_UNSERIALIZED(). We don't seem to hit this in practice prior to GH-5595 though.
show more ...
|
#
5d160e30 |
| 17-Feb-2021 |
Nikita Popov |
Fix static variable behavior with inheritance When a method is inherited, the static variables will now always use the initial values, rather than the values at the time of inheritan
Fix static variable behavior with inheritance When a method is inherited, the static variables will now always use the initial values, rather than the values at the time of inheritance. As such, behavior no longer depends on whether inheritance happens before or after a method has been called. This is implemented by always keeping static_variables as the original values, and static_variables_ptr as the modified copy. Closes GH-6705.
show more ...
|
#
b113f7e8 |
| 10-Feb-2021 |
Dmitry Stogov |
Unserialize op_array->scope before passing to zend_file_cache_unserialize_type(). Don't use scope of closures. |
#
6aea64c4 |
| 10-Feb-2021 |
Dmitry Stogov |
Reuse single map_ptr slot for indentical class names |
#
4b79dba9 |
| 09-Feb-2021 |
Dmitry Stogov |
Added Inheritance Cache. This is a new transparent technology that eliminates overhead of PHP class inheritance. PHP classes are compiled and cached (by opcahce) separately, howeve
Added Inheritance Cache. This is a new transparent technology that eliminates overhead of PHP class inheritance. PHP classes are compiled and cached (by opcahce) separately, however their "linking" was done at run-time - on each request. The process of "linking" may involve a number of compatibility checks and borrowing methods/properties/constants form parent and traits. This takes significant time, but the result is the same on each request. Inheritance Cache performs "linking" for unique set of all the depending classes (parent, interfaces, traits, property types, method types involved into compatibility checks) once and stores result in opcache shared memory. As a part of the this patch, I removed limitations for immutable classes (unresolved constants, typed properties and covariant type checks). So now all classes stored in opcache are "immutable". They may be lazily loaded into process memory, if necessary, but this usually occurs just once (on first linking). The patch shows 8% improvement on Symphony "Hello World" app.
show more ...
|