Commit graph

93 commits

Author SHA1 Message Date
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
Dmitry Stogov
d57cd36e47 Immutable clases and op_arrays.
Squashed commit of the following:

commit cd0c36c3f9
Merge: 4740dabb84 ad6738e886
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Oct 17 14:43:38 2018 +0300

    Merge branch 'master' into immutable

    * master:
      Remove the "auto" encoding
      Fixed bug #77025
      Add vtbls for EUC-TW encoding

commit 4740dabb84
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Oct 17 14:12:28 2018 +0300

    Reverted back ce->iterator_funcs_ptr. Initialize ce->iterator_funcs_ptr fields in immutable classes.

commit ad7a78b253
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Oct 17 11:46:30 2018 +0300

    Added comment

commit 0276ea5187
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Oct 17 11:42:43 2018 +0300

    Added type cast

commit c63fc5d5f1
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Oct 17 11:36:51 2018 +0300

    Moved static class members initialization into the proper place.

commit b945548e93
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Oct 17 11:21:03 2018 +0300

    Removed redundand assertion

commit d5a4108840
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Oct 17 11:19:13 2018 +0300

    Removed duplicate code

commit 8dadca8864
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Oct 17 11:05:43 2018 +0300

    Hide offset encoding magic in ZEND_MAP_PTR_IS_OFFSET(), ZEND_MAP_PTR_OFFSET2PTR() and ZEND_MAP_PTR_PTR2OFFSET() macros.

commit 9ef07c88bd
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Oct 17 10:48:29 2018 +0300

    typo

commit a06f0f3d3a
Merge: 94099586ec 3412345ffe
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Oct 17 10:47:07 2018 +0300

    Merge branch 'master' into immutable

    * master:
      Remove unused variable makefile_am_files
      Classify object handlers are required/optional
      Add support for getting SKIP_TAGSTART and SKIP_WHITE options
      Remove some obsolete config_vars.mk occurrences
      Remove bsd_converted from .gitignore
      Remove configuration parser and scanners ignores
      Remove obsolete buildconf.stamp from .gitignore
      [ci skip] Add magicdata.patch exception to .gitignore
      Remove outdated ext/spl/examples items from .gitignore
      Remove unused test.inc in ext/iconv/tests

commit 94099586ec
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Mon Oct 15 23:34:01 2018 +0300

    Immutable clases and op_arrays
2018-10-17 15:52:50 +03:00
Dmitry Stogov
3a3840a847 Avoid useless store and checks in xlat_table. 2018-09-26 17:05:49 +03:00
Peter Kokot
eff22dc511
Remove AC_HEADER_DIRENT
Autoconf 2.59d (released in 2006) [1] started promoting several macros
as not relevant for newer systems anymore, including the `AC_HEADER_DIRENT`.

This macro checks which header defines the `DIR` type. If `<dirent.h>`
is available it defines the `HAVE_DIRENT_H` symbol. Since the `<dirent.h>`
header is already checked in the `configure.ac`, this check is not needed
anymore. This macro also additionally checks for SCO Xenix (discontinued,
latest release 1989) dir and x libraries. [2]

Commit 6ed790685f introduced also
`<sys/dir.h>`. This header exists from times of UNIX System V and
provided definition of DIR type on these systems such as 4.3BSD.
Today `<sys/dir.h>` is kept for backwards compatibility and includes
the `<dirent.h>` on current systems. With `dirent.h>` present this
include is no longer required.

Refs:
[1] http://git.savannah.gnu.org/cgit/autoconf.git/tree/NEWS
[2] https://www.gnu.org/software/autoconf/manual/autoconf-2.69/autoconf.html

Remove unused dirent.h includes
2018-09-04 12:01:24 +02:00
Xinchen Hui
a6519d0514 year++ 2018-01-02 12:57:58 +08:00
Xinchen Hui
7a7ec01a49 year++ 2018-01-02 12:55:14 +08:00
Dmitry Stogov
9f1e970058 Reduce number of hash collisions during dulicate address detection. 2017-12-11 18:16:54 +03:00