mirror of
https://github.com/php/php-src.git
synced 2026-04-12 18:43:37 +02:00
Squashed commit of the following: commit 106c815fffb8eb3efe00a27a5229cb1f8ffc9736 Author: Dmitry Stogov <dmitry@zend.com> Date: Wed Nov 14 16:36:44 2018 +0300 Added NEWS entry commit 1dacd5e20b7043368ef9e80db296d1781134b6fd Merge: d516139abfba99aa133cAuthor: Dmitry Stogov <dmitry@zend.com> Date: Wed Nov 14 16:33:37 2018 +0300 Merge branch 'master' into preload * master: Fixed issues related to optimization and persitence of classes linked with interfaces, traits or internal classes. Added possiblity to avoid signal handlers reinitialization on each request. commit d516139abf5ffbd495ee6037f1dc04a1cfe588a7 Author: Dmitry Stogov <dmitry@zend.com> Date: Wed Nov 14 16:13:15 2018 +0300 Override opcache.preload for testing commit 162b154d0bbfbaf8ef93975f7e56a1353236903d Merge:45fdd034ce8bda22592eAuthor: Dmitry Stogov <dmitry@zend.com> Date: Wed Nov 14 15:38:09 2018 +0300 Merge branch 'master' into preload * master: (34 commits) Eliminate useless $this related check Eliminate useless $this related checks Replace zend_parse_method_parameters() by zend_parse_parameters() and avoid useless checks. Replace getThis() by EX(This), when additional check is not necessary. Fixed tests Validate length on socket_write Fix compilation on x32 Fix #77141: Signedness issue in SOAP when precision=-1 Support SQLite3 @name notation Remove lexer files generated by RE2C Update libmagic.patch [ci skip] Update libmagic.patch [ci skip] Fork test with pcre.jit=0 Rework magic data Fix regex Fix regex Rework magic data Sync one more upstream libmagic piece Suppress already used warning Ignore getaddrinfo failed message ... commit45fdd034ceAuthor: Dmitry Stogov <dmitry@zend.com> Date: Fri Nov 9 13:07:03 2018 +0300 Properly resolve magic method of preloaded classes inherited from internal ones. commit34645aeb42Author: Dmitry Stogov <dmitry@zend.com> Date: Thu Nov 8 15:29:17 2018 +0300 Don't preload constants defined during preload script excution. commitcef0d67c3eAuthor: Dmitry Stogov <dmitry@zend.com> Date: Wed Nov 7 15:56:54 2018 +0300 Support for class aliasses commit08ffc9a552Author: Dmitry Stogov <dmitry@zend.com> Date: Wed Nov 7 15:34:39 2018 +0300 Resolve constants only in linked classes commit8d3429cda8Author: Dmitry Stogov <dmitry@zend.com> Date: Tue Nov 6 11:56:39 2018 +0300 Fixed preloading of references to internal classes. commit7ae3a47d20Merge:9b0a53ed1c049f239cfcAuthor: Dmitry Stogov <dmitry@zend.com> Date: Tue Nov 6 11:37:15 2018 +0300 Merge branch 'master' into preload * master: Update NEWS [ci skip] Update NEWS [ci skip] Update libmagic.patch [ci skip] Update libmagic.patch [ci skip] Declare function proto in header Declare function proto in header Fix #76825: Undefined symbols ___cpuid_count NEWS Fix: #77110 undefined symbol zend_string_equal_val in C++ build Fix #77105: Use position:sticky for <th> in `phpinfo()` Implement handling for JIT recognition when cross compiling Backport7f5f4601for 7.2 Fix #76348: WSDL_CACHE_MEMORY causes Segmentation fault Rework places in libmagic regarding previous CVE-2014-3538 fixes Change the way JIT availability is checked Fix a test for ldap extension Fixed bug #77092 Future-proof email addresses commit9b0a53ed1cAuthor: Dmitry Stogov <dmitry@zend.com> Date: Fri Nov 2 14:54:44 2018 +0300 We don't need preload_restart() here commit0bd17bd438Author: Dmitry Stogov <dmitry@zend.com> Date: Fri Nov 2 14:44:30 2018 +0300 EG(*) may be not initializd at this point - use CG(*). commitb610467051Merge:3a9d90f74a67e0138c0dAuthor: Dmitry Stogov <dmitry@zend.com> Date: Fri Nov 2 11:33:37 2018 +0300 Merge branch 'master' into preload * master: Future-proof email addresses... Update email addresses. We're still @Zend, but future proofing it... commit3a9d90f74aAuthor: Dmitry Stogov <dmitry@zend.com> Date: Thu Nov 1 15:19:48 2018 +0300 Fexed resolution of method clones commitaea85c65bdAuthor: Dmitry Stogov <dmitry@zend.com> Date: Thu Nov 1 11:45:50 2018 +0300 Prevent inlining of method copied from trait commit36b644fbb7Merge:7a20781d2eb91690c892Author: Dmitry Stogov <dmitry@zend.com> Date: Thu Nov 1 10:56:02 2018 +0300 Merge branch 'master' into preload * master: Fix stray newline that caused this test to fail Fix session tests that fail if error_log is set This test needs to log to stdout Fix error condition Fixed bug #77081 ftruncate() changes seek pointer in c mode Fix and improve test case commit7a20781d2eAuthor: Dmitry Stogov <dmitry@zend.com> Date: Wed Oct 31 00:52:46 2018 +0300 Added test commit4a57b5d563Author: Dmitry Stogov <dmitry@zend.com> Date: Wed Oct 31 00:50:21 2018 +0300 Fixed preloading of classes linked with traits commit68c4f99e23Author: Dmitry Stogov <dmitry@zend.com> Date: Tue Oct 30 16:25:14 2018 +0300 Added test commit38ab7ef4cfMerge:eb6e2c529fbf38e6c10aAuthor: Dmitry Stogov <dmitry@zend.com> Date: Tue Oct 30 16:14:39 2018 +0300 Merge branch 'master' into preload * master: Keep original value of "prototype" commiteb6e2c529fMerge:562049510f2fefa8c61eAuthor: Dmitry Stogov <dmitry@zend.com> Date: Tue Oct 30 15:35:39 2018 +0300 Merge branch 'master' into preload * master: Call function_add_ref() in proper place Updated to version 2018.7 (2018g) Updated to version 2018.7 (2018g) Updated to version 2018.7 (2018g) Reslove inherited op_array references once afrer all optimizations. commit562049510fMerge:e806cb732a4828fb7b6bAuthor: Dmitry Stogov <dmitry@zend.com> Date: Tue Oct 30 10:29:49 2018 +0300 Merge branch 'master' into preload * master: [ci skip] Update NEWS [ci skip] Update NEWS [ci skip] Update NEWS fix bug #77079 Add missing null initialization Remove redundant mbfl_string_init calls Use zend_string for mbstring last encoding cache commite806cb732aAuthor: Dmitry Stogov <dmitry@zend.com> Date: Mon Oct 29 22:32:15 2018 +0300 Fixed double-free commit2f697ef8afAuthor: Dmitry Stogov <dmitry@zend.com> Date: Mon Oct 29 22:07:32 2018 +0300 typo commitc559f22b3eMerge:310631cc05ea2e67876aAuthor: Dmitry Stogov <dmitry@zend.com> Date: Mon Oct 29 21:59:27 2018 +0300 Merge branch 'master' into preload * master: Stop Apache if PHP wasn't started successful. Execute zend_post_startup() with module_initialized flag set. Removed dead code Fix mb_strrpos() with encoding passed as 3rd param commit310631cc05Author: Dmitry Stogov <dmitry@zend.com> Date: Mon Oct 29 16:48:42 2018 +0300 Stop Apache if PHP wasn't started successful. commit0a24d7ba8fAuthor: Dmitry Stogov <dmitry@zend.com> Date: Mon Oct 29 16:25:49 2018 +0300 Avoid use-after-free in main thread commit17a3cb4a2aAuthor: Dmitry Stogov <dmitry@zend.com> Date: Mon Oct 29 15:25:17 2018 +0300 Execute zend_post_startup() with module_initialized flag set. commit6d4b22c518Author: Dmitry Stogov <dmitry@zend.com> Date: Mon Oct 29 14:12:20 2018 +0300 Override SAPI.ub_write and SAPI.flush for preloading commit386c9d3470Merge:d7fbb4d402359f19edc9Author: Dmitry Stogov <dmitry@zend.com> Date: Mon Oct 29 13:49:24 2018 +0300 Merge branch 'master' into preload * master: Optimize substr() edge-case conditions [ci skip] Update UPGRADING Fix #71592: External entity processing never fails Add TIDY_TAG_* constants supported by libtidy 5 Add is_iterable to opcache Optimizer commitd7fbb4d402Author: Dmitry Stogov <dmitry@zend.com> Date: Fri Oct 26 13:11:54 2018 +0300 Restore preload state if it was already loaded in another process. commit0fe9ea1c07Author: Dmitry Stogov <dmitry@zend.com> Date: Fri Oct 26 12:29:06 2018 +0300 Removed dead code commit3a2d1bcc1fAuthor: Dmitry Stogov <dmitry@zend.com> Date: Fri Oct 26 00:19:40 2018 +0300 Support for builds without ZEND_SIGNALS commite6b76ecb4bMerge:4531fbf93168694c9997Author: Dmitry Stogov <dmitry@zend.com> Date: Thu Oct 25 23:43:25 2018 +0300 Merge branch 'master' into preload * master: Don't wrap php_module_shutdown() with zend_try. executor_globals are released in ZTS build, and this leads to crash. [ci skip] Fix indentation in UPGRADING. commit4531fbf931Author: Dmitry Stogov <dmitry@zend.com> Date: Thu Oct 25 22:44:49 2018 +0300 Disable linking and preloading of classes those parent or one of interface or trait is an internal class. commita594a618ceAuthor: Dmitry Stogov <dmitry@zend.com> Date: Thu Oct 25 22:30:51 2018 +0300 Cleanup - remove useless ZCSG(saved_map_ptr_last) - move preloaded classes/functions clean-up code back into better place commitab9a40f63cAuthor: Dmitry Stogov <dmitry@zend.com> Date: Thu Oct 25 20:52:51 2018 +0300 Added support for preloaded classes/functions in ZTS build commite3c65db099Merge:4f57c1e02933e777acbfAuthor: Dmitry Stogov <dmitry@zend.com> Date: Thu Oct 25 20:52:26 2018 +0300 Merge branch 'master' into preload * master: Improved shared interned strings handling. The previous implementation worked incorrectly in ZTS build. It changed strings only in function/class tables of one thread. Now all threads gets the same shared interned strings. Also, on shutdown, we don't try to replace SHM interned strings back to process strings, but delay dettachment of SHM instead. Don't use request heap at shutdown Don't optimize function if inference failed Fixed bug #77058 Improve "narrowing" error message bump versions commit4f57c1e029Author: Dmitry Stogov <dmitry@zend.com> Date: Thu Oct 25 15:29:58 2018 +0300 Cleanup (move preload_shutdown() call to better place) commit26587a95c0Author: Dmitry Stogov <dmitry@zend.com> Date: Thu Oct 25 14:30:51 2018 +0300 eol commitd70cb10480Author: Dmitry Stogov <dmitry@zend.com> Date: Thu Oct 25 14:30:20 2018 +0300 cleanup commitaabe685dbbMerge:d9fc51bc3b40808ac41eAuthor: Dmitry Stogov <dmitry@zend.com> Date: Thu Oct 25 12:42:51 2018 +0300 Merge branch 'master' into preload * master: Remove unused var Remove ext/json parser files generated by bison Fix run-tests.php for running phpdbg and certain test sections Normalize .gitignore commitd9fc51bc3bMerge:b5ffba0fafb6ef8998d5Author: Dmitry Stogov <dmitry@zend.com> Date: Wed Oct 24 15:59:24 2018 +0300 Merge branch 'master' into preload * master: Fixed reseting of interned strings buffer. commitb5ffba0fafMerge:e4a7ef0c43a404383118Author: Dmitry Stogov <dmitry@zend.com> Date: Wed Oct 24 12:46:28 2018 +0300 Merge branch 'master' into preload * master: Fixed build in directory different from source commite4a7ef0c43Merge:811f20aaa5d1e14e2cc0Author: Dmitry Stogov <dmitry@zend.com> Date: Wed Oct 24 11:59:43 2018 +0300 Merge branch 'master' into preload * master: (29 commits) Make php_plain_files_wrapper to be writable (workaround for swoole) Remove phpdbg parser files generated by bison Fix conflicts in phpdbg parser Refetetch function name on exceptional path to allow better code on fast code path. fix typo in sysvsem.c Fixed bug #50675 bump to 7.2.13-dev [ci skip] Update NEWS wrt. php-7.3.0RC4 tagging Inlining in the most frequently used code paths Fixed test failurs introduced by9c144e0d82Use persistent strings only for persistent connections Fix accessibility checks for dynamic properties Updated to version 2018.6 (2018f) Updated to version 2018.6 (2018f) Updated to version 2018.6 (2018f) Fix arginfo and clean up fpm_get_status Defragment two Zend related Makefile fragments together [ci skip] Remove automake and aclocal in comments Fix #75282: xmlrpc_encode_request() crashes Fix tests for ICU 63.1 ... commit811f20aaa5Author: Dmitry Stogov <dmitry@zend.com> Date: Mon Oct 22 14:10:49 2018 +0300 Added information about preloading to opcache_get_status() commit093e8b1bbfAuthor: Dmitry Stogov <dmitry@zend.com> Date: Fri Oct 19 13:46:23 2018 +0300 Added warning message commita2ba970ce3Author: Dmitry Stogov <dmitry@zend.com> Date: Fri Oct 19 13:35:40 2018 +0300 Added test commitb67e28367cAuthor: Dmitry Stogov <dmitry@zend.com> Date: Fri Oct 19 13:33:12 2018 +0300 Don't preload functions declared at run-time. commitb0139dc228Merge:a609520adb3fe698b904Author: Dmitry Stogov <dmitry@zend.com> Date: Fri Oct 19 13:23:14 2018 +0300 Merge branch 'master' into preload * master: Mark "top-level" functions. Don't initialize static_member_tables during start-up, when inherit internal classes. [ci skip] Update NEWS [ci skip] Update NEWS [ci skip] Update NEWS Fix #77035: The phpize and ./configure create redundant .deps file Remove outdated PEAR artefacts Fix tests/output/bug74815.phpt generating errors.log Revert "Use C++ symbols, when C++11 or upper is compiled" Use C++ symbols, when C++11 or upper is compiled Added new line Remove stamp-h Move all testing docs to qa.php.net Fix a typo in UPGRADING.INTERNALS Fix test when it's run on another drive [ci skip] Update UPGRADING wrt. tidyp support Fixed incorrect reallocation Fix #77027: tidy::getOptDoc() not available on Windows Run CI tests under opcache.protect_memory=1 commita609520adbMerge:ac8f45f61bb6ac50f9e6Author: Dmitry Stogov <dmitry@zend.com> Date: Wed Oct 17 17:01:05 2018 +0300 Merge branch 'master' into preload * master: Fixed comment Micro optimizations Mark "top-level" classes commitac8f45f61bMerge:632b30b545d57cd36e47Author: Dmitry Stogov <dmitry@zend.com> Date: Wed Oct 17 15:53:41 2018 +0300 Merge branch 'master' into preload * master: Immutable clases and op_arrays. commit632b30b545Merge:d33908a99acd0c36c3f9Author: Dmitry Stogov <dmitry@zend.com> Date: Wed Oct 17 15:04:43 2018 +0300 Merge branch 'immutable' into preload * immutable: Remove the "auto" encoding Fixed bug #77025 Add vtbls for EUC-TW encoding commitcd0c36c3f9Merge:4740dabb84ad6738e886Author: 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 commitd33908a99aMerge:21e0bebca34740dabb84Author: Dmitry Stogov <dmitry@zend.com> Date: Wed Oct 17 14:14:23 2018 +0300 Merge branch 'immutable' into preload * immutable: Reverted back ce->iterator_funcs_ptr. Initialize ce->iterator_funcs_ptr fields in immutable classes. commit4740dabb84Author: 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. commit21e0bebca3Merge:c78277ae84ad7a78b253Author: Dmitry Stogov <dmitry@zend.com> Date: Wed Oct 17 12:29:59 2018 +0300 Merge branch 'immutable' into preload * immutable: Added comment Added type cast Moved static class members initialization into the proper place. Removed redundand assertion Removed duplicate code Hide offset encoding magic in ZEND_MAP_PTR_IS_OFFSET(), ZEND_MAP_PTR_OFFSET2PTR() and ZEND_MAP_PTR_PTR2OFFSET() macros. typo 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 commitad7a78b253Author: Dmitry Stogov <dmitry@zend.com> Date: Wed Oct 17 11:46:30 2018 +0300 Added comment commit0276ea5187Author: Dmitry Stogov <dmitry@zend.com> Date: Wed Oct 17 11:42:43 2018 +0300 Added type cast commitc63fc5d5f1Author: Dmitry Stogov <dmitry@zend.com> Date: Wed Oct 17 11:36:51 2018 +0300 Moved static class members initialization into the proper place. commitb945548e93Author: Dmitry Stogov <dmitry@zend.com> Date: Wed Oct 17 11:21:03 2018 +0300 Removed redundand assertion commitd5a4108840Author: Dmitry Stogov <dmitry@zend.com> Date: Wed Oct 17 11:19:13 2018 +0300 Removed duplicate code commit8dadca8864Author: 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. commit9ef07c88bdAuthor: Dmitry Stogov <dmitry@zend.com> Date: Wed Oct 17 10:48:29 2018 +0300 typo commita06f0f3d3aMerge:94099586ec3412345ffeAuthor: 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 commitc78277ae84Author: Dmitry Stogov <dmitry@zend.com> Date: Tue Oct 16 17:25:35 2018 +0300 Preloadsing support for opcache restart commitf76a955c02Author: Dmitry Stogov <dmitry@zend.com> Date: Tue Oct 16 13:52:36 2018 +0300 Fixed incorrect signal handlers overriding commit0810ce0d81Author: Dmitry Stogov <dmitry@zend.com> Date: Mon Oct 15 23:38:48 2018 +0300 An attempt to implemnt "preloading" ability. commit94099586ecAuthor: Dmitry Stogov <dmitry@zend.com> Date: Mon Oct 15 23:34:01 2018 +0300 Immutable clases and op_arrays
345 lines
12 KiB
C
345 lines
12 KiB
C
/*
|
|
+----------------------------------------------------------------------+
|
|
| Zend OPcache |
|
|
+----------------------------------------------------------------------+
|
|
| Copyright (c) 1998-2018 The PHP Group |
|
|
+----------------------------------------------------------------------+
|
|
| This source file is subject to version 3.01 of the PHP license, |
|
|
| that is bundled with this package in the file LICENSE, and is |
|
|
| available through the world-wide-web at the following url: |
|
|
| http://www.php.net/license/3_01.txt |
|
|
| If you did not receive a copy of the PHP license and are unable to |
|
|
| obtain it through the world-wide-web, please send a note to |
|
|
| license@php.net so we can mail you a copy immediately. |
|
|
+----------------------------------------------------------------------+
|
|
| Authors: Andi Gutmans <andi@php.net> |
|
|
| Zeev Suraski <zeev@php.net> |
|
|
| Stanislav Malyshev <stas@zend.com> |
|
|
| Dmitry Stogov <dmitry@php.net> |
|
|
+----------------------------------------------------------------------+
|
|
*/
|
|
|
|
#ifndef ZEND_ACCELERATOR_H
|
|
#define ZEND_ACCELERATOR_H
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
# include <config.h>
|
|
#endif
|
|
|
|
#define ACCELERATOR_PRODUCT_NAME "Zend OPcache"
|
|
/* 2 - added Profiler support, on 20010712 */
|
|
/* 3 - added support for Optimizer's encoded-only-files mode */
|
|
/* 4 - works with the new Optimizer, that supports the file format with licenses */
|
|
/* 5 - API 4 didn't really work with the license-enabled file format. v5 does. */
|
|
/* 6 - Monitor was removed from ZendPlatform.so, to a module of its own */
|
|
/* 7 - Optimizer was embedded into Accelerator */
|
|
/* 8 - Standalone Open Source Zend OPcache */
|
|
#define ACCELERATOR_API_NO 8
|
|
|
|
#if ZEND_WIN32
|
|
# include "zend_config.w32.h"
|
|
#else
|
|
#include "zend_config.h"
|
|
# include <sys/time.h>
|
|
# include <sys/resource.h>
|
|
#endif
|
|
|
|
#if HAVE_UNISTD_H
|
|
# include "unistd.h"
|
|
#endif
|
|
|
|
#include "zend_extensions.h"
|
|
#include "zend_compile.h"
|
|
|
|
#include "Optimizer/zend_optimizer.h"
|
|
#include "zend_accelerator_hash.h"
|
|
#include "zend_accelerator_debug.h"
|
|
|
|
#ifndef PHPAPI
|
|
# ifdef ZEND_WIN32
|
|
# define PHPAPI __declspec(dllimport)
|
|
# else
|
|
# define PHPAPI
|
|
# endif
|
|
#endif
|
|
|
|
#ifndef ZEND_EXT_API
|
|
# ifdef ZEND_WIN32
|
|
# define ZEND_EXT_API __declspec(dllexport)
|
|
# elif defined(__GNUC__) && __GNUC__ >= 4
|
|
# define ZEND_EXT_API __attribute__ ((visibility("default")))
|
|
# else
|
|
# define ZEND_EXT_API
|
|
# endif
|
|
#endif
|
|
|
|
#ifdef ZEND_WIN32
|
|
# ifndef MAXPATHLEN
|
|
# include "win32/ioutil.h"
|
|
# define MAXPATHLEN PHP_WIN32_IOUTIL_MAXPATHLEN
|
|
# endif
|
|
# include <direct.h>
|
|
#else
|
|
# ifndef MAXPATHLEN
|
|
# define MAXPATHLEN 4096
|
|
# endif
|
|
# include <sys/param.h>
|
|
#endif
|
|
|
|
/*** file locking ***/
|
|
#ifndef ZEND_WIN32
|
|
extern int lock_file;
|
|
|
|
# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || (defined(__APPLE__) && defined(__MACH__)/* Darwin */) || defined(__OpenBSD__) || defined(__NetBSD__)
|
|
# define FLOCK_STRUCTURE(name, type, whence, start, len) \
|
|
struct flock name = {start, len, -1, type, whence}
|
|
# elif defined(__svr4__)
|
|
# define FLOCK_STRUCTURE(name, type, whence, start, len) \
|
|
struct flock name = {type, whence, start, len}
|
|
# elif defined(__linux__) || defined(__hpux) || defined(__GNU__)
|
|
# define FLOCK_STRUCTURE(name, type, whence, start, len) \
|
|
struct flock name = {type, whence, start, len, 0}
|
|
# elif defined(_AIX)
|
|
# if defined(_LARGE_FILES) || defined(__64BIT__)
|
|
# define FLOCK_STRUCTURE(name, type, whence, start, len) \
|
|
struct flock name = {type, whence, 0, 0, 0, start, len }
|
|
# else
|
|
# define FLOCK_STRUCTURE(name, type, whence, start, len) \
|
|
struct flock name = {type, whence, start, len}
|
|
# endif
|
|
# elif defined(HAVE_FLOCK_BSD)
|
|
# define FLOCK_STRUCTURE(name, type, whence, start, len) \
|
|
struct flock name = {start, len, -1, type, whence}
|
|
# elif defined(HAVE_FLOCK_LINUX)
|
|
# define FLOCK_STRUCTURE(name, type, whence, start, len) \
|
|
struct flock name = {type, whence, start, len}
|
|
# else
|
|
# error "Don't know how to define struct flock"
|
|
# endif
|
|
#endif
|
|
|
|
#if defined(HAVE_OPCACHE_FILE_CACHE) && defined(ZEND_WIN32)
|
|
# define ENABLE_FILE_CACHE_FALLBACK 1
|
|
#else
|
|
# define ENABLE_FILE_CACHE_FALLBACK 0
|
|
#endif
|
|
|
|
#if ZEND_WIN32
|
|
typedef unsigned __int64 accel_time_t;
|
|
#else
|
|
typedef time_t accel_time_t;
|
|
#endif
|
|
|
|
typedef enum _zend_accel_restart_reason {
|
|
ACCEL_RESTART_OOM, /* restart because of out of memory */
|
|
ACCEL_RESTART_HASH, /* restart because of hash overflow */
|
|
ACCEL_RESTART_USER /* restart scheduled by opcache_reset() */
|
|
} zend_accel_restart_reason;
|
|
|
|
typedef struct _zend_persistent_script {
|
|
zend_script script;
|
|
zend_long compiler_halt_offset; /* position of __HALT_COMPILER or -1 */
|
|
int ping_auto_globals_mask; /* which autoglobals are used by the script */
|
|
accel_time_t timestamp; /* the script modification time */
|
|
zend_bool corrupted;
|
|
zend_bool is_phar;
|
|
zend_bool empty;
|
|
|
|
void *mem; /* shared memory area used by script structures */
|
|
size_t size; /* size of used shared memory */
|
|
void *arena_mem; /* part that should be copied into process */
|
|
size_t arena_size;
|
|
|
|
/* All entries that shouldn't be counted in the ADLER32
|
|
* checksum must be declared in this struct
|
|
*/
|
|
struct zend_persistent_script_dynamic_members {
|
|
time_t last_used;
|
|
#ifdef ZEND_WIN32
|
|
LONGLONG hits;
|
|
#else
|
|
zend_ulong hits;
|
|
#endif
|
|
unsigned int memory_consumption;
|
|
unsigned int checksum;
|
|
time_t revalidate;
|
|
} dynamic_members;
|
|
} zend_persistent_script;
|
|
|
|
typedef struct _zend_accel_directives {
|
|
zend_long memory_consumption;
|
|
zend_long max_accelerated_files;
|
|
double max_wasted_percentage;
|
|
char *user_blacklist_filename;
|
|
zend_long consistency_checks;
|
|
zend_long force_restart_timeout;
|
|
zend_bool use_cwd;
|
|
zend_bool ignore_dups;
|
|
zend_bool validate_timestamps;
|
|
zend_bool revalidate_path;
|
|
zend_bool save_comments;
|
|
zend_bool protect_memory;
|
|
zend_bool file_override_enabled;
|
|
zend_bool enable_cli;
|
|
zend_bool validate_permission;
|
|
#ifndef ZEND_WIN32
|
|
zend_bool validate_root;
|
|
#endif
|
|
zend_ulong revalidate_freq;
|
|
zend_ulong file_update_protection;
|
|
char *error_log;
|
|
#ifdef ZEND_WIN32
|
|
char *mmap_base;
|
|
#endif
|
|
char *memory_model;
|
|
zend_long log_verbosity_level;
|
|
|
|
zend_long optimization_level;
|
|
zend_long opt_debug_level;
|
|
zend_long max_file_size;
|
|
zend_long interned_strings_buffer;
|
|
char *restrict_api;
|
|
#ifndef ZEND_WIN32
|
|
char *lockfile_path;
|
|
#endif
|
|
#ifdef HAVE_OPCACHE_FILE_CACHE
|
|
char *file_cache;
|
|
zend_bool file_cache_only;
|
|
zend_bool file_cache_consistency_checks;
|
|
#endif
|
|
#if ENABLE_FILE_CACHE_FALLBACK
|
|
zend_bool file_cache_fallback;
|
|
#endif
|
|
#ifdef HAVE_HUGE_CODE_PAGES
|
|
zend_bool huge_code_pages;
|
|
#endif
|
|
char *preload;
|
|
} zend_accel_directives;
|
|
|
|
typedef struct _zend_accel_globals {
|
|
int counted; /* the process uses shared memory */
|
|
zend_bool enabled;
|
|
zend_bool locked; /* thread obtained exclusive lock */
|
|
HashTable bind_hash; /* prototype and zval lookup table */
|
|
zend_accel_directives accel_directives;
|
|
zend_string *cwd; /* current working directory or NULL */
|
|
zend_string *include_path; /* current value of "include_path" directive */
|
|
char include_path_key[32]; /* key of current "include_path" */
|
|
char cwd_key[32]; /* key of current working directory */
|
|
int include_path_key_len;
|
|
int include_path_check;
|
|
int cwd_key_len;
|
|
int cwd_check;
|
|
int auto_globals_mask;
|
|
time_t request_time;
|
|
time_t last_restart_time; /* used to synchronize SHM and in-process caches */
|
|
char system_id[32];
|
|
HashTable xlat_table;
|
|
#ifndef ZEND_WIN32
|
|
zend_ulong root_hash;
|
|
#endif
|
|
/* preallocated shared-memory block to save current script */
|
|
void *mem;
|
|
void *arena_mem;
|
|
zend_persistent_script *current_persistent_script;
|
|
zend_bool is_immutable_class;
|
|
/* cache to save hash lookup on the same INCLUDE opcode */
|
|
const zend_op *cache_opline;
|
|
zend_persistent_script *cache_persistent_script;
|
|
/* preallocated buffer for keys */
|
|
int key_len;
|
|
char key[MAXPATHLEN * 8];
|
|
} zend_accel_globals;
|
|
|
|
typedef struct _zend_string_table {
|
|
uint32_t nTableMask;
|
|
uint32_t nNumOfElements;
|
|
zend_string *start;
|
|
zend_string *top;
|
|
zend_string *end;
|
|
zend_string *saved_top;
|
|
} zend_string_table;
|
|
|
|
typedef struct _zend_accel_shared_globals {
|
|
/* Cache Data Structures */
|
|
zend_ulong hits;
|
|
zend_ulong misses;
|
|
zend_ulong blacklist_misses;
|
|
zend_ulong oom_restarts; /* number of restarts because of out of memory */
|
|
zend_ulong hash_restarts; /* number of restarts because of hash overflow */
|
|
zend_ulong manual_restarts; /* number of restarts scheduled by opcache_reset() */
|
|
zend_accel_hash hash; /* hash table for cached scripts */
|
|
|
|
size_t map_ptr_last;
|
|
|
|
/* Directives & Maintenance */
|
|
time_t start_time;
|
|
time_t last_restart_time;
|
|
time_t force_restart_time;
|
|
zend_bool accelerator_enabled;
|
|
zend_bool restart_pending;
|
|
zend_accel_restart_reason restart_reason;
|
|
zend_bool cache_status_before_restart;
|
|
#ifdef ZEND_WIN32
|
|
LONGLONG mem_usage;
|
|
LONGLONG restart_in;
|
|
#endif
|
|
zend_bool restart_in_progress;
|
|
|
|
/* Preloading */
|
|
zend_persistent_script *preload_script;
|
|
zend_persistent_script **saved_scripts;
|
|
|
|
/* uninitialized HashTable Support */
|
|
uint32_t uninitialized_bucket[-HT_MIN_MASK];
|
|
|
|
/* Interned Strings Support (must be the last element) */
|
|
zend_string_table interned_strings;
|
|
} zend_accel_shared_globals;
|
|
|
|
extern zend_bool accel_startup_ok;
|
|
#ifdef HAVE_OPCACHE_FILE_CACHE
|
|
extern zend_bool file_cache_only;
|
|
#endif
|
|
#if ENABLE_FILE_CACHE_FALLBACK
|
|
extern zend_bool fallback_process;
|
|
#endif
|
|
|
|
extern zend_accel_shared_globals *accel_shared_globals;
|
|
#define ZCSG(element) (accel_shared_globals->element)
|
|
|
|
#ifdef ZTS
|
|
# define ZCG(v) ZEND_TSRMG(accel_globals_id, zend_accel_globals *, v)
|
|
extern int accel_globals_id;
|
|
# ifdef COMPILE_DL_OPCACHE
|
|
ZEND_TSRMLS_CACHE_EXTERN()
|
|
# endif
|
|
#else
|
|
# define ZCG(v) (accel_globals.v)
|
|
extern zend_accel_globals accel_globals;
|
|
#endif
|
|
|
|
extern char *zps_api_failure_reason;
|
|
|
|
void accel_shutdown(void);
|
|
int accel_activate(INIT_FUNC_ARGS);
|
|
int accel_post_deactivate(void);
|
|
void zend_accel_schedule_restart(zend_accel_restart_reason reason);
|
|
void zend_accel_schedule_restart_if_necessary(zend_accel_restart_reason reason);
|
|
accel_time_t zend_get_file_handle_timestamp(zend_file_handle *file_handle, size_t *size);
|
|
int validate_timestamp_and_record(zend_persistent_script *persistent_script, zend_file_handle *file_handle);
|
|
int validate_timestamp_and_record_ex(zend_persistent_script *persistent_script, zend_file_handle *file_handle);
|
|
int zend_accel_invalidate(const char *filename, size_t filename_len, zend_bool force);
|
|
int accelerator_shm_read_lock(void);
|
|
void accelerator_shm_read_unlock(void);
|
|
|
|
char *accel_make_persistent_key(const char *path, size_t path_length, int *key_len);
|
|
zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type);
|
|
|
|
#define IS_ACCEL_INTERNED(str) \
|
|
((char*)(str) >= (char*)ZCSG(interned_strings).start && (char*)(str) < (char*)ZCSG(interned_strings).top)
|
|
|
|
zend_string* ZEND_FASTCALL accel_new_interned_string(zend_string *str);
|
|
|
|
#endif /* ZEND_ACCELERATOR_H */
|