mirror of
https://github.com/php/php-src.git
synced 2025-08-15 13:38:49 +02:00
Make OPcache non-optional
This removes the --enable-opcache/--disable-opcache configure switch. OPcache is now always builtin. The default value of opcache.enable and opcache.enable_cli is unchanged. RFC: https://wiki.php.net/rfc/make_opcache_required Closes GH-18961. Co-authored-by: Tim Düsterhus <tim@tideways-gmbh.com>
This commit is contained in:
parent
6f3bc59950
commit
7b4c14dc10
21 changed files with 239 additions and 264 deletions
|
@ -90,7 +90,6 @@ jobs:
|
||||||
--prefix=/usr \
|
--prefix=/usr \
|
||||||
--enable-phpdbg \
|
--enable-phpdbg \
|
||||||
--enable-fpm \
|
--enable-fpm \
|
||||||
--enable-opcache \
|
|
||||||
--with-pdo-mysql=mysqlnd \
|
--with-pdo-mysql=mysqlnd \
|
||||||
--with-mysqli=mysqlnd \
|
--with-mysqli=mysqlnd \
|
||||||
--with-pgsql \
|
--with-pgsql \
|
||||||
|
@ -168,7 +167,6 @@ jobs:
|
||||||
no_output_timeout: 30m
|
no_output_timeout: 30m
|
||||||
command: |
|
command: |
|
||||||
sapi/cli/php run-tests.php \
|
sapi/cli/php run-tests.php \
|
||||||
-d zend_extension=opcache.so \
|
|
||||||
-d opcache.enable_cli=1 \
|
-d opcache.enable_cli=1 \
|
||||||
-d opcache.jit_buffer_size=64M \
|
-d opcache.jit_buffer_size=64M \
|
||||||
-d opcache.jit=tracing \
|
-d opcache.jit=tracing \
|
||||||
|
|
3
.github/actions/freebsd/action.yml
vendored
3
.github/actions/freebsd/action.yml
vendored
|
@ -113,8 +113,7 @@ runs:
|
||||||
--offline \
|
--offline \
|
||||||
--show-diff \
|
--show-diff \
|
||||||
--show-slow 1000 \
|
--show-slow 1000 \
|
||||||
--set-timeout 120 \
|
--set-timeout 120
|
||||||
-d zend_extension=opcache.so
|
|
||||||
|
|
||||||
if test "${{ inputs.runExtraTests }}" = "true"; then
|
if test "${{ inputs.runExtraTests }}" = "true"; then
|
||||||
sapi/cli/php run-extra-tests.php
|
sapi/cli/php run-extra-tests.php
|
||||||
|
|
1
.github/scripts/windows/test_task.bat
vendored
1
.github/scripts/windows/test_task.bat
vendored
|
@ -128,7 +128,6 @@ mkdir %PHP_BUILD_DIR%\test_file_cache
|
||||||
rem generate php.ini
|
rem generate php.ini
|
||||||
echo extension_dir=%PHP_BUILD_DIR% > %PHP_BUILD_DIR%\php.ini
|
echo extension_dir=%PHP_BUILD_DIR% > %PHP_BUILD_DIR%\php.ini
|
||||||
echo opcache.file_cache=%PHP_BUILD_DIR%\test_file_cache >> %PHP_BUILD_DIR%\php.ini
|
echo opcache.file_cache=%PHP_BUILD_DIR%\test_file_cache >> %PHP_BUILD_DIR%\php.ini
|
||||||
if "%OPCACHE%" equ "1" echo zend_extension=php_opcache.dll >> %PHP_BUILD_DIR%\php.ini
|
|
||||||
rem work-around for some spawned PHP processes requiring OpenSSL and sockets
|
rem work-around for some spawned PHP processes requiring OpenSSL and sockets
|
||||||
echo extension=php_openssl.dll >> %PHP_BUILD_DIR%\php.ini
|
echo extension=php_openssl.dll >> %PHP_BUILD_DIR%\php.ini
|
||||||
echo extension=php_sockets.dll >> %PHP_BUILD_DIR%\php.ini
|
echo extension=php_sockets.dll >> %PHP_BUILD_DIR%\php.ini
|
||||||
|
|
18
.github/workflows/nightly.yml
vendored
18
.github/workflows/nightly.yml
vendored
|
@ -134,7 +134,6 @@ jobs:
|
||||||
jitType: tracing
|
jitType: tracing
|
||||||
runTestsParameters: >-
|
runTestsParameters: >-
|
||||||
--asan -x
|
--asan -x
|
||||||
-d zend_extension=opcache.so
|
|
||||||
-d opcache.enable_cli=1
|
-d opcache.enable_cli=1
|
||||||
- name: Extra tests
|
- name: Extra tests
|
||||||
uses: ./.github/actions/extra-tests
|
uses: ./.github/actions/extra-tests
|
||||||
|
@ -250,14 +249,12 @@ jobs:
|
||||||
jitType: tracing
|
jitType: tracing
|
||||||
runTestsParameters: >-
|
runTestsParameters: >-
|
||||||
${{ matrix.run_tests_parameters }}
|
${{ matrix.run_tests_parameters }}
|
||||||
-d zend_extension=opcache.so
|
|
||||||
-d opcache.enable_cli=1
|
-d opcache.enable_cli=1
|
||||||
- name: Test OpCache
|
- name: Test OpCache
|
||||||
uses: ./.github/actions/test-linux
|
uses: ./.github/actions/test-linux
|
||||||
with:
|
with:
|
||||||
runTestsParameters: >-
|
runTestsParameters: >-
|
||||||
${{ matrix.run_tests_parameters }}
|
${{ matrix.run_tests_parameters }}
|
||||||
-d zend_extension=opcache.so
|
|
||||||
-d opcache.enable_cli=1
|
-d opcache.enable_cli=1
|
||||||
- name: Test Function JIT
|
- name: Test Function JIT
|
||||||
# ASAN frequently timeouts. Each test run takes ~90 minutes, we can
|
# ASAN frequently timeouts. Each test run takes ~90 minutes, we can
|
||||||
|
@ -268,7 +265,6 @@ jobs:
|
||||||
jitType: function
|
jitType: function
|
||||||
runTestsParameters: >-
|
runTestsParameters: >-
|
||||||
${{ matrix.run_tests_parameters }}
|
${{ matrix.run_tests_parameters }}
|
||||||
-d zend_extension=opcache.so
|
|
||||||
-d opcache.enable_cli=1
|
-d opcache.enable_cli=1
|
||||||
- name: Extra tests
|
- name: Extra tests
|
||||||
uses: ./.github/actions/extra-tests
|
uses: ./.github/actions/extra-tests
|
||||||
|
@ -344,14 +340,12 @@ jobs:
|
||||||
jitType: tracing
|
jitType: tracing
|
||||||
runTestsParameters: >-
|
runTestsParameters: >-
|
||||||
${{ matrix.run_tests_parameters }}
|
${{ matrix.run_tests_parameters }}
|
||||||
-d zend_extension=opcache.so
|
|
||||||
-d opcache.enable_cli=1
|
-d opcache.enable_cli=1
|
||||||
- name: Test OpCache
|
- name: Test OpCache
|
||||||
uses: ./.github/actions/test-linux
|
uses: ./.github/actions/test-linux
|
||||||
with:
|
with:
|
||||||
runTestsParameters: >-
|
runTestsParameters: >-
|
||||||
${{ matrix.run_tests_parameters }}
|
${{ matrix.run_tests_parameters }}
|
||||||
-d zend_extension=opcache.so
|
|
||||||
-d opcache.enable_cli=1
|
-d opcache.enable_cli=1
|
||||||
- name: Test Function JIT
|
- name: Test Function JIT
|
||||||
uses: ./.github/actions/test-linux
|
uses: ./.github/actions/test-linux
|
||||||
|
@ -359,7 +353,6 @@ jobs:
|
||||||
jitType: function
|
jitType: function
|
||||||
runTestsParameters: >-
|
runTestsParameters: >-
|
||||||
${{ matrix.run_tests_parameters }}
|
${{ matrix.run_tests_parameters }}
|
||||||
-d zend_extension=opcache.so
|
|
||||||
-d opcache.enable_cli=1
|
-d opcache.enable_cli=1
|
||||||
- name: Extra tests
|
- name: Extra tests
|
||||||
uses: ./.github/actions/extra-tests
|
uses: ./.github/actions/extra-tests
|
||||||
|
@ -406,13 +399,11 @@ jobs:
|
||||||
with:
|
with:
|
||||||
jitType: tracing
|
jitType: tracing
|
||||||
runTestsParameters: >-
|
runTestsParameters: >-
|
||||||
-d zend_extension=opcache.so
|
|
||||||
-d opcache.enable_cli=1
|
-d opcache.enable_cli=1
|
||||||
- name: Test OpCache
|
- name: Test OpCache
|
||||||
uses: ./.github/actions/test-macos
|
uses: ./.github/actions/test-macos
|
||||||
with:
|
with:
|
||||||
runTestsParameters: >-
|
runTestsParameters: >-
|
||||||
-d zend_extension=opcache.so
|
|
||||||
-d opcache.enable_cli=1
|
-d opcache.enable_cli=1
|
||||||
- name: Test Function JIT
|
- name: Test Function JIT
|
||||||
if: matrix.os != '14' || !matrix.zts
|
if: matrix.os != '14' || !matrix.zts
|
||||||
|
@ -420,7 +411,6 @@ jobs:
|
||||||
with:
|
with:
|
||||||
jitType: function
|
jitType: function
|
||||||
runTestsParameters: >-
|
runTestsParameters: >-
|
||||||
-d zend_extension=opcache.so
|
|
||||||
-d opcache.enable_cli=1
|
-d opcache.enable_cli=1
|
||||||
- name: Extra tests
|
- name: Extra tests
|
||||||
uses: ./.github/actions/extra-tests
|
uses: ./.github/actions/extra-tests
|
||||||
|
@ -484,7 +474,6 @@ jobs:
|
||||||
with:
|
with:
|
||||||
jitType: tracing
|
jitType: tracing
|
||||||
runTestsParameters: >-
|
runTestsParameters: >-
|
||||||
-d zend_extension=opcache.so
|
|
||||||
-d opcache.enable_cli=1
|
-d opcache.enable_cli=1
|
||||||
- uses: codecov/codecov-action@v4
|
- uses: codecov/codecov-action@v4
|
||||||
if: ${{ !cancelled() }}
|
if: ${{ !cancelled() }}
|
||||||
|
@ -538,7 +527,6 @@ jobs:
|
||||||
- name: Enable Opcache
|
- name: Enable Opcache
|
||||||
run: |
|
run: |
|
||||||
echo memory_limit=-1 >> /etc/php.d/opcache.ini
|
echo memory_limit=-1 >> /etc/php.d/opcache.ini
|
||||||
echo zend_extension=opcache.so > /etc/php.d/opcache.ini
|
|
||||||
echo opcache.enable_cli=1 >> /etc/php.d/opcache.ini
|
echo opcache.enable_cli=1 >> /etc/php.d/opcache.ini
|
||||||
echo opcache.enable=1 >> /etc/php.d/opcache.ini
|
echo opcache.enable=1 >> /etc/php.d/opcache.ini
|
||||||
echo opcache.protect_memory=1 >> /etc/php.d/opcache.ini
|
echo opcache.protect_memory=1 >> /etc/php.d/opcache.ini
|
||||||
|
@ -729,21 +717,18 @@ jobs:
|
||||||
uses: ./.github/actions/test-linux
|
uses: ./.github/actions/test-linux
|
||||||
with:
|
with:
|
||||||
runTestsParameters: >-
|
runTestsParameters: >-
|
||||||
-d zend_extension=opcache.so
|
|
||||||
-d opcache.enable_cli=1
|
-d opcache.enable_cli=1
|
||||||
--file-cache-prime
|
--file-cache-prime
|
||||||
- name: Test File Cache (prime shm, use shm)
|
- name: Test File Cache (prime shm, use shm)
|
||||||
uses: ./.github/actions/test-linux
|
uses: ./.github/actions/test-linux
|
||||||
with:
|
with:
|
||||||
runTestsParameters: >-
|
runTestsParameters: >-
|
||||||
-d zend_extension=opcache.so
|
|
||||||
-d opcache.enable_cli=1
|
-d opcache.enable_cli=1
|
||||||
--file-cache-use
|
--file-cache-use
|
||||||
- name: Test File Cache (prime shm, use file)
|
- name: Test File Cache (prime shm, use file)
|
||||||
uses: ./.github/actions/test-linux
|
uses: ./.github/actions/test-linux
|
||||||
with:
|
with:
|
||||||
runTestsParameters: >-
|
runTestsParameters: >-
|
||||||
-d zend_extension=opcache.so
|
|
||||||
-d opcache.enable_cli=1
|
-d opcache.enable_cli=1
|
||||||
--file-cache-use
|
--file-cache-use
|
||||||
-d opcache.file_cache_only=1
|
-d opcache.file_cache_only=1
|
||||||
|
@ -751,7 +736,6 @@ jobs:
|
||||||
uses: ./.github/actions/test-linux
|
uses: ./.github/actions/test-linux
|
||||||
with:
|
with:
|
||||||
runTestsParameters: >-
|
runTestsParameters: >-
|
||||||
-d zend_extension=opcache.so
|
|
||||||
-d opcache.enable_cli=1
|
-d opcache.enable_cli=1
|
||||||
--file-cache-prime
|
--file-cache-prime
|
||||||
-d opcache.file_cache_only=1
|
-d opcache.file_cache_only=1
|
||||||
|
@ -759,7 +743,6 @@ jobs:
|
||||||
uses: ./.github/actions/test-linux
|
uses: ./.github/actions/test-linux
|
||||||
with:
|
with:
|
||||||
runTestsParameters: >-
|
runTestsParameters: >-
|
||||||
-d zend_extension=opcache.so
|
|
||||||
-d opcache.enable_cli=1
|
-d opcache.enable_cli=1
|
||||||
--file-cache-use
|
--file-cache-use
|
||||||
-d opcache.file_cache_only=1
|
-d opcache.file_cache_only=1
|
||||||
|
@ -853,7 +836,6 @@ jobs:
|
||||||
with:
|
with:
|
||||||
runTestsParameters: >-
|
runTestsParameters: >-
|
||||||
--msan
|
--msan
|
||||||
-d zend_extension=opcache.so
|
|
||||||
-d opcache.enable_cli=1
|
-d opcache.enable_cli=1
|
||||||
- name: Verify generated files are up to date
|
- name: Verify generated files are up to date
|
||||||
uses: ./.github/actions/verify-generated-files
|
uses: ./.github/actions/verify-generated-files
|
||||||
|
|
5
.github/workflows/push.yml
vendored
5
.github/workflows/push.yml
vendored
|
@ -130,7 +130,6 @@ jobs:
|
||||||
with:
|
with:
|
||||||
jitType: tracing
|
jitType: tracing
|
||||||
runTestsParameters: >-
|
runTestsParameters: >-
|
||||||
-d zend_extension=opcache.so
|
|
||||||
-d opcache.enable_cli=1
|
-d opcache.enable_cli=1
|
||||||
${{ matrix.asan && '--asan -x' || '' }}
|
${{ matrix.asan && '--asan -x' || '' }}
|
||||||
- name: Verify generated files are up to date
|
- name: Verify generated files are up to date
|
||||||
|
@ -190,7 +189,6 @@ jobs:
|
||||||
with:
|
with:
|
||||||
jitType: tracing
|
jitType: tracing
|
||||||
runTestsParameters: >-
|
runTestsParameters: >-
|
||||||
-d zend_extension=opcache.so
|
|
||||||
-d opcache.enable_cli=1
|
-d opcache.enable_cli=1
|
||||||
MACOS_DEBUG_NTS:
|
MACOS_DEBUG_NTS:
|
||||||
if: github.repository == 'php/php-src' || github.event_name == 'pull_request'
|
if: github.repository == 'php/php-src' || github.event_name == 'pull_request'
|
||||||
|
@ -229,7 +227,6 @@ jobs:
|
||||||
with:
|
with:
|
||||||
jitType: tracing
|
jitType: tracing
|
||||||
runTestsParameters: >-
|
runTestsParameters: >-
|
||||||
-d zend_extension=opcache.so
|
|
||||||
-d opcache.enable_cli=1
|
-d opcache.enable_cli=1
|
||||||
- name: Verify generated files are up to date
|
- name: Verify generated files are up to date
|
||||||
uses: ./.github/actions/verify-generated-files
|
uses: ./.github/actions/verify-generated-files
|
||||||
|
@ -299,7 +296,6 @@ jobs:
|
||||||
./configure \
|
./configure \
|
||||||
--disable-debug \
|
--disable-debug \
|
||||||
--enable-mbstring \
|
--enable-mbstring \
|
||||||
--enable-opcache \
|
|
||||||
--enable-option-checking=fatal \
|
--enable-option-checking=fatal \
|
||||||
--enable-sockets \
|
--enable-sockets \
|
||||||
--enable-werror \
|
--enable-werror \
|
||||||
|
@ -319,7 +315,6 @@ jobs:
|
||||||
sudo mkdir -p /etc/php.d
|
sudo mkdir -p /etc/php.d
|
||||||
sudo chmod 777 /etc/php.d
|
sudo chmod 777 /etc/php.d
|
||||||
echo mysqli.default_socket=/var/run/mysqld/mysqld.sock > /etc/php.d/mysqli.ini
|
echo mysqli.default_socket=/var/run/mysqld/mysqld.sock > /etc/php.d/mysqli.ini
|
||||||
echo zend_extension=opcache.so >> /etc/php.d/opcache.ini
|
|
||||||
echo opcache.enable=1 >> /etc/php.d/opcache.ini
|
echo opcache.enable=1 >> /etc/php.d/opcache.ini
|
||||||
echo opcache.enable_cli=1 >> /etc/php.d/opcache.ini
|
echo opcache.enable_cli=1 >> /etc/php.d/opcache.ini
|
||||||
- name: Setup
|
- name: Setup
|
||||||
|
|
2
NEWS
2
NEWS
|
@ -15,6 +15,8 @@ PHP NEWS
|
||||||
- OPcache:
|
- OPcache:
|
||||||
. Disallow changing opcache.memory_consumption when SHM is already set up.
|
. Disallow changing opcache.memory_consumption when SHM is already set up.
|
||||||
(timwolla)
|
(timwolla)
|
||||||
|
. Fixed GH-15074 (Compiling opcache statically into ZTS PHP fails). (Arnaud)
|
||||||
|
. Make OPcache non-optional (Arnaud, timwolla)
|
||||||
|
|
||||||
- OpenSSL:
|
- OpenSSL:
|
||||||
. Add $digest_algo parameter to openssl_public_encrypt() and
|
. Add $digest_algo parameter to openssl_public_encrypt() and
|
||||||
|
|
19
UPGRADING
19
UPGRADING
|
@ -71,6 +71,16 @@ PHP 8.5 UPGRADE NOTES
|
||||||
. Calling the mysqli constructor on an already-constructed object
|
. Calling the mysqli constructor on an already-constructed object
|
||||||
is now no longer possible and throws an Error.
|
is now no longer possible and throws an Error.
|
||||||
|
|
||||||
|
- Opcache:
|
||||||
|
. The Opcache extension is now always built into the PHP binary and is always
|
||||||
|
loaded. The INI directives opcache.enable and opcache.enable_cli are still
|
||||||
|
honored.
|
||||||
|
The --enable-opcache/--disable-opcache configure flags have been removed,
|
||||||
|
and the build does not produce opcache.so or php_opcache.dll objects
|
||||||
|
anymore.
|
||||||
|
Using zend_extension=opcache.so or zend_extension=php_opcache.dll INI
|
||||||
|
directives will emit a warning.
|
||||||
|
|
||||||
- PCNTL:
|
- PCNTL:
|
||||||
. pcntl_exec() now throws ValueErrors when entries of the $args parameter
|
. pcntl_exec() now throws ValueErrors when entries of the $args parameter
|
||||||
contain null bytes.
|
contain null bytes.
|
||||||
|
@ -522,6 +532,11 @@ PHP 8.5 UPGRADE NOTES
|
||||||
library that was separated from ext/dom for being reused among other
|
library that was separated from ext/dom for being reused among other
|
||||||
extensions. The new extension is not directly exposed to userland.
|
extensions. The new extension is not directly exposed to userland.
|
||||||
|
|
||||||
|
- Opcache:
|
||||||
|
. The Opcache extension is now always built into the PHP binary and is always
|
||||||
|
loaded. The INI directives opcache.enable and opcache.enable_cli are still
|
||||||
|
honored.
|
||||||
|
|
||||||
- URI:
|
- URI:
|
||||||
. An always enabled uri extension is added that can be used for handling
|
. An always enabled uri extension is added that can be used for handling
|
||||||
URIs and URLs according to RFC 3986 and WHATWG URL.
|
URIs and URLs according to RFC 3986 and WHATWG URL.
|
||||||
|
@ -693,6 +708,10 @@ PHP 8.5 UPGRADE NOTES
|
||||||
. The parts of the code that used SSE2 have been adapted to use SIMD
|
. The parts of the code that used SSE2 have been adapted to use SIMD
|
||||||
with ARM NEON as well.
|
with ARM NEON as well.
|
||||||
|
|
||||||
|
- Opcache:
|
||||||
|
. Improved performance of fetching TLS variables in JIT'ed code in non-Glibc
|
||||||
|
builds.
|
||||||
|
|
||||||
- ReflectionProperty:
|
- ReflectionProperty:
|
||||||
. Improved performance of the following methods: getValue(), getRawValue(),
|
. Improved performance of the following methods: getValue(), getRawValue(),
|
||||||
isInitialized(), setValue(), setRawValue().
|
isInitialized(), setValue(), setRawValue().
|
||||||
|
|
|
@ -219,7 +219,7 @@ slightly different steps. We'll call attention where the steps differ.
|
||||||
# With ZTS
|
# With ZTS
|
||||||
make distclean || \
|
make distclean || \
|
||||||
./buildconf --force \
|
./buildconf --force \
|
||||||
&& ./configure --enable-zts --disable-all --enable-debug --enable-opcache --enable-opcache-jit \
|
&& ./configure --enable-zts --disable-all --enable-debug --enable-opcache-jit \
|
||||||
&& make -j$(nproc) \
|
&& make -j$(nproc) \
|
||||||
&& make test TEST_PHP_ARGS="-q -j$(nproc)" \
|
&& make test TEST_PHP_ARGS="-q -j$(nproc)" \
|
||||||
|| ./sapi/cli/php -v
|
|| ./sapi/cli/php -v
|
||||||
|
@ -227,7 +227,7 @@ slightly different steps. We'll call attention where the steps differ.
|
||||||
# Without ZTS
|
# Without ZTS
|
||||||
make distclean || \
|
make distclean || \
|
||||||
./buildconf --force \
|
./buildconf --force \
|
||||||
&& ./configure --disable-all --enable-debug --enable-opcache --enable-opcache-jit \
|
&& ./configure --disable-all --enable-debug --enable-opcache-jit \
|
||||||
&& make -j$(nproc) \
|
&& make -j$(nproc) \
|
||||||
&& make test TEST_PHP_ARGS="-q -j$(nproc)" \
|
&& make test TEST_PHP_ARGS="-q -j$(nproc)" \
|
||||||
|| ./sapi/cli/php -v
|
|| ./sapi/cli/php -v
|
||||||
|
@ -571,7 +571,7 @@ slightly different steps. We'll call attention where the steps differ.
|
||||||
# With ZTS
|
# With ZTS
|
||||||
make distclean || \
|
make distclean || \
|
||||||
./buildconf --force \
|
./buildconf --force \
|
||||||
&& ./configure --enable-zts --disable-all --enable-debug --enable-opcache --enable-opcache-jit \
|
&& ./configure --enable-zts --disable-all --enable-debug --enable-opcache-jit \
|
||||||
&& make -j$(nproc) \
|
&& make -j$(nproc) \
|
||||||
&& make test TEST_PHP_ARGS="-q -j$(nproc)" \
|
&& make test TEST_PHP_ARGS="-q -j$(nproc)" \
|
||||||
|| ./sapi/cli/php -v
|
|| ./sapi/cli/php -v
|
||||||
|
@ -579,7 +579,7 @@ slightly different steps. We'll call attention where the steps differ.
|
||||||
# Without ZTS
|
# Without ZTS
|
||||||
make distclean || \
|
make distclean || \
|
||||||
./buildconf --force \
|
./buildconf --force \
|
||||||
&& ./configure --disable-all --enable-debug --enable-opcache --enable-opcache-jit \
|
&& ./configure --disable-all --enable-debug --enable-opcache-jit \
|
||||||
&& make -j$(nproc) \
|
&& make -j$(nproc) \
|
||||||
&& make test TEST_PHP_ARGS="-q -j$(nproc)" \
|
&& make test TEST_PHP_ARGS="-q -j$(nproc)" \
|
||||||
|| ./sapi/cli/php -v
|
|| ./sapi/cli/php -v
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include "zend_extensions.h"
|
#include "zend_extensions.h"
|
||||||
#include "zend_compile.h"
|
#include "zend_compile.h"
|
||||||
#include "ZendAccelerator.h"
|
#include "ZendAccelerator.h"
|
||||||
|
#include "zend_modules.h"
|
||||||
#include "zend_persist.h"
|
#include "zend_persist.h"
|
||||||
#include "zend_shared_alloc.h"
|
#include "zend_shared_alloc.h"
|
||||||
#include "zend_accelerator_module.h"
|
#include "zend_accelerator_module.h"
|
||||||
|
@ -102,15 +103,12 @@ typedef int gid_t;
|
||||||
|
|
||||||
#include "zend_simd.h"
|
#include "zend_simd.h"
|
||||||
|
|
||||||
ZEND_EXTENSION();
|
static zend_extension opcache_extension_entry;
|
||||||
|
|
||||||
#ifndef ZTS
|
#ifndef ZTS
|
||||||
zend_accel_globals accel_globals;
|
zend_accel_globals accel_globals;
|
||||||
#else
|
#else
|
||||||
int accel_globals_id;
|
int accel_globals_id;
|
||||||
#if defined(COMPILE_DL_OPCACHE)
|
|
||||||
ZEND_TSRMLS_CACHE_DEFINE()
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Points to the structure shared across all PHP processes */
|
/* Points to the structure shared across all PHP processes */
|
||||||
|
@ -2969,9 +2967,6 @@ static zend_result zend_accel_init_shm(void)
|
||||||
|
|
||||||
static void accel_globals_ctor(zend_accel_globals *accel_globals)
|
static void accel_globals_ctor(zend_accel_globals *accel_globals)
|
||||||
{
|
{
|
||||||
#if defined(COMPILE_DL_OPCACHE) && defined(ZTS)
|
|
||||||
ZEND_TSRMLS_CACHE_UPDATE();
|
|
||||||
#endif
|
|
||||||
memset(accel_globals, 0, sizeof(zend_accel_globals));
|
memset(accel_globals, 0, sizeof(zend_accel_globals));
|
||||||
accel_globals->key = zend_string_alloc(ZCG_KEY_LEN, true);
|
accel_globals->key = zend_string_alloc(ZCG_KEY_LEN, true);
|
||||||
GC_MAKE_PERSISTENT_LOCAL(accel_globals->key);
|
GC_MAKE_PERSISTENT_LOCAL(accel_globals->key);
|
||||||
|
@ -3156,6 +3151,11 @@ static void accel_move_code_to_huge_pages(void)
|
||||||
# endif /* defined(MAP_HUGETLB) || defined(MADV_HUGEPAGE) */
|
# endif /* defined(MAP_HUGETLB) || defined(MADV_HUGEPAGE) */
|
||||||
#endif /* HAVE_HUGE_CODE_PAGES */
|
#endif /* HAVE_HUGE_CODE_PAGES */
|
||||||
|
|
||||||
|
void start_accel_extension(void)
|
||||||
|
{
|
||||||
|
zend_register_extension(&opcache_extension_entry, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
static int accel_startup(zend_extension *extension)
|
static int accel_startup(zend_extension *extension)
|
||||||
{
|
{
|
||||||
#ifdef ZTS
|
#ifdef ZTS
|
||||||
|
@ -3174,11 +3174,7 @@ static int accel_startup(zend_extension *extension)
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (start_accel_module() == FAILURE) {
|
zend_accel_register_ini_entries();
|
||||||
accel_startup_ok = false;
|
|
||||||
zend_error(E_WARNING, ACCELERATOR_PRODUCT_NAME ": module registration failed!");
|
|
||||||
return FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef ZEND_WIN32
|
#ifdef ZEND_WIN32
|
||||||
if (UNEXPECTED(accel_gen_uname_id() == FAILURE)) {
|
if (UNEXPECTED(accel_gen_uname_id() == FAILURE)) {
|
||||||
|
@ -5086,7 +5082,7 @@ static void accel_activate(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ZEND_EXT_API zend_extension zend_extension_entry = {
|
static zend_extension opcache_extension_entry = {
|
||||||
ACCELERATOR_PRODUCT_NAME, /* name */
|
ACCELERATOR_PRODUCT_NAME, /* name */
|
||||||
PHP_VERSION, /* version */
|
PHP_VERSION, /* version */
|
||||||
"Zend Technologies", /* author */
|
"Zend Technologies", /* author */
|
||||||
|
|
|
@ -302,9 +302,6 @@ extern zend_accel_shared_globals *accel_shared_globals;
|
||||||
#ifdef ZTS
|
#ifdef ZTS
|
||||||
# define ZCG(v) ZEND_TSRMG(accel_globals_id, zend_accel_globals *, v)
|
# define ZCG(v) ZEND_TSRMG(accel_globals_id, zend_accel_globals *, v)
|
||||||
extern int accel_globals_id;
|
extern int accel_globals_id;
|
||||||
# ifdef COMPILE_DL_OPCACHE
|
|
||||||
ZEND_TSRMLS_CACHE_EXTERN()
|
|
||||||
# endif
|
|
||||||
#else
|
#else
|
||||||
# define ZCG(v) (accel_globals.v)
|
# define ZCG(v) (accel_globals.v)
|
||||||
extern zend_accel_globals accel_globals;
|
extern zend_accel_globals accel_globals;
|
||||||
|
@ -314,6 +311,7 @@ extern const char *zps_api_failure_reason;
|
||||||
|
|
||||||
BEGIN_EXTERN_C()
|
BEGIN_EXTERN_C()
|
||||||
|
|
||||||
|
void start_accel_extension(void);
|
||||||
void accel_shutdown(void);
|
void accel_shutdown(void);
|
||||||
ZEND_RINIT_FUNCTION(zend_accelerator);
|
ZEND_RINIT_FUNCTION(zend_accelerator);
|
||||||
zend_result accel_post_deactivate(void);
|
zend_result accel_post_deactivate(void);
|
||||||
|
|
|
@ -1,9 +1,3 @@
|
||||||
PHP_ARG_ENABLE([opcache],
|
|
||||||
[whether to enable Zend OPcache support],
|
|
||||||
[AS_HELP_STRING([--disable-opcache],
|
|
||||||
[Disable Zend OPcache support])],
|
|
||||||
[yes])
|
|
||||||
|
|
||||||
PHP_ARG_ENABLE([huge-code-pages],
|
PHP_ARG_ENABLE([huge-code-pages],
|
||||||
[whether to enable copying PHP CODE pages into HUGE PAGES],
|
[whether to enable copying PHP CODE pages into HUGE PAGES],
|
||||||
[AS_HELP_STRING([--disable-huge-code-pages],
|
[AS_HELP_STRING([--disable-huge-code-pages],
|
||||||
|
@ -25,97 +19,93 @@ PHP_ARG_WITH([capstone],
|
||||||
[no],
|
[no],
|
||||||
[no])
|
[no])
|
||||||
|
|
||||||
if test "$PHP_OPCACHE" != "no"; then
|
AS_VAR_IF([PHP_HUGE_CODE_PAGES], [yes],
|
||||||
dnl Always build as shared extension.
|
[AC_DEFINE([HAVE_HUGE_CODE_PAGES], [1],
|
||||||
ext_shared=yes
|
[Define to 1 to enable copying PHP CODE pages into HUGE PAGES.])])
|
||||||
|
|
||||||
AS_VAR_IF([PHP_HUGE_CODE_PAGES], [yes],
|
AS_VAR_IF([PHP_OPCACHE_JIT], [yes], [
|
||||||
[AC_DEFINE([HAVE_HUGE_CODE_PAGES], [1],
|
AS_CASE([$host_cpu],
|
||||||
[Define to 1 to enable copying PHP CODE pages into HUGE PAGES.])])
|
[[i[34567]86*|x86*|aarch64|amd64]], [],
|
||||||
|
[
|
||||||
AS_VAR_IF([PHP_OPCACHE_JIT], [yes], [
|
AC_MSG_WARN([JIT not supported by host architecture])
|
||||||
AS_CASE([$host_cpu],
|
|
||||||
[[i[34567]86*|x86*|aarch64|amd64]], [],
|
|
||||||
[
|
|
||||||
AC_MSG_WARN([JIT not supported by host architecture])
|
|
||||||
PHP_OPCACHE_JIT=no
|
|
||||||
])
|
|
||||||
|
|
||||||
if test "$host_vendor" = "apple" && test "$host_cpu" = "aarch64" && test "$PHP_THREAD_SAFETY" = "yes"; then
|
|
||||||
AC_MSG_WARN([JIT not supported on Apple Silicon with ZTS])
|
|
||||||
PHP_OPCACHE_JIT=no
|
PHP_OPCACHE_JIT=no
|
||||||
fi
|
|
||||||
])
|
|
||||||
|
|
||||||
AS_VAR_IF([PHP_OPCACHE_JIT], [yes], [
|
|
||||||
AC_DEFINE([HAVE_JIT], [1], [Define to 1 to enable JIT.])
|
|
||||||
ZEND_JIT_SRC=m4_normalize(["
|
|
||||||
jit/ir/ir_cfg.c
|
|
||||||
jit/ir/ir_check.c
|
|
||||||
jit/ir/ir_dump.c
|
|
||||||
jit/ir/ir_emit.c
|
|
||||||
jit/ir/ir_gcm.c
|
|
||||||
jit/ir/ir_gdb.c
|
|
||||||
jit/ir/ir_patch.c
|
|
||||||
jit/ir/ir_perf.c
|
|
||||||
jit/ir/ir_ra.c
|
|
||||||
jit/ir/ir_save.c
|
|
||||||
jit/ir/ir_sccp.c
|
|
||||||
jit/ir/ir_strtab.c
|
|
||||||
jit/ir/ir.c
|
|
||||||
jit/zend_jit_vm_helpers.c
|
|
||||||
jit/zend_jit.c
|
|
||||||
"])
|
|
||||||
|
|
||||||
dnl Find out which ABI we are using.
|
|
||||||
AS_CASE([$host_alias],
|
|
||||||
[x86_64-*-darwin*], [
|
|
||||||
IR_TARGET=IR_TARGET_X64
|
|
||||||
DASM_FLAGS="-D X64APPLE=1 -D X64=1"
|
|
||||||
DASM_ARCH="x86"
|
|
||||||
TLS_TARGET="darwin"
|
|
||||||
],
|
|
||||||
[*x86_64*|amd64-*-freebsd*], [
|
|
||||||
IR_TARGET=IR_TARGET_X64
|
|
||||||
DASM_FLAGS="-D X64=1"
|
|
||||||
DASM_ARCH="x86"
|
|
||||||
TLS_TARGET="x86_64"
|
|
||||||
],
|
|
||||||
[[i[34567]86*|x86*]], [
|
|
||||||
IR_TARGET=IR_TARGET_X86
|
|
||||||
DASM_ARCH="x86"
|
|
||||||
TLS_TARGET="x86"
|
|
||||||
],
|
|
||||||
[aarch64*], [
|
|
||||||
IR_TARGET=IR_TARGET_AARCH64
|
|
||||||
DASM_ARCH="aarch64"
|
|
||||||
TLS_TARGET="aarch64"
|
|
||||||
])
|
|
||||||
|
|
||||||
AS_VAR_IF([PHP_CAPSTONE], [yes],
|
|
||||||
[PKG_CHECK_MODULES([CAPSTONE], [capstone >= 3.0.0], [
|
|
||||||
AC_DEFINE([HAVE_CAPSTONE], [1], [Define to 1 if Capstone is available.])
|
|
||||||
PHP_EVAL_LIBLINE([$CAPSTONE_LIBS], [OPCACHE_SHARED_LIBADD])
|
|
||||||
PHP_EVAL_INCLINE([$CAPSTONE_CFLAGS])
|
|
||||||
ZEND_JIT_SRC="$ZEND_JIT_SRC jit/ir/ir_disasm.c"
|
|
||||||
])])
|
|
||||||
|
|
||||||
PHP_SUBST([IR_TARGET])
|
|
||||||
PHP_SUBST([DASM_FLAGS])
|
|
||||||
PHP_SUBST([DASM_ARCH])
|
|
||||||
|
|
||||||
JIT_CFLAGS="-I@ext_builddir@/jit/ir -D$IR_TARGET -DIR_PHP"
|
|
||||||
AS_VAR_IF([ZEND_DEBUG], [yes], [JIT_CFLAGS="$JIT_CFLAGS -DIR_DEBUG"])
|
|
||||||
|
|
||||||
AS_VAR_IF([PHP_THREAD_SAFETY], [yes], [
|
|
||||||
ZEND_JIT_SRC="$ZEND_JIT_SRC jit/tls/zend_jit_tls_$TLS_TARGET.c"
|
|
||||||
])
|
])
|
||||||
|
|
||||||
|
if test "$host_vendor" = "apple" && test "$host_cpu" = "aarch64" && test "$PHP_THREAD_SAFETY" = "yes"; then
|
||||||
|
AC_MSG_WARN([JIT not supported on Apple Silicon with ZTS])
|
||||||
|
PHP_OPCACHE_JIT=no
|
||||||
|
fi
|
||||||
|
])
|
||||||
|
|
||||||
|
AS_VAR_IF([PHP_OPCACHE_JIT], [yes], [
|
||||||
|
AC_DEFINE([HAVE_JIT], [1], [Define to 1 to enable JIT.])
|
||||||
|
ZEND_JIT_SRC=m4_normalize(["
|
||||||
|
jit/ir/ir_cfg.c
|
||||||
|
jit/ir/ir_check.c
|
||||||
|
jit/ir/ir_dump.c
|
||||||
|
jit/ir/ir_emit.c
|
||||||
|
jit/ir/ir_gcm.c
|
||||||
|
jit/ir/ir_gdb.c
|
||||||
|
jit/ir/ir_patch.c
|
||||||
|
jit/ir/ir_perf.c
|
||||||
|
jit/ir/ir_ra.c
|
||||||
|
jit/ir/ir_save.c
|
||||||
|
jit/ir/ir_sccp.c
|
||||||
|
jit/ir/ir_strtab.c
|
||||||
|
jit/ir/ir.c
|
||||||
|
jit/zend_jit_vm_helpers.c
|
||||||
|
jit/zend_jit.c
|
||||||
|
"])
|
||||||
|
|
||||||
|
dnl Find out which ABI we are using.
|
||||||
|
AS_CASE([$host_alias],
|
||||||
|
[x86_64-*-darwin*], [
|
||||||
|
IR_TARGET=IR_TARGET_X64
|
||||||
|
DASM_FLAGS="-D X64APPLE=1 -D X64=1"
|
||||||
|
DASM_ARCH="x86"
|
||||||
|
TLS_TARGET="darwin"
|
||||||
|
],
|
||||||
|
[*x86_64*|amd64-*-freebsd*], [
|
||||||
|
IR_TARGET=IR_TARGET_X64
|
||||||
|
DASM_FLAGS="-D X64=1"
|
||||||
|
DASM_ARCH="x86"
|
||||||
|
TLS_TARGET="x86_64"
|
||||||
|
],
|
||||||
|
[[i[34567]86*|x86*]], [
|
||||||
|
IR_TARGET=IR_TARGET_X86
|
||||||
|
DASM_ARCH="x86"
|
||||||
|
TLS_TARGET="x86"
|
||||||
|
],
|
||||||
|
[aarch64*], [
|
||||||
|
IR_TARGET=IR_TARGET_AARCH64
|
||||||
|
DASM_ARCH="aarch64"
|
||||||
|
TLS_TARGET="aarch64"
|
||||||
|
])
|
||||||
|
|
||||||
|
AS_VAR_IF([PHP_CAPSTONE], [yes],
|
||||||
|
[PKG_CHECK_MODULES([CAPSTONE], [capstone >= 3.0.0], [
|
||||||
|
AC_DEFINE([HAVE_CAPSTONE], [1], [Define to 1 if Capstone is available.])
|
||||||
|
PHP_EVAL_LIBLINE([$CAPSTONE_LIBS], [OPCACHE_SHARED_LIBADD])
|
||||||
|
PHP_EVAL_INCLINE([$CAPSTONE_CFLAGS])
|
||||||
|
ZEND_JIT_SRC="$ZEND_JIT_SRC jit/ir/ir_disasm.c"
|
||||||
|
])])
|
||||||
|
|
||||||
|
PHP_SUBST([IR_TARGET])
|
||||||
|
PHP_SUBST([DASM_FLAGS])
|
||||||
|
PHP_SUBST([DASM_ARCH])
|
||||||
|
|
||||||
|
JIT_CFLAGS="-I@ext_builddir@/jit/ir -D$IR_TARGET -DIR_PHP"
|
||||||
|
AS_VAR_IF([ZEND_DEBUG], [yes], [JIT_CFLAGS="$JIT_CFLAGS -DIR_DEBUG"])
|
||||||
|
|
||||||
|
AS_VAR_IF([PHP_THREAD_SAFETY], [yes], [
|
||||||
|
ZEND_JIT_SRC="$ZEND_JIT_SRC jit/tls/zend_jit_tls_$TLS_TARGET.c"
|
||||||
])
|
])
|
||||||
|
])
|
||||||
|
|
||||||
AC_CHECK_FUNCS([mprotect shm_create_largepage])
|
AC_CHECK_FUNCS([mprotect shm_create_largepage])
|
||||||
|
|
||||||
AC_CACHE_CHECK([for sysvipc shared memory support], [php_cv_shm_ipc],
|
AC_CACHE_CHECK([for sysvipc shared memory support], [php_cv_shm_ipc],
|
||||||
[AC_RUN_IFELSE([AC_LANG_SOURCE([
|
[AC_RUN_IFELSE([AC_LANG_SOURCE([
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <sys/ipc.h>
|
#include <sys/ipc.h>
|
||||||
|
@ -317,56 +307,55 @@ int main(void) {
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}]])],
|
}]])],
|
||||||
[php_cv_shm_mmap_posix=yes],
|
[php_cv_shm_mmap_posix=yes],
|
||||||
[php_cv_shm_mmap_posix=no],
|
[php_cv_shm_mmap_posix=no],
|
||||||
[php_cv_shm_mmap_posix=no])
|
[php_cv_shm_mmap_posix=no])
|
||||||
])
|
|
||||||
])
|
])
|
||||||
LIBS=$LIBS_save
|
])
|
||||||
|
LIBS=$LIBS_save
|
||||||
|
|
||||||
AS_VAR_IF([php_cv_shm_mmap_posix], [yes], [
|
AS_VAR_IF([php_cv_shm_mmap_posix], [yes], [
|
||||||
AC_DEFINE([HAVE_SHM_MMAP_POSIX], [1],
|
AC_DEFINE([HAVE_SHM_MMAP_POSIX], [1],
|
||||||
[Define to 1 if you have the POSIX mmap() SHM support.])
|
[Define to 1 if you have the POSIX mmap() SHM support.])
|
||||||
AS_CASE([$ac_cv_search_shm_open], ["none required"|no], [],
|
AS_CASE([$ac_cv_search_shm_open], ["none required"|no], [],
|
||||||
[PHP_EVAL_LIBLINE([$ac_cv_search_shm_open], [OPCACHE_SHARED_LIBADD])])
|
[PHP_EVAL_LIBLINE([$ac_cv_search_shm_open], [OPCACHE_SHARED_LIBADD])])
|
||||||
])
|
])
|
||||||
|
|
||||||
PHP_NEW_EXTENSION([opcache], m4_normalize([
|
PHP_NEW_EXTENSION([opcache], m4_normalize([
|
||||||
shared_alloc_mmap.c
|
shared_alloc_mmap.c
|
||||||
shared_alloc_posix.c
|
shared_alloc_posix.c
|
||||||
shared_alloc_shm.c
|
shared_alloc_shm.c
|
||||||
zend_accelerator_blacklist.c
|
zend_accelerator_blacklist.c
|
||||||
zend_accelerator_debug.c
|
zend_accelerator_debug.c
|
||||||
zend_accelerator_hash.c
|
zend_accelerator_hash.c
|
||||||
zend_accelerator_module.c
|
zend_accelerator_module.c
|
||||||
zend_accelerator_util_funcs.c
|
zend_accelerator_util_funcs.c
|
||||||
zend_file_cache.c
|
zend_file_cache.c
|
||||||
zend_persist_calc.c
|
zend_persist_calc.c
|
||||||
zend_persist.c
|
zend_persist.c
|
||||||
zend_shared_alloc.c
|
zend_shared_alloc.c
|
||||||
ZendAccelerator.c
|
ZendAccelerator.c
|
||||||
$ZEND_JIT_SRC
|
$ZEND_JIT_SRC
|
||||||
]),
|
]),
|
||||||
[$ext_shared],,
|
[no],,
|
||||||
[-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 $JIT_CFLAGS],,
|
[-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 $JIT_CFLAGS],,
|
||||||
[yes])
|
[yes])
|
||||||
|
|
||||||
PHP_ADD_EXTENSION_DEP(opcache, date)
|
PHP_ADD_EXTENSION_DEP(opcache, date)
|
||||||
PHP_ADD_EXTENSION_DEP(opcache, pcre)
|
PHP_ADD_EXTENSION_DEP(opcache, pcre)
|
||||||
|
|
||||||
if test "$php_cv_shm_ipc" != "yes" && test "$php_cv_shm_mmap_posix" != "yes" && test "$php_cv_shm_mmap_anon" != "yes"; then
|
if test "$php_cv_shm_ipc" != "yes" && test "$php_cv_shm_mmap_posix" != "yes" && test "$php_cv_shm_mmap_anon" != "yes"; then
|
||||||
AC_MSG_FAILURE(m4_text_wrap([
|
AC_MSG_FAILURE(m4_text_wrap([
|
||||||
No supported shared memory caching support was found when configuring
|
No supported shared memory caching support was found when configuring
|
||||||
opcache.
|
opcache.
|
||||||
]))
|
]))
|
||||||
fi
|
|
||||||
|
|
||||||
AS_VAR_IF([PHP_OPCACHE_JIT], [yes], [
|
|
||||||
PHP_ADD_BUILD_DIR([
|
|
||||||
$ext_builddir/jit
|
|
||||||
$ext_builddir/jit/ir
|
|
||||||
])
|
|
||||||
PHP_ADD_MAKEFILE_FRAGMENT([$ext_srcdir/jit/Makefile.frag])
|
|
||||||
])
|
|
||||||
PHP_SUBST([OPCACHE_SHARED_LIBADD])
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
AS_VAR_IF([PHP_OPCACHE_JIT], [yes], [
|
||||||
|
PHP_ADD_BUILD_DIR([
|
||||||
|
$ext_builddir/jit
|
||||||
|
$ext_builddir/jit/ir
|
||||||
|
])
|
||||||
|
PHP_ADD_MAKEFILE_FRAGMENT([$ext_srcdir/jit/Makefile.frag])
|
||||||
|
])
|
||||||
|
PHP_SUBST([OPCACHE_SHARED_LIBADD])
|
||||||
|
|
|
@ -1,75 +1,70 @@
|
||||||
ARG_ENABLE("opcache", "whether to enable Zend OPcache support", "yes");
|
|
||||||
ARG_ENABLE("opcache-jit", "whether to enable JIT (not supported for ARM64)", "yes");
|
ARG_ENABLE("opcache-jit", "whether to enable JIT (not supported for ARM64)", "yes");
|
||||||
|
|
||||||
|
PHP_OPCACHE="yes";
|
||||||
|
|
||||||
if (PHP_OPCACHE != "no") {
|
ZEND_EXTENSION('opcache', "\
|
||||||
|
ZendAccelerator.c \
|
||||||
|
zend_accelerator_blacklist.c \
|
||||||
|
zend_accelerator_debug.c \
|
||||||
|
zend_accelerator_hash.c \
|
||||||
|
zend_accelerator_module.c \
|
||||||
|
zend_accelerator_util_funcs.c \
|
||||||
|
zend_persist.c \
|
||||||
|
zend_persist_calc.c \
|
||||||
|
zend_file_cache.c \
|
||||||
|
zend_shared_alloc.c \
|
||||||
|
shared_alloc_win32.c", false, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
|
||||||
|
|
||||||
ZEND_EXTENSION('opcache', "\
|
ADD_EXTENSION_DEP('opcache', 'date');
|
||||||
ZendAccelerator.c \
|
ADD_EXTENSION_DEP('opcache', 'hash');
|
||||||
zend_accelerator_blacklist.c \
|
ADD_EXTENSION_DEP('opcache', 'pcre');
|
||||||
zend_accelerator_debug.c \
|
|
||||||
zend_accelerator_hash.c \
|
|
||||||
zend_accelerator_module.c \
|
|
||||||
zend_accelerator_util_funcs.c \
|
|
||||||
zend_persist.c \
|
|
||||||
zend_persist_calc.c \
|
|
||||||
zend_file_cache.c \
|
|
||||||
zend_shared_alloc.c \
|
|
||||||
shared_alloc_win32.c", true, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
|
|
||||||
|
|
||||||
ADD_EXTENSION_DEP('opcache', 'date');
|
if (PHP_OPCACHE_JIT == "yes") {
|
||||||
ADD_EXTENSION_DEP('opcache', 'hash');
|
if (TARGET_ARCH == 'arm64') {
|
||||||
ADD_EXTENSION_DEP('opcache', 'pcre');
|
WARNING("JIT not enabled; not yet supported for ARM64");
|
||||||
|
} else if (CHECK_HEADER_ADD_INCLUDE("ir/ir.h", "CFLAGS_OPCACHE", PHP_OPCACHE + ";ext\\opcache\\jit")) {
|
||||||
|
var dasm_flags = (X64 ? "-D X64=1" : "") + (X64 ? " -D X64WIN=1" : "") + " -D WIN=1";
|
||||||
|
var ir_target = (X64 ? "IR_TARGET_X64" : "IR_TARGET_X86");
|
||||||
|
var ir_src = "ir_strtab.c ir_cfg.c ir_sccp.c ir_gcm.c ir_ra.c ir_save.c \
|
||||||
|
ir_dump.c ir_check.c ir_patch.c";
|
||||||
|
|
||||||
if (PHP_OPCACHE_JIT == "yes") {
|
DEFINE("IR_TARGET", ir_target);
|
||||||
if (TARGET_ARCH == 'arm64') {
|
DEFINE("DASM_FLAGS", dasm_flags);
|
||||||
WARNING("JIT not enabled; not yet supported for ARM64");
|
DEFINE("DASM_ARCH", "x86");
|
||||||
} else if (CHECK_HEADER_ADD_INCLUDE("ir/ir.h", "CFLAGS_OPCACHE", PHP_OPCACHE + ";ext\\opcache\\jit")) {
|
DEFINE("TLS_TARGET", "win");
|
||||||
var dasm_flags = (X64 ? "-D X64=1" : "") + (X64 ? " -D X64WIN=1" : "") + " -D WIN=1";
|
|
||||||
var ir_target = (X64 ? "IR_TARGET_X64" : "IR_TARGET_X86");
|
|
||||||
var ir_src = "ir_strtab.c ir_cfg.c ir_sccp.c ir_gcm.c ir_ra.c ir_save.c \
|
|
||||||
ir_dump.c ir_check.c ir_patch.c";
|
|
||||||
|
|
||||||
DEFINE("IR_TARGET", ir_target);
|
AC_DEFINE('HAVE_JIT', 1, 'Define to 1 to enable JIT.');
|
||||||
DEFINE("DASM_FLAGS", dasm_flags);
|
|
||||||
DEFINE("DASM_ARCH", "x86");
|
|
||||||
DEFINE("TLS_TARGET", "win");
|
|
||||||
|
|
||||||
AC_DEFINE('HAVE_JIT', 1, 'Define to 1 to enable JIT.');
|
ADD_FLAG("CFLAGS_OPCACHE", "/I \"ext\\opcache\\jit\\ir\" /D "+ir_target+" /D IR_PHP");
|
||||||
|
if (PHP_DEBUG == "yes") {
|
||||||
|
ADD_FLAG("CFLAGS_OPCACHE", "/D IR_DEBUG");
|
||||||
|
}
|
||||||
|
|
||||||
ADD_FLAG("CFLAGS_OPCACHE", "/I \"ext\\opcache\\jit\\ir\" /D "+ir_target+" /D IR_PHP");
|
if (CHECK_HEADER_ADD_INCLUDE("capstone\\capstone.h", "CFLAGS_OPCACHE", PHP_OPCACHE+ ";" + PHP_PHP_BUILD + "\\include") &&
|
||||||
if (PHP_DEBUG == "yes") {
|
CHECK_LIB("capstone.lib", "opcache", PHP_OPCACHE)) {
|
||||||
ADD_FLAG("CFLAGS_OPCACHE", "/D IR_DEBUG");
|
AC_DEFINE('HAVE_CAPSTONE', 1, 'Define to 1 if Capstone is available.');
|
||||||
}
|
ir_src += " ir_disasm.c";
|
||||||
|
}
|
||||||
|
|
||||||
if (CHECK_HEADER_ADD_INCLUDE("capstone\\capstone.h", "CFLAGS_OPCACHE", PHP_OPCACHE+ ";" + PHP_PHP_BUILD + "\\include") &&
|
ADD_MAKEFILE_FRAGMENT(configure_module_dirname + "\\jit\\Makefile.frag.w32");
|
||||||
CHECK_LIB("capstone.lib", "opcache", PHP_OPCACHE)) {
|
|
||||||
AC_DEFINE('HAVE_CAPSTONE', 1, 'Define to 1 if Capstone is available.');
|
|
||||||
ir_src += " ir_disasm.c";
|
|
||||||
}
|
|
||||||
|
|
||||||
ADD_MAKEFILE_FRAGMENT(configure_module_dirname + "\\jit\\Makefile.frag.w32");
|
ADD_SOURCES(configure_module_dirname + "\\jit",
|
||||||
|
"zend_jit.c zend_jit_vm_helpers.c",
|
||||||
ADD_SOURCES(configure_module_dirname + "\\jit",
|
"opcache", "ext\\opcache\\jit");
|
||||||
"zend_jit.c zend_jit_vm_helpers.c",
|
if (PHP_ZTS == "yes") {
|
||||||
"opcache", "ext\\opcache\\jit");
|
ADD_SOURCES(configure_module_dirname + "\\jit\\tls",
|
||||||
if (PHP_ZTS == "yes") {
|
|
||||||
ADD_SOURCES(configure_module_dirname + "\\jit\\tls",
|
|
||||||
"zend_jit_tls_win.c",
|
"zend_jit_tls_win.c",
|
||||||
"opcache", "ext\\opcache\\jit\\tls");
|
"opcache", "ext\\opcache\\jit\\tls");
|
||||||
}
|
|
||||||
ADD_SOURCES(configure_module_dirname + "\\jit\\ir",
|
|
||||||
"ir.c", "opcache", "ext\\opcache\\jit\\ir");
|
|
||||||
ADD_SOURCES(configure_module_dirname + "\\jit\\ir",
|
|
||||||
"ir_emit.c", "opcache", "ext\\opcache\\jit\\ir");
|
|
||||||
ADD_SOURCES(configure_module_dirname + "\\jit\\ir",
|
|
||||||
ir_src, "opcache", "ext\\opcache\\jit\\ir");
|
|
||||||
} else {
|
|
||||||
WARNING("JIT not enabled, headers not found");
|
|
||||||
}
|
}
|
||||||
|
ADD_SOURCES(configure_module_dirname + "\\jit\\ir",
|
||||||
|
"ir.c", "opcache", "ext\\opcache\\jit\\ir");
|
||||||
|
ADD_SOURCES(configure_module_dirname + "\\jit\\ir",
|
||||||
|
"ir_emit.c", "opcache", "ext\\opcache\\jit\\ir");
|
||||||
|
ADD_SOURCES(configure_module_dirname + "\\jit\\ir",
|
||||||
|
ir_src, "opcache", "ext\\opcache\\jit\\ir");
|
||||||
|
} else {
|
||||||
|
WARNING("JIT not enabled, headers not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
ADD_FLAG('CFLAGS_OPCACHE', "/I " + configure_module_dirname);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ADD_FLAG('CFLAGS_OPCACHE', "/I " + configure_module_dirname);
|
||||||
|
|
|
@ -12,4 +12,4 @@ ADD . /php-src/
|
||||||
WORKDIR /php-src
|
WORKDIR /php-src
|
||||||
RUN ./buildconf
|
RUN ./buildconf
|
||||||
# Compile a minimal debug build. --enable-debug adds runtime assertions and is slower than regular builds.
|
# Compile a minimal debug build. --enable-debug adds runtime assertions and is slower than regular builds.
|
||||||
RUN ./configure --enable-debug --disable-all --enable-opcache && make clean && make -j$(nproc)
|
RUN ./configure --enable-debug --disable-all && make clean && make -j$(nproc)
|
||||||
|
|
|
@ -76,7 +76,7 @@ export LDFLAGS=-L/usr/lib/i386-linux-gnu
|
||||||
export CFLAGS='-m32'
|
export CFLAGS='-m32'
|
||||||
export CXXFLAGS='-m32'
|
export CXXFLAGS='-m32'
|
||||||
export PKG_CONFIG=/usr/bin/i686-linux-gnu-pkg-config
|
export PKG_CONFIG=/usr/bin/i686-linux-gnu-pkg-config
|
||||||
./configure --disable-all --enable-opcache --build=i686-pc-linux-gnu
|
./configure --disable-all --build=i686-pc-linux-gnu
|
||||||
make -j$(nproc)
|
make -j$(nproc)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,6 @@ $proc = proc_open([
|
||||||
PHP_BINARY,
|
PHP_BINARY,
|
||||||
"-n",
|
"-n",
|
||||||
"-d", "extension_dir=$extension_dir",
|
"-d", "extension_dir=$extension_dir",
|
||||||
"-d", "zend_extension=opcache",
|
|
||||||
"-d", "opcache.memory_consumption=$new_memory_consumption",
|
"-d", "opcache.memory_consumption=$new_memory_consumption",
|
||||||
"-d", "opcache.enable=1",
|
"-d", "opcache.enable=1",
|
||||||
"-d", "opcache.enable_cli=1",
|
"-d", "opcache.enable_cli=1",
|
||||||
|
|
|
@ -25,6 +25,8 @@
|
||||||
#include "ZendAccelerator.h"
|
#include "ZendAccelerator.h"
|
||||||
#include "zend_API.h"
|
#include "zend_API.h"
|
||||||
#include "zend_closures.h"
|
#include "zend_closures.h"
|
||||||
|
#include "zend_extensions.h"
|
||||||
|
#include "zend_modules.h"
|
||||||
#include "zend_shared_alloc.h"
|
#include "zend_shared_alloc.h"
|
||||||
#include "zend_accelerator_blacklist.h"
|
#include "zend_accelerator_blacklist.h"
|
||||||
#include "zend_file_cache.h"
|
#include "zend_file_cache.h"
|
||||||
|
@ -432,13 +434,19 @@ static ZEND_NAMED_FUNCTION(accel_is_readable)
|
||||||
|
|
||||||
static ZEND_MINIT_FUNCTION(zend_accelerator)
|
static ZEND_MINIT_FUNCTION(zend_accelerator)
|
||||||
{
|
{
|
||||||
(void)type; /* keep the compiler happy */
|
start_accel_extension();
|
||||||
|
|
||||||
REGISTER_INI_ENTRIES();
|
|
||||||
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void zend_accel_register_ini_entries(void)
|
||||||
|
{
|
||||||
|
zend_module_entry *module = zend_hash_str_find_ptr_lc(&module_registry,
|
||||||
|
ACCELERATOR_PRODUCT_NAME, strlen(ACCELERATOR_PRODUCT_NAME));
|
||||||
|
|
||||||
|
zend_register_ini_entries_ex(ini_entries, module->module_number, module->type);
|
||||||
|
}
|
||||||
|
|
||||||
void zend_accel_override_file_functions(void)
|
void zend_accel_override_file_functions(void)
|
||||||
{
|
{
|
||||||
zend_function *old_function;
|
zend_function *old_function;
|
||||||
|
@ -469,6 +477,7 @@ static ZEND_MSHUTDOWN_FUNCTION(zend_accelerator)
|
||||||
|
|
||||||
UNREGISTER_INI_ENTRIES();
|
UNREGISTER_INI_ENTRIES();
|
||||||
accel_shutdown();
|
accel_shutdown();
|
||||||
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -581,7 +590,7 @@ void zend_accel_info(ZEND_MODULE_INFO_FUNC_ARGS)
|
||||||
DISPLAY_INI_ENTRIES();
|
DISPLAY_INI_ENTRIES();
|
||||||
}
|
}
|
||||||
|
|
||||||
static zend_module_entry accel_module_entry = {
|
zend_module_entry opcache_module_entry = {
|
||||||
STANDARD_MODULE_HEADER,
|
STANDARD_MODULE_HEADER,
|
||||||
ACCELERATOR_PRODUCT_NAME,
|
ACCELERATOR_PRODUCT_NAME,
|
||||||
ext_functions,
|
ext_functions,
|
||||||
|
@ -596,11 +605,6 @@ static zend_module_entry accel_module_entry = {
|
||||||
STANDARD_MODULE_PROPERTIES_EX
|
STANDARD_MODULE_PROPERTIES_EX
|
||||||
};
|
};
|
||||||
|
|
||||||
int start_accel_module(void)
|
|
||||||
{
|
|
||||||
return zend_startup_module(&accel_module_entry);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* {{{ Get the scripts which are accelerated by ZendAccelerator */
|
/* {{{ Get the scripts which are accelerated by ZendAccelerator */
|
||||||
static int accelerator_get_scripts(zval *return_value)
|
static int accelerator_get_scripts(zval *return_value)
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,7 +22,12 @@
|
||||||
#ifndef ZEND_ACCELERATOR_MODULE_H
|
#ifndef ZEND_ACCELERATOR_MODULE_H
|
||||||
#define ZEND_ACCELERATOR_MODULE_H
|
#define ZEND_ACCELERATOR_MODULE_H
|
||||||
|
|
||||||
int start_accel_module(void);
|
#include "Zend/zend_modules.h"
|
||||||
|
|
||||||
|
#define phpext_opcache_ptr &opcache_module_entry
|
||||||
|
extern zend_module_entry opcache_module_entry;
|
||||||
|
|
||||||
|
void zend_accel_register_ini_entries(void);
|
||||||
|
|
||||||
void zend_accel_override_file_functions(void);
|
void zend_accel_override_file_functions(void);
|
||||||
|
|
||||||
|
|
|
@ -965,8 +965,6 @@ default_socket_timeout = 60
|
||||||
;extension=xsl
|
;extension=xsl
|
||||||
;extension=zip
|
;extension=zip
|
||||||
|
|
||||||
;zend_extension=opcache
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;
|
||||||
; Module Settings ;
|
; Module Settings ;
|
||||||
;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
|
@ -967,8 +967,6 @@ default_socket_timeout = 60
|
||||||
;extension=xsl
|
;extension=xsl
|
||||||
;extension=zip
|
;extension=zip
|
||||||
|
|
||||||
;zend_extension=opcache
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;
|
||||||
; Module Settings ;
|
; Module Settings ;
|
||||||
;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
|
@ -17,7 +17,6 @@ if (!file_exists($extDir . '/opcache.so')) {
|
||||||
$cmd = [
|
$cmd = [
|
||||||
PHP_BINARY,
|
PHP_BINARY,
|
||||||
'-dextension_dir=' . ini_get('extension_dir'),
|
'-dextension_dir=' . ini_get('extension_dir'),
|
||||||
'-dzend_extension=opcache.so',
|
|
||||||
'-dopcache.enable=1',
|
'-dopcache.enable=1',
|
||||||
'-dopcache.enable_cli=1',
|
'-dopcache.enable_cli=1',
|
||||||
'-dopcache.preload=' . __DIR__ . '/preload.inc',
|
'-dopcache.preload=' . __DIR__ . '/preload.inc',
|
||||||
|
|
|
@ -31,8 +31,8 @@ When running `make` it creates these binaries in `sapi/fuzzer/`:
|
||||||
* `php-fuzz-mbstring`: Fuzzing `mb_convert_encoding()` (requires `--enable-mbstring`)
|
* `php-fuzz-mbstring`: Fuzzing `mb_convert_encoding()` (requires `--enable-mbstring`)
|
||||||
* `php-fuzz-mbregex`: Fuzzing `mb_ereg[i]()` (requires --enable-mbstring)
|
* `php-fuzz-mbregex`: Fuzzing `mb_ereg[i]()` (requires --enable-mbstring)
|
||||||
* `php-fuzz-execute`: Fuzzing the executor
|
* `php-fuzz-execute`: Fuzzing the executor
|
||||||
* `php-fuzz-function-jit`: Fuzzing the function JIT (requires --enable-opcache)
|
* `php-fuzz-function-jit`: Fuzzing the function JIT
|
||||||
* `php-fuzz-tracing-jit`: Fuzzing the tracing JIT (requires --enable-opcache)
|
* `php-fuzz-tracing-jit`: Fuzzing the tracing JIT
|
||||||
|
|
||||||
Some fuzzers have a seed corpus in `sapi/fuzzer/corpus`. You can use it as follows:
|
Some fuzzers have a seed corpus in `sapi/fuzzer/corpus`. You can use it as follows:
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue