1
0
mirror of https://github.com/php/php-src.git synced 2026-04-27 10:16:41 +02:00
Commit Graph

5563 Commits

Author SHA1 Message Date
David Carlier 02e8c16dfd Merge branch 'PHP-8.2' 2023-03-03 12:45:10 +00:00
David Carlier 8b70393c23 Merge branch 'PHP-8.1' into PHP-8.2 2023-03-03 12:44:33 +00:00
David Carlier ffc2a53a9b Fix GH-10728: opcache capstone header's inclusion.
Remove capstone include folder.
For most of the supported systems it worked fine somehow despite
 the pkg-config --cflags, but is always include it even on Linux.

Closes GH-10732.
2023-03-03 12:43:12 +00:00
Ilija Tovilo 86669774ae Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix missing readonly modification error with inc/dec in JIT
2023-03-02 11:31:42 +01:00
Ilija Tovilo 7934a0fcfb Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix missing readonly modification error with inc/dec in JIT
2023-03-02 11:31:29 +01:00
Ilija Tovilo df93146a15 Fix missing readonly modification error with inc/dec in JIT
Closes GH-10746
2023-03-02 11:29:53 +01:00
Ilija Tovilo da4167b918 Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix unescaped {TMP} variables in tests
2023-03-01 13:25:34 +01:00
Ilija Tovilo 2b5aac9303 Fix unescaped {TMP} variables in tests
On Windows {TMP} can return ~, which will result in a parse error
2023-03-01 13:24:39 +01:00
Dmitry Stogov 28be84a146 Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix Zend/tests/type_declarations/variance/class_order_autoload1.phpt test failre introduced by 44e5c04e55
2023-02-28 23:05:40 +03:00
Dmitry Stogov dcf2810cd1 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix Zend/tests/type_declarations/variance/class_order_autoload1.phpt test failre introduced by 44e5c04e55
2023-02-28 23:05:30 +03:00
Dmitry Stogov 18b43d2950 Fix Zend/tests/type_declarations/variance/class_order_autoload1.phpt
test failre introduced by 44e5c04e55

This ASSERT-ion path was never reached becuase of the bug fixed by
44e5c04e55. It's possible in case of
circular class dependencies that may resolved by __autoload().
Unfortunately these circular dependencies can't be stored in the
inheritace cahce.
2023-02-28 22:57:52 +03:00
Dmitry Stogov 44e5c04e55 Fix incorrect inheritance cache update (#10719) 2023-02-27 21:47:29 +03:00
Dmitry Stogov c7a9190124 Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix incorrect inheritance cache update (#10719)
2023-02-27 21:39:53 +03:00
Dmitry Stogov 2e3fc8c0ff Fix incorrect inheritance cache update (#10719) 2023-02-27 21:39:18 +03:00
Niels Dossche 375e7402af Change implicit enum return value checks to explicit checks (#10703) 2023-02-26 08:56:20 +00:00
David Carlier c54948378d Merge branch 'PHP-8.2' 2023-02-26 08:19:05 +00:00
David Carlier bf2e778c71 Merge branch 'PHP-8.1' into PHP-8.2 2023-02-26 08:18:09 +00:00
Niels Dossche eb7bb3430b Fix format string mistake in accel_move_code_to_huge_pages()
inode is unsigned, so use %lu instead of %ld
2023-02-26 08:12:57 +00:00
Max Kellermann e9c8621632 ext/opcache/zend_shared_alloc: use memfd for locking if available
A memfd is a virtual file that has no reachable path, therefore does
not clobber any filesystem.  It is deleted automatically as soon as
the last handle gets closed.  The feature is available since Linux
kernel 3.17.

Closes GH-10589.
2023-02-23 22:34:35 +00:00
Max Kellermann d5c649b36b 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.
2023-02-23 14:56:54 +00:00
Niels Dossche 821fc55a68 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.
2023-02-22 11:47:32 +01:00
Max Kellermann 263b22f374 Make lots of string pointers const (#10646)
This allows using string literals without implicitly casting away the
`const`.
2023-02-21 14:01:37 +00:00
Dmitry Stogov 2f65da0080 Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix GH-10635: ARM64 function JIT causes impossible assertion (#10638)
2023-02-21 09:26:19 +03:00
Dmitry Stogov 240c120cbc Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-10635: ARM64 function JIT causes impossible assertion (#10638)
2023-02-21 09:26:10 +03:00
Dmitry Stogov 70ff10af72 Fix GH-10635: ARM64 function JIT causes impossible assertion (#10638) 2023-02-21 09:25:51 +03:00
Niels Dossche 2e78c080c6 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.
2023-02-21 00:34:47 +03:00
Dmitry Stogov b578f69c89 Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix (at lease part of the) #GH-10635: ARM64 function JIT causes impossible assertion
2023-02-20 19:44:31 +03:00
Dmitry Stogov 388d784154 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix (at lease part of the) #GH-10635: ARM64 function JIT causes impossible assertion
2023-02-20 19:44:22 +03:00
Dmitry Stogov 08e7591206 Fix (at lease part of the) #GH-10635: ARM64 function JIT causes impossible assertion 2023-02-20 19:42:35 +03:00
Max Kellermann 04c85a3371 ext/opcache/ZendAccelerator: fix functions to return zend_result
If a function returns SUCCESS or FAILURE, it should be declared to
return the enum that defines those values.
2023-02-18 19:35:58 +00:00
Max Kellermann a50de37013 ext/opcache/ZendAccelerator: accel_is_inactive() returns bool
It was declared to be `int`, but actually returned `zend_result` enum
values.  However the name of the function suggests it should be
`bool`, so returning something else is error prone.  The function
definition is difficult enough already because the name is negated...
2023-02-18 19:35:58 +00:00
Max Kellermann 3dcd47243c ext/opcache/zend_shared_alloc: convert more int to bool 2023-02-18 19:35:58 +00:00
Max Kellermann 3b9812f8be ext/opcache/zend_shared_alloc: bool fixups 2023-02-18 19:35:58 +00:00
Max Kellermann 413844d626 Zend/zend_types.h: deprecate zend_bool, zend_intptr_t, zend_uintptr_t (#10597)
These types are standard C99.

For compatibility with out-of-tree extensions, keep the typedefs
in main/php.h.
2023-02-18 19:31:28 +00:00
David Carlier 8a267b06ca Merge branch 'PHP-8.2' 2023-02-09 19:58:00 +00:00
David Carlier 81aedad452 opcache/pcntl/cli: Fixes few functions signatures. 2023-02-09 19:57:48 +00:00
Marcos Marcolin 641fe23e3a Improve illegal offset error messages (#10504)
Co-authored-by: Marcos Marcolin <marcos@ixcsoft.com.br>
2023-02-08 12:11:41 +00:00
Dmitry Stogov 1521cafee2 Merge branch 'PHP-8.2'
* PHP-8.2:
  ext/opcache/zend_jit: call TSRM dtor before unloading opcache.so (#10533)
2023-02-07 16:09:58 +03:00
Dmitry Stogov d948b858de Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  ext/opcache/zend_jit: call TSRM dtor before unloading opcache.so (#10533)
2023-02-07 16:09:46 +03:00
Max Kellermann 131b862ac0 ext/opcache/zend_jit: call TSRM dtor before unloading opcache.so (#10533)
Commit a21195650e added a TSRM destructor, but that destructor
will get called by tsrm_shutdown(), which is after opcache.so has
already been unloaded, resulting in a shutdown crash, e.g.:

  #0  0x00007fad01737500 in ?? ()
  #1  0x000055ac54e723c4 in tsrm_shutdown () at TSRM/TSRM.c:194
  #2  0x000055ac54c42180 in main (argc=80, argv=0x55ac57bc14d0) at sapi/cli/php_cli.c:1388

By calling ts_free_id() before opcache.so gets unloaded, we can easily
fix this crash bug.
2023-02-07 16:09:17 +03:00
Dmitry Stogov bf809a918e Merge branch 'PHP-8.2'
* PHP-8.2:
  ext/opcache/zend_jit: cast function to fix -Wincompatible-pointer-types (#10527)
2023-02-07 13:38:52 +03:00
Dmitry Stogov 8ad81c0e8c Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  ext/opcache/zend_jit: cast function to fix -Wincompatible-pointer-types (#10527)
2023-02-07 13:38:39 +03:00
Max Kellermann afbb28dfb7 ext/opcache/zend_jit: cast function to fix -Wincompatible-pointer-types (#10527)
* ext/opcache/zend_jit: cast function to fix -Wincompatible-pointer-types

Regression by commit a21195650e

* TSRM/win32: fix ts_allocate_dtor cast

The dtor was casted to ts_allocate_ctor; luckily, ts_allocate_dtor and
ts_allocate_ctor just happen to be the same type.
2023-02-07 13:38:17 +03:00
Dmitry Stogov b33d472431 Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix possible exit_counters memory leak in ZTS build
2023-02-06 18:37:37 +03:00
Dmitry Stogov 29efbe593d Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix possible exit_counters memory leak in ZTS build
2023-02-06 18:37:24 +03:00
Dmitry Stogov a21195650e Fix possible exit_counters memory leak in ZTS build 2023-02-06 18:35:06 +03:00
Niels Dossche 722fbd01a3 Implement an SSE2 accelerated version of zend_adler32 (#10507)
When benchmarking the file cache of opcache on index.php from a dummy
WordPress install, I noticed that 36.42% of the time was spent in
zend_adler32 to verify the checksums of the files. Callgrind reported
that 332,731,216 instructions were executed during that run and average
time to execute the index file was around 91ms.

This patch implements an SSE2 accelerated version of zend_adler32, which
reduces the number of instructions executed on that bench to
248,600,983, which is a reduction of ~25%. There is also a decrease in
wallclock time measurable: around 10ms. Now only 16.05% of the time is
spent computing checksums.

The benchmark tests were performed using Callgrind, and time for the
wallclock time. These tests were executed multiple times and their
results were averaged. The WordPress install only contains two
almost-blank posts.
2023-02-05 15:58:39 +00:00
Niels Dossche 99b86141ae Introduce convenience macros for copying flags that hold when concatenating two strings
This abstracts away, and cleans up, the flag handling for properties of
strings that hold when concatenating two strings if they both hold that
property. (These macros also work with simply copies of strings because
a copy of a string can be considered a concatenation with the empty
string.) This gets rid of some branches and some repetitive code, and
leaves room for adding more flags like these in the future.
2023-02-05 14:32:50 +00:00
George Peter Banyard 64127b66c6 Concatenating two valid UTF-8 strings produces a valid UTF-8 string
The UTF-8 valid flag needs to be copied upon interning,
otherwise strings that are concatenated at compile time lose this information.

However, if previously this string was interned without the flag it is not added
E.g. in the case the string is an existing class name.

Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
2023-02-02 12:02:36 +00:00
Dmitry Stogov ea37abd412 Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix type inference
2023-01-30 13:16:17 +03:00