| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
| |
RFC: https://wiki.php.net/rfc/enumerations
Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
Closes GH-6489.
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
zend_file_cache_unserialize_type().
Don't use scope of closures.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
The `zend_system_id` is a (true global) system ID that fingerprints a process state. When extensions add engine hooks during MINIT/startup, entropy is added the system ID for each hook. This allows extensions to identify that changes have been made to the engine since the last PHP process restart.
Closes GH-5871
|
|\
| |
| |
| |
| | |
* PHP-7.4:
Fixed bug #79917
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
op_arrays can be shared on two levels: Either the op_array is
completely shared, or it is distinct but shares all members
(apart from static_variables).
The the op_array is distinct, we need to make sure to properly
initialize the MAP_PTR structures.
|
|\ \
| |/
| |
| |
| |
| |
| | |
* PHP-7.4:
Fixed bug #79930
Fix iov_base pointer type for illumos
Backport bless_tests.php changes from PHP 8
|
| |\
| | |
| | |
| | |
| | | |
* PHP-7.3:
Fix iov_base pointer type for illumos
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
These systems has two versions of the iovec interface dependent on
compiler flags passed, the legacy version causing little build issue.
Closes GH-5939.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
From an engine perspective, named parameters mainly add three
concepts:
* The SEND_* opcodes now accept a CONST op2, which is the
argument name. For now, it is looked up by linear scan and
runtime cached.
* This may leave UNDEF arguments on the stack. To avoid having
to deal with them in other places, a CHECK_UNDEF_ARGS opcode
is used to either replace them with defaults, or error.
* For variadic functions, EX(extra_named_params) are collected
and need to be freed based on ZEND_CALL_HAS_EXTRA_NAMED_PARAMS.
RFC: https://wiki.php.net/rfc/named_params
Closes GH-5357.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
RFC: https://wiki.php.net/rfc/nullsafe_operator
Closes GH-5619.
Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
|
| | |
| | |
| | |
| | |
| | |
| | | |
RFC: https://wiki.php.net/rfc/match_expression_v2
Closes GH-5371.
|
| | |
| | |
| | |
| | |
| | | |
We should use these cache slots for the new object serialization
mechanism rather than the old one.
|
| | |
| | |
| | |
| | | |
check
|
| | |
| | |
| | |
| | | |
Co-authored-by: Martin Schröder <m.schroeder2007@gmail.com>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
If opcache.record_warnings is enabled, opcache will record
compilation warnings and replay them when the file is included
again. The primary use case I have in mind for this is automated
testing of the opcache file cache.
This resolves bug #76535.
|
|\ \ \
| |/ /
| | |
| | |
| | |
| | | |
* PHP-7.4:
Fix static property indirections in file cache
Don't require rc=1 for function static variables
|
| | |
| | |
| | |
| | |
| | |
| | | |
If the class is already linked, we need to serialize and
unserialize INDIRECTed static properties. Normally these would
be set up when copying from cache.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Fix file cache serialization of property types. I'm changing the
overall type serialization format to perform additional adjustments
in order to yield a plausible pointer for zend_type, rather than
using an entirely separate serialization format, as was previously
done. That would have been annoying to extend to the case of CE
pointers.
|
| | |
| | |
| | |
| | | |
This is already done in master.
|
| | |
| | |
| | |
| | | |
optimization_level, debug flags, etc)
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Instead of having a completely independent encoding for type list
entries. This is going to use more memory, but I'm not particularly
concerned about that, as type unions that contain multiple classes
should be uncommon. On the other hand, this allows us to treat
top-level types and types inside lists mostly the same.
A new ZEND_TYPE_FOREACH macros allows to transparently treat list
and non-list types the same way. I'm not using it everywhere it could be
used for now, just the places that seemed most obvious.
Of course, this will make any future type system changes much simpler,
as it will not be necessary to duplicate all logic two times.
|
|\ \ \
| |/ /
| | |
| | |
| | |
| | | |
* PHP-7.4:
Fix file cache run_time_cache unserialization
Update ZCSG(map_ptr_last) only if for_shm
|
| | |
| | |
| | |
| | |
| | |
| | | |
If the script was serialized as file_cache_only (thus non-immutable)
and then gets unserialized into SHM, we need to allocate a new
run_time_cache slot and can't use the serialized arena pointer.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
According to RFC: https://wiki.php.net/rfc/union_types_v2
The type representation now makes use of both the pointer payload
and the type mask at the same time. Additionall, zend_type_list is
introduced as a new kind of pointer payload, which is used to store
multiple class types. Each of the class types is a tagged pointer,
which may be either a class name or class entry. The latter is only
used for typed properties, while arguments/returns will instead use
cache slots. A type list can contain a mix of both names and CEs at
the same time, as not all classes may be resolvable.
One thing this is missing is support for union types in arginfo
and stubs, which I want to handle separately.
I've also dropped the special object code from the JIT implementation
for now -- I plan to add this back in a different form at a later time.
For now I did not want to include non-trivial JIT changes together
with large functional changes.
Another possible piece of follow-up work is to implement "iterable"
as an internal alias for "array|Traversable". I believe this will
eliminate quite a few special-cases that had to be implemented.
Closes GH-4838.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
We now store the pointer payload and the type mask separately. This
is in preparation for union types, where we will be using both at
the same time.
To avoid increasing the size of arginfo structures, the
pass_by_reference and is_variadic fields are now stored as part of
the type_mask (8-bit are reserved for custom use).
Different types of pointer payloads are distinguished based on bits
in the type_mask.
|
|\ \ \
| |/ /
| | |
| | |
| | | |
* PHP-7.4:
Fix checksum calculation for opcache
|
| |\ \
| | |/
| | |
| | |
| | | |
* PHP-7.3:
Fix checksum calculation for opcache
|
| | |\
| | | |
| | | |
| | | |
| | | | |
* PHP-7.2:
Fix checksum calculation for opcache
|
| | | | |
|
|\ \ \ \
| |/ / /
| | | |
| | | |
| | | | |
* PHP-7.4:
ZEND_DECLARE_ANON_CLASS doesn't need to skip anything now. It's immediatelly followed by ZEND_NEW.
|
| | | |
| | | |
| | | |
| | | | |
followed by ZEND_NEW.
|
|\ \ \ \
| |/ / /
| | | |
| | | |
| | | | |
* PHP-7.4:
Allow multiple cache instances per user/host on Windows
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Formerly, there was at most a single OPcache instance per user and the
so called system ID (which is determined from the PHP version).
Sometimes multiple OPcaches might be desired, though, particularly for
unrelated CLI scripts, which may even be necessary (e.g. for our test
suite in parallel mode).
We therefore introduce a new INI directive `opcache.cache_id` which
allows to configure independent OPcache instances for the same user.
We also use `GetUserNameW()` instead of `php_win32_get_username()`,
because the latter retrieves the user name encoded in the
`default_charset`, which can obviously yield different results for
different charsets, leading to OPcache "incompatibilities". Slightly
worse, some characters may not even be encodeable in the
`default_charset` and would be replaced by question marks, which could
result in different users sharing the same OPcache.
We also refactor, and re-use existing APIs to avoid duplicated code.
|
|\ \ \ \
| |/ / / |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
It would be great if this were fully initialized, but it's not
really a problem either (as long as we don't care about reproducible
file cache), so ignore this for now.
|
| | | | |
|
|\ \ \ \
| |/ / /
| | | |
| | | |
| | | | |
* PHP-7.4:
Fix #78189: file cache strips last character of uname hash
|
| |\ \ \
| | |/ /
| | | |
| | | |
| | | | |
* PHP-7.3:
Fix #78189: file cache strips last character of uname hash
|
| | |\ \
| | | |/
| | | |
| | | |
| | | | |
* PHP-7.2:
Fix #78189: file cache strips last character of uname hash
|
| | | |
| | | |
| | | |
| | | |
| | | | |
We must not forget to increase `len` by one to cater to the directory
separator.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
To solve issues detected during testing, we backport the following
commits to PHP 7.2:
129c5c1181bf344b37e13fd6dc5dfe76c13d7208
9ac133a0b3863ca4d9659140154ee237e5f4669a
ce72bc6b658c335dd37393d0beb28584e6805e97
|
|\ \ \ \
| |/ / /
| | | |
| | | |
| | | | |
* PHP-7.4:
Turn system_id into a true global
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
The system_id is identical for all threads and can be computed during
module startup, so there is no need to calculate and store it for each
thread.
|