Commit Graph

76 Commits

Author SHA1 Message Date
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
Dmitry Stogov
c23ffaa211 We don't have to use "persistent" heap with PHP-7 HashTable(s). 2017-06-29 09:24:07 +03:00
Tom Van Looy
04fb3f28ff Remove superfluous semicolons 2017-06-26 00:23:25 +02:00
Dmitry Stogov
c16f954ff1 Clear alocated memory blocks, only if this is really necessary. 2017-06-21 10:37:54 +03:00
Sammy Kaye Powers
9e29f841ce Update copyright headers to 2017 2017-01-02 09:30:12 -06:00
Xinchen Hui
3440054ca8 Merge branch 'PHP-7.0'
* PHP-7.0:
  Fixed format

Conflicts:
	ext/opcache/zend_shared_alloc.c
2016-06-24 21:14:02 +08:00
Xinchen Hui
53de1c2830 Fixed format 2016-06-24 21:13:04 +08:00
Dmitry Stogov
1616038698 Added ZEND_ATTRIBUTE_FORMAT to some middind functions.
"%p" replaced by ZEND_LONG_FMT to avoid compilation warnings.
Fixed most incorrect use cases of format specifiers.
2016-06-21 16:00:37 +03:00
Fatih ACAR
d54eafb349 make opcache lockfile path configurable
Signed-off-by: William Dauchy <william@gandi.net>
Signed-off-by: Baptiste Daroussin <baptiste.daroussin@gandi.net>
Signed-off-by: Fatih Acar <fatih.acar@gandi.net>
2016-04-06 13:29:52 +02:00
Xinchen Hui
9fc0517328 Fixed another segfault with file_cache_only now 2016-03-01 10:50:56 +08:00
Xinchen Hui
8c053d44e4 Fixed segfault with file_cache_only 2016-02-28 11:50:06 +08:00
Dmitry Stogov
6842a3674d Fixed possible crash at PCRE on MSHUTDOWN 2016-02-24 23:46:11 +03:00
Lior Kaplan
ed35de784f Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  Happy new year (Update copyright to 2016)
2016-01-01 19:48:25 +02:00
Lior Kaplan
49493a2dcf Happy new year (Update copyright to 2016) 2016-01-01 19:21:47 +02:00
Anatol Belski
ffb5d0aca3 Implemented file_cache_fallback mechanism
which is essential as an attempt to fix the "failed to reattach"
error on Windows. If file_cache is enabled, Opcache will
automaticaly switch to file_cache_only mode in the case a process
failed to map the shared segment at the required address. The
important small part of the SHM will still be mapped, which
allows information exchange between normal processes using SHM
and those using the fallback mechanism.

This is based on Dmitry's, Matt's and mine ideas. So many thanks for
support!
2015-10-09 23:47:59 +02:00
Dmitry Stogov
89aa1b7392 Ensure proper data alignment 2015-08-31 13:56:42 +03:00
Dmitry Stogov
869f662cdd Use better zend_hash_* functions 2015-06-05 13:54:57 +03:00
Dmitry Stogov
3abde43231 Added experimental (disabled by default) file based opcode cache. 2015-05-06 23:46:49 +03:00