1
0
mirror of https://github.com/php/php-src.git synced 2026-04-21 23:18:13 +02:00
Commit Graph

3938 Commits

Author SHA1 Message Date
Nikita Popov dd86987b2c Replay warnings during inheritance (#6928)
Since 3e6b447979 it is again possible to have
warnings (deprecations) during inheritance, and more such functionality is
likely in the future. This is a problem, because such warnings will only be
shown on the first request if the opcache inheritance cache is used. This
currently causes test failures in --repeat builds.

Fix this by uplifting the error recording functionality from opcache to Zend,
and then using it to persist a warning trace in the inheritance cache, which
can then be used to replay the warnings on subsequent executions.
2021-04-29 16:37:53 +02:00
Nikita Popov e8e7c04a3a 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.
2021-04-29 11:50:54 +02:00
Nikita Popov 9a1da9f61f Don't use separate static variables in inherited methods
RFC: https://wiki.php.net/rfc/static_variable_inheritance

Closes GH-6719.
2021-04-28 17:08:50 +02:00
Dmitry Stogov 721bd973f9 Fixed CPU detection 2021-04-27 23:00:09 +03:00
Nikita Popov a1c6ee2164 Convert error filename to zend_string
Error handling functions/callbacks now accept the error filename
as a zend_string* instead of a const char*.
2021-04-23 11:05:14 +02:00
Dmitry Stogov 8c420bd265 Remove useless masking 2021-04-22 23:49:02 +03:00
Dmitry Stogov 76452651ba Fixed incorrect error message 2021-04-22 02:40:22 +03:00
Dmitry Stogov 3c37a3426b Fixed possible incorrect assumption if constant is a power of 2. 2021-04-22 02:32:49 +03:00
George Peter Banyard dcdc5d9069 Drop -Wno-implicit-fallthrough compiler flag
And add it back to ext/date, ext/hash, and ext/opcache
2021-04-19 13:59:18 +01:00
Dmitry Stogov f1ad9199ef Better support for cross-compilation 2021-04-16 17:28:54 +03:00
Nikita Popov f1ce44d1cb 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.
2021-04-15 16:37:28 +02:00
twosee c457be80dd Merge branch 'PHP-8.0'
* PHP-8.0:
  Fixed bug #80900
2021-04-14 00:21:37 +08:00
twosee a3e6735999 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fixed bug #80900

# Conflicts:
#	ext/opcache/Optimizer/sccp.c
2021-04-14 00:15:06 +08:00
twosee 7c6cf09463 Fixed bug #80900
SCCP optimization marks the wrong target feasible when the constant is of the incorrect type.

Closes GH-6861.
2021-04-14 00:07:32 +08:00
Dmitry Stogov 0fc3818cc5 Initialize fast class cache 2021-04-13 15:54:02 +03:00
Nikita Popov a1fdfa700b Fixed bug #80950
Function info for curl_exec() incorrect specified that the
function cannot return true. This is already fixed in PHP 8,
as the func info entry was removed there.
2021-04-12 16:05:37 +02:00
Nikita Popov bd3ba5465b Revert "Don't allocate temporary file cache memory on arena"
This reverts commit 4440ac3ed6.

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.
2021-04-10 12:46:22 +02:00
Nikita Popov 4440ac3ed6 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.
2021-04-09 17:11:50 +02:00
Nikita Popov e0e19fd955 Fix file cache
We should only access xlat if this is called from persist, not
when it is called from file cache.
2021-04-09 16:52:18 +02:00
Nikita Popov 3585f5aafc Explicitly set interned_strings_buffer in logging tests
These tests cannot be run with interned_strings_buffer=0.
2021-04-09 15:41:00 +02:00
Nikita Popov 4ce5d2ea88 Add known strings for jit autoglobals
We always create interned strings for all autoglobals anyway, so
we might as well add known strings to make them more widely usable.
2021-04-09 15:37:59 +02:00
Nikita Popov ce4afd50a9 Remove special handling of method named during preloading
Nowadays op_arrays always hold a ref to the function_name, even
if they are fully shared. As such, I don't believe that this code
is necessary anymore, and it interferes with the code that
releases function_names the appropriate number of times while
persisting.
2021-04-09 15:08:46 +02:00
Nikita Popov 46ee57e910 Don't leak accel key if interning fails 2021-04-09 14:24:07 +02:00
Dmitry Stogov 61e385a358 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fixed type inference for OP_DATA
2021-04-09 14:53:34 +03:00
Dmitry Stogov 7a8ffcec7d Fixed type inference for OP_DATA 2021-04-09 14:52:55 +03:00
Nikita Popov 46a884bb67 Don't leak include_path if it cannot be interned 2021-04-09 13:05:27 +02:00
Nikita Popov fe9f4298b5 Fix class map ptr for parent type if interning disabled
As zend_update_parent_ce() only runs later, the parent reference
may still point to the original class entry rather than the
persisted one. Memory held by the original class entry may have
already been deallocated. Avoid use-after-free by explicitly
fetching the persisted parent CE.
2021-04-09 12:24:12 +02:00
George Peter Banyard 09efad615b Use zend_string_equals_(literal_)ci() API more often
Also drive-by usage of zend_ini_parse_bool()

Closes GH-6844
2021-04-09 02:34:50 +01:00
Dmitry Stogov d8e4fbae62 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).
2021-04-08 23:37:40 +03:00
Nikita Popov 47a722e77f Merge branch 'PHP-8.0'
* PHP-8.0:
  Don't mark non-refcounted phi as live
2021-04-08 18:24:57 +02:00
Nikita Popov 332a367538 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Don't mark non-refcounted phi as live
2021-04-08 18:21:00 +02:00
Nikita Popov 29fa4d203a Don't mark non-refcounted phi as live
If the value is not refcounted, then it doesn't matter if the
FREE gets dropped.
2021-04-08 18:20:09 +02:00
Nikita Popov dbe2cdd7dc Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix DCE of FREE of COALESCE

Note that this is a non-trivial merge, as opt/coalesce.phpt
regresses with this change. I'll have to see if it can be
improved.
2021-04-08 17:06:40 +02:00
Nikita Popov 59b2a899ca Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix DCE of FREE of COALESCE
2021-04-08 17:01:19 +02:00
Nikita Popov 0826a54836 Fix DCE of FREE of COALESCE
When encountering the following SSA graph:

    BB1:
    #2.T1 [string] = COALESCE #1.CV0($str) [null, string] BB2

    BB2:
    #5.T1 [string] = QM_ASSIGN string("")

    BB3:
    #7.X1 [string] = Phi(#2.X1 [string], #5.X1 [string])
    FREE #7.T1 [string]

We would currently determine that #7, #5 are dead, and eliminate
the FREE and QM_ASSIGN. However, we cannot eliminate #2, as
COALESCE is also responsible for control flow.

Fix this my marking all non-CV phis as live to start with. This
can be relaxed to check the kind of the source instruction, but
I couldn't immediately come up with a case where it would be
useful.
2021-04-08 17:01:13 +02:00
George Peter Banyard 5caaf40b43 Introduce pseudo-keyword ZEND_FALLTHROUGH
And use it instead of comments
2021-04-07 00:46:29 +01:00
Nikita Popov 7a306c0813 Fix skipif section in test
This was migrated to --EXTENSIONS--.
2021-04-06 09:58:49 +02:00
twosee fc64a7bef4 Ignore some opcodes in JIT check
Some user opcode handler actually gets called when JIT is used, so do not disable JIT even if these user opcode handlers were registered, just ignore them.

ZEND_EXIT can help Swoole to detect exit/die operation and exit from the current coroutine and record exit_status correctly.
ZEND_*_SILENCE can help Swoole to switch EG(error_reporting) to keep the right behavior when using the error control operator.
So we ignore ZEND_EXIT, ZEND_BEGIN_SILENCE, ZEND_END_SILENCE in JIT check here.

Closes GH-6640.
2021-04-06 11:58:20 +08:00
Dmitry Stogov 22019a1edd Fixed unintended string duplication 2021-04-05 17:55:42 +03:00
George Peter Banyard 705e93a22f Fix necessary extensions list for OPcache test 2021-04-05 06:34:13 +01:00
Max Semenik e9f783fcdd Migrate skip checks to --EXTENSIONS--, p3
For rationale, see #6787

Extensions migrated in part 3:
* ftp
* gmp
* iconv
* opcache
* shmop
2021-04-03 15:23:25 +02:00
Dmitry Stogov 33f938bad0 Fixed macros 2021-04-02 19:22:30 +03:00
Mike Pall 83b01a920e DynASM: Fix global label references
ARM64 patch contributed by Hao Sun and Nick Gasson.
2021-03-31 23:55:36 +03:00
Mike Pall 0b4f83f68f DynASM/ARM64: Add VREG support.
Contributed by Hao Sun and Nick Gasson.
2021-03-31 23:54:22 +03:00
Dmitry Stogov b428c51aea Merge upstream DynAsm changes from LuaJIT 2021-03-31 23:51:19 +03:00
Dmitry Stogov a6dd92f820 Remove reference to $GLOBALS. We don't create an actual variable for $GLOBALS any more . 2021-03-31 12:28:23 +03:00
Dmitry Stogov 8c001d5ba3 We don't create an actual variable for $GLOBALS any more. 2021-03-30 15:12:10 +03:00
Dmitry Stogov 849ae12e7a Simplify auto-globals checks 2021-03-30 13:56:29 +03:00
Dmitry Stogov 7b2b9b4079 Improved JIT for TYPE_CHECK opcode 2021-03-25 23:48:08 +03:00
Dmitry Stogov 22fc522483 Improve JIT for IS_IDENTICAL 2021-03-25 17:27:03 +03:00