Commit Graph

99 Commits

Author SHA1 Message Date
Dmitry Stogov
80efb3aba4
Merge branch 'PHP-8.3'
* PHP-8.3:
  Prevent possible incorrect optimization caused by ZEND_ASSUME()
2024-08-29 23:12:56 +03:00
Dmitry Stogov
bf98023f1a
Prevent possible incorrect optimization caused by ZEND_ASSUME() 2024-08-29 23:10:34 +03:00
Dmitry Stogov
0268cb0343
Merge branch 'PHP-8.3'
* PHP-8.3:
  Restore error message incorrectly removed by commit 10d43c4 (related to GH-15497)
2024-08-29 17:00:43 +03:00
Dmitry Stogov
c15bb9afe2
Restore error message incorrectly removed by commit 10d43c4 (related to GH-15497) 2024-08-29 16:59:14 +03:00
Florian Engelhardt
b9b317afd4
Export opcache shared globals (#15543) 2024-08-26 14:54:36 +02:00
Arnaud Le Blanc
1bae61a4d2
Compress interned string table offsets and increase maximum supported buffer size (#13676)
Compress interned string table offsets and increase maximum supported buffer size

The interned string buffer is organized as a header + a hash table + a
zend_string arena. Hash slots point to the arena, but are represented as 32bit
offsets from the buffer, which limits the maximum buffer size to about 4GiB.
However zend_strings are 8-byte aligned in the buffer, so we can compress the
3 lower bits. This allows to increase the maximum supported interned string
buffer size from 4095 MiB to 32767 MiB.
2024-03-19 13:01:30 +01:00
Dmitry Stogov
3d832fcc76 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fixed GH-12494: Zend/tests/arginfo_zpp_mismatch.phpt causes a segfault withJIT + --repeat 2
2023-10-23 10:52:09 +03:00
Dmitry Stogov
a1818dd00c Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fixed GH-12494: Zend/tests/arginfo_zpp_mismatch.phpt causes a segfault withJIT + --repeat 2
2023-10-23 10:51:59 +03:00
Dmitry Stogov
6be3c18d38 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fixed GH-12494: Zend/tests/arginfo_zpp_mismatch.phpt causes a segfault withJIT + --repeat 2
2023-10-23 10:51:48 +03:00
Dmitry Stogov
e0ca4dca5b Fixed GH-12494: Zend/tests/arginfo_zpp_mismatch.phpt causes a segfault withJIT + --repeat 2 2023-10-23 10:50:55 +03:00
Cristian Rodríguez
9ff6220e06
opcache: Use O_TMPFILE file lock if available (#8634)
Use O_TMPFILE if the kernel supports it to create the lock fd, this
has multiple advantages including not having to worry about naming,
permissions and the assurance that it will always go away cleanly
even on abnormal termination.

Co-authored-by: Dmitry Stogov <dmitry@zend.com>
2023-10-09 16:08:55 +03:00
Julien Francoz
36b194ba29
add file path in opcache lock file error (#10331)
Co-authored-by: Julien Francoz <julien@francoz.net>
2023-10-09 14:12:40 +03:00
nielsdos
1ed68686de Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix DOMElement::append() and DOMElement::prepend() hierarchy checks
  Fix spec compliance error for DOMDocument::getElementsByTagNameNS
  Fix GH-11336: php still tries to unlock the shared memory ZendSem with opcache.file_cache_only=1 but it was never locked
  Fix GH-11338: SplFileInfo empty getBasename with more than one slash
2023-05-30 17:41:54 +02:00
nielsdos
0e7ad40900 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix DOMElement::append() and DOMElement::prepend() hierarchy checks
  Fix spec compliance error for DOMDocument::getElementsByTagNameNS
  Fix GH-11336: php still tries to unlock the shared memory ZendSem with opcache.file_cache_only=1 but it was never locked
  Fix GH-11338: SplFileInfo empty getBasename with more than one slash
2023-05-30 17:38:18 +02:00
Niels Dossche
9c59d22a7b Fix GH-11336: php still tries to unlock the shared memory ZendSem with opcache.file_cache_only=1 but it was never locked
I chose to check for the value of lock_file instead of checking the
file_cache_only, because it is probably a little bit faster and we're
going to access the lock_file variable anyway. It's also more generic.

Closes GH-11341.
2023-05-30 17:32:02 +02:00
Ilija Tovilo
adb3d5240b
Merge branch 'PHP-8.2'
* PHP-8.2:
  Access violation when ALLOC_FALLBACK fixed
2023-05-25 11:02:09 +02:00
Ilija Tovilo
5b8e941095
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Access violation when ALLOC_FALLBACK fixed
2023-05-25 11:01:58 +02:00
KoudelkaB
8946b7b141
Access violation when ALLOC_FALLBACK fixed
Close GH-11312
2023-05-25 11:01:17 +02:00
nielsdos
3189a9f94a Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix allocation loop in zend_shared_alloc_startup()
2023-05-24 20:11:48 +02:00
nielsdos
bbcf9e7107 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix allocation loop in zend_shared_alloc_startup()
2023-05-24 20:09:56 +02:00
nielsdos
6267601f84 Fix allocation loop in zend_shared_alloc_startup()
The break is outside the if, so if it succeeds or not this will always
stop after the first loop iteration instead of trying more allocators if
the first one fails.

Closes GH-11306.
2023-05-24 20:09:14 +02: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
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
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
Max Kellermann
24b311bdd7 ext/opcache/zend_shared_alloc: rename _register_xlat_entry() params
The name "new" happens to be a C++ keyword, which was the my reason to
rethink those names.

The "xlat_table" is not only used to translate pointers for persisting
scripts to shared memory, but is also used to annoate pointers
(e.g. by the JIT to associate an op_array with its jit_extension).

The names "old" and "new" aren't good for that; often, there's nothing
"old" or "new" about them.  It's actually a generic lookup table, and
"old" shall be named "key" (which it is called internally already),
and "new" is renamed to simply "value".
2023-01-12 15:14:05 +00:00
Max Kellermann
10d43c40dd ext/opcache/zend_shared_alloc: change "locked" check to assertion
Calling zend_shared_alloc() without holding the lock is always a bug,
not a fatal runtime error.
2023-01-02 15:49:04 +00:00
Max Kellermann
e1a25ff2ed ext/opcache/zend_shared_alloc: add assertions on "locked" flag
Let the PHP process crash if a bug causes incorrect locking calls.
2023-01-02 15:49:04 +00:00
Arnaud Le Blanc
fb242f41ba
Fix high opcache.interned_strings_buffer causing shm corruption (#9260) 2022-09-03 11:23:10 +02:00
Ilija Tovilo
50a3cb7cea
Get rid of duplicated rotr3 implementation (#8853) 2022-06-23 19:09:48 +02:00
Max Kellermann
0199b22258
ext/opcache: check mkstemp() return value right after the call (#8031)
Don't call fchmod(-1), which is not only wrong, but also clobbers
errno and sets it to EBADF, breaking the following errno access for
the log message.
2022-02-05 19:13:32 +00:00
Patrick Allaert
aff365871a Fixed some spaces used instead of tabs 2021-06-29 11:30:26 +02:00
KsaR
01b3fc03c3
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 |
2021-05-06 12:16:35 +02:00
Dmitry Stogov
4b79dba932 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.
2021-02-09 22:53:57 +03:00
Nikita Popov
3e01f5afb1 Replace zend_bool uses with bool
We're starting to see a mix between uses of zend_bool and bool.
Replace all usages with the standard bool type everywhere.

Of course, zend_bool is retained as an alias.
2021-01-15 12:33:06 +01:00
Nikita Popov
2dc228040a Use zend_accel_error_noreturn in more places
Missed the place in accelerator_blacklist that was the actual
motivation here...
2020-10-19 16:59:00 +02:00
Nikita Popov
aa8d70f309 Merge branch 'PHP-7.4' 2019-06-28 09:19:49 +02:00
Nikita Popov
a78adce5cb Free ZTS lock in opcache
For some reason this only shows up as a leak when using phpdbg.
2019-06-28 09:18:14 +02:00
Anatol Belski
f4628436df Fix VirtualProtect memory size
As otherwise it would remove executable flag from JIT memory

Thanks Dmitry for the hint :)
2019-04-11 15:46:46 +02:00
Nikita Popov
9db2efe283 Merge branch 'PHP-7.4' 2019-04-10 15:31:24 +02:00
Nikita Popov
eb8c07fe2f Support VirtualProtect for opcache.protect_memory
Don't enable this on AppVeyor yet, as there is still an open
issue in phar.
2019-04-10 15:31:18 +02:00
Dmitry Stogov
9a06876072 Added JIT compiler for x86 and x86_64 2019-04-01 10:27:11 +03:00
Dmitry Stogov
26e26969c1 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Avoid dependency on "struct flock" fields order.
2019-02-12 10:22:13 +03:00
Dmitry Stogov
470f5891d4 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Avoid dependency on "struct flock" fields order.
2019-02-12 10:21:59 +03:00
Dmitry Stogov
9222702633 Avoid dependency on "struct flock" fields order. 2019-02-12 10:15:16 +03:00
Dmitry Stogov
da919a8b65 Remove copyright years. 2019-02-05 10:33:28 +03:00
Zeev Suraski
9afce019e0 Future-proof email addresses 2018-11-01 18:35:32 +02:00
Zeev Suraski
67e0138c0d Future-proof email addresses... 2018-11-01 18:30:28 +02:00
Dmitry Stogov
f33da6f338 Don't use request heap at shutdown 2018-10-25 19:24:39 +03:00