Skip to content

Commit 5ee6420

Browse files
committed
Merge branch 'required-opcache' into static-opcache-tls-with-required-opcache
* required-opcache: Fix expectations in version string tests Remove `--enable-opcache` Remove `zend_extension=opcache` Make OPcache non-optional
2 parents 6e09776 + 85bb568 commit 5ee6420

File tree

22 files changed

+168
-212
lines changed

22 files changed

+168
-212
lines changed

‎.circleci/config.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ jobs:
9090
--prefix=/usr \
9191
--enable-phpdbg \
9292
--enable-fpm \
93-
--enable-opcache \
9493
--with-pdo-mysql=mysqlnd \
9594
--with-mysqli=mysqlnd \
9695
--with-pgsql \
@@ -168,7 +167,6 @@ jobs:
168167
no_output_timeout: 30m
169168
command: |
170169
sapi/cli/php run-tests.php \
171-
-d zend_extension=opcache.so \
172170
-d opcache.enable_cli=1 \
173171
-d opcache.jit_buffer_size=64M \
174172
-d opcache.jit=tracing \

‎.github/actions/freebsd/action.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ runs:
103103
--show-diff \
104104
--show-slow 1000 \
105105
--set-timeout 120 \
106-
-d zend_extension=opcache.so
107106
108107
export TLSC=$(pwd)/ext/opcache/jit/tls/zend_jit_tls_x86_64.c
109108
./ext/opcache/jit/tls/testing/test.sh

‎.github/scripts/windows/test_task.bat

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ mkdir %PHP_BUILD_DIR%\test_file_cache
128128
rem generate php.ini
129129
echo extension_dir=%PHP_BUILD_DIR% > %PHP_BUILD_DIR%\php.ini
130130
echo opcache.file_cache=%PHP_BUILD_DIR%\test_file_cache >> %PHP_BUILD_DIR%\php.ini
131-
if "%OPCACHE%" equ "1" echo zend_extension=php_opcache.dll >> %PHP_BUILD_DIR%\php.ini
132131
rem work-around for some spawned PHP processes requiring OpenSSL and sockets
133132
echo extension=php_openssl.dll >> %PHP_BUILD_DIR%\php.ini
134133
echo extension=php_sockets.dll >> %PHP_BUILD_DIR%\php.ini

‎.github/workflows/nightly.yml

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ jobs:
126126
jitType: tracing
127127
runTestsParameters: >-
128128
--asan -x
129-
-d zend_extension=opcache.so
130129
-d opcache.enable_cli=1
131130
- name: Test TLS resolution
132131
uses: ./.github/actions/test-tls-alpine
@@ -242,14 +241,12 @@ jobs:
242241
jitType: tracing
243242
runTestsParameters: >-
244243
${{ matrix.run_tests_parameters }}
245-
-d zend_extension=opcache.so
246244
-d opcache.enable_cli=1
247245
- name: Test OpCache
248246
uses: ./.github/actions/test-linux
249247
with:
250248
runTestsParameters: >-
251249
${{ matrix.run_tests_parameters }}
252-
-d zend_extension=opcache.so
253250
-d opcache.enable_cli=1
254251
- name: Test Function JIT
255252
# ASAN frequently timeouts. Each test run takes ~90 minutes, we can
@@ -260,7 +257,6 @@ jobs:
260257
jitType: function
261258
runTestsParameters: >-
262259
${{ matrix.run_tests_parameters }}
263-
-d zend_extension=opcache.so
264260
-d opcache.enable_cli=1
265261
- name: Test TLS resolution
266262
if: matrix.debug && matrix.zts && !matrix.asan
@@ -337,22 +333,19 @@ jobs:
337333
jitType: tracing
338334
runTestsParameters: >-
339335
${{ matrix.run_tests_parameters }}
340-
-d zend_extension=opcache.so
341336
-d opcache.enable_cli=1
342337
- name: Test OpCache
343338
uses: ./.github/actions/test-linux
344339
with:
345340
runTestsParameters: >-
346341
${{ matrix.run_tests_parameters }}
347-
-d zend_extension=opcache.so
348342
-d opcache.enable_cli=1
349343
- name: Test Function JIT
350344
uses: ./.github/actions/test-linux
351345
with:
352346
jitType: function
353347
runTestsParameters: >-
354348
${{ matrix.run_tests_parameters }}
355-
-d zend_extension=opcache.so
356349
-d opcache.enable_cli=1
357350
- name: Test TLS resolution
358351
if: matrix.debug && matrix.zts
@@ -400,21 +393,18 @@ jobs:
400393
with:
401394
jitType: tracing
402395
runTestsParameters: >-
403-
-d zend_extension=opcache.so
404396
-d opcache.enable_cli=1
405397
- name: Test OpCache
406398
uses: ./.github/actions/test-macos
407399
with:
408400
runTestsParameters: >-
409-
-d zend_extension=opcache.so
410401
-d opcache.enable_cli=1
411402
- name: Test Function JIT
412403
if: matrix.os != '14' || !matrix.zts
413404
uses: ./.github/actions/test-macos
414405
with:
415406
jitType: function
416407
runTestsParameters: >-
417-
-d zend_extension=opcache.so
418408
-d opcache.enable_cli=1
419409
- name: Test TLS resolution
420410
# JIT+ZTS not supported yet on ARM64
@@ -480,7 +470,6 @@ jobs:
480470
with:
481471
jitType: tracing
482472
runTestsParameters: >-
483-
-d zend_extension=opcache.so
484473
-d opcache.enable_cli=1
485474
- uses: codecov/codecov-action@v4
486475
if: ${{ !cancelled() }}
@@ -534,7 +523,6 @@ jobs:
534523
- name: Enable Opcache
535524
run: |
536525
echo memory_limit=-1 >> /etc/php.d/opcache.ini
537-
echo zend_extension=opcache.so > /etc/php.d/opcache.ini
538526
echo opcache.enable_cli=1 >> /etc/php.d/opcache.ini
539527
echo opcache.enable=1 >> /etc/php.d/opcache.ini
540528
echo opcache.protect_memory=1 >> /etc/php.d/opcache.ini
@@ -725,37 +713,32 @@ jobs:
725713
uses: ./.github/actions/test-linux
726714
with:
727715
runTestsParameters: >-
728-
-d zend_extension=opcache.so
729716
-d opcache.enable_cli=1
730717
--file-cache-prime
731718
- name: Test File Cache (prime shm, use shm)
732719
uses: ./.github/actions/test-linux
733720
with:
734721
runTestsParameters: >-
735-
-d zend_extension=opcache.so
736722
-d opcache.enable_cli=1
737723
--file-cache-use
738724
- name: Test File Cache (prime shm, use file)
739725
uses: ./.github/actions/test-linux
740726
with:
741727
runTestsParameters: >-
742-
-d zend_extension=opcache.so
743728
-d opcache.enable_cli=1
744729
--file-cache-use
745730
-d opcache.file_cache_only=1
746731
- name: Test File Cache Only (prime)
747732
uses: ./.github/actions/test-linux
748733
with:
749734
runTestsParameters: >-
750-
-d zend_extension=opcache.so
751735
-d opcache.enable_cli=1
752736
--file-cache-prime
753737
-d opcache.file_cache_only=1
754738
- name: Test File Cache Only (use)
755739
uses: ./.github/actions/test-linux
756740
with:
757741
runTestsParameters: >-
758-
-d zend_extension=opcache.so
759742
-d opcache.enable_cli=1
760743
--file-cache-use
761744
-d opcache.file_cache_only=1
@@ -849,7 +832,6 @@ jobs:
849832
with:
850833
runTestsParameters: >-
851834
--msan
852-
-d zend_extension=opcache.so
853835
-d opcache.enable_cli=1
854836
- name: Verify generated files are up to date
855837
uses: ./.github/actions/verify-generated-files

‎.github/workflows/push.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ jobs:
130130
with:
131131
jitType: tracing
132132
runTestsParameters: >-
133-
-d zend_extension=opcache.so
134133
-d opcache.enable_cli=1
135134
${{ matrix.asan && '--asan -x' || '' }}
136135
- name: Verify generated files are up to date
@@ -190,7 +189,6 @@ jobs:
190189
with:
191190
jitType: tracing
192191
runTestsParameters: >-
193-
-d zend_extension=opcache.so
194192
-d opcache.enable_cli=1
195193
MACOS_DEBUG_NTS:
196194
if: github.repository == 'php/php-src' || github.event_name == 'pull_request'
@@ -229,7 +227,6 @@ jobs:
229227
with:
230228
jitType: tracing
231229
runTestsParameters: >-
232-
-d zend_extension=opcache.so
233230
-d opcache.enable_cli=1
234231
- name: Verify generated files are up to date
235232
uses: ./.github/actions/verify-generated-files
@@ -299,7 +296,6 @@ jobs:
299296
./configure \
300297
--disable-debug \
301298
--enable-mbstring \
302-
--enable-opcache \
303299
--enable-option-checking=fatal \
304300
--enable-sockets \
305301
--enable-werror \
@@ -319,7 +315,6 @@ jobs:
319315
sudo mkdir -p /etc/php.d
320316
sudo chmod 777 /etc/php.d
321317
echo mysqli.default_socket=/var/run/mysqld/mysqld.sock > /etc/php.d/mysqli.ini
322-
echo zend_extension=opcache.so >> /etc/php.d/opcache.ini
323318
echo opcache.enable=1 >> /etc/php.d/opcache.ini
324319
echo opcache.enable_cli=1 >> /etc/php.d/opcache.ini
325320
- name: Setup

‎docs/release-process.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,15 +209,15 @@ slightly different steps. We'll call attention where the steps differ.
209209
# With ZTS
210210
make distclean || \
211211
./buildconf --force \
212-
&& ./configure --enable-zts --disable-all --enable-debug --enable-opcache --enable-opcache-jit \
212+
&& ./configure --enable-zts --disable-all --enable-debug --enable-opcache-jit \
213213
&& make -j$(nproc) \
214214
&& make test TEST_PHP_ARGS="-q -j$(nproc)" \
215215
|| ./sapi/cli/php -v
216216
217217
# Without ZTS
218218
make distclean || \
219219
./buildconf --force \
220-
&& ./configure --disable-all --enable-debug --enable-opcache --enable-opcache-jit \
220+
&& ./configure --disable-all --enable-debug --enable-opcache-jit \
221221
&& make -j$(nproc) \
222222
&& make test TEST_PHP_ARGS="-q -j$(nproc)" \
223223
|| ./sapi/cli/php -v
@@ -528,15 +528,15 @@ slightly different steps. We'll call attention where the steps differ.
528528
# With ZTS
529529
make distclean || \
530530
./buildconf --force \
531-
&& ./configure --enable-zts --disable-all --enable-debug --enable-opcache --enable-opcache-jit \
531+
&& ./configure --enable-zts --disable-all --enable-debug --enable-opcache-jit \
532532
&& make -j$(nproc) \
533533
&& make test TEST_PHP_ARGS="-q -j$(nproc)" \
534534
|| ./sapi/cli/php -v
535535
536536
# Without ZTS
537537
make distclean || \
538538
./buildconf --force \
539-
&& ./configure --disable-all --enable-debug --enable-opcache --enable-opcache-jit \
539+
&& ./configure --disable-all --enable-debug --enable-opcache-jit \
540540
&& make -j$(nproc) \
541541
&& make test TEST_PHP_ARGS="-q -j$(nproc)" \
542542
|| ./sapi/cli/php -v

‎ext/opcache/ZendAccelerator.c

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "zend_extensions.h"
2626
#include "zend_compile.h"
2727
#include "ZendAccelerator.h"
28+
#include "zend_modules.h"
2829
#include "zend_persist.h"
2930
#include "zend_shared_alloc.h"
3031
#include "zend_accelerator_module.h"
@@ -102,15 +103,12 @@ typedef int gid_t;
102103

103104
#include "zend_simd.h"
104105

105-
ZEND_EXTENSION();
106+
static zend_extension opcache_extension_entry;
106107

107108
#ifndef ZTS
108109
zend_accel_globals accel_globals;
109110
#else
110111
int accel_globals_id;
111-
#if defined(COMPILE_DL_OPCACHE)
112-
ZEND_TSRMLS_CACHE_DEFINE()
113-
#endif
114112
#endif
115113

116114
/* Points to the structure shared across all PHP processes */
@@ -2969,9 +2967,6 @@ static zend_result zend_accel_init_shm(void)
29692967

29702968
static void accel_globals_ctor(zend_accel_globals *accel_globals)
29712969
{
2972-
#if defined(COMPILE_DL_OPCACHE) && defined(ZTS)
2973-
ZEND_TSRMLS_CACHE_UPDATE();
2974-
#endif
29752970
memset(accel_globals, 0, sizeof(zend_accel_globals));
29762971
accel_globals->key = zend_string_alloc(ZCG_KEY_LEN, true);
29772972
GC_MAKE_PERSISTENT_LOCAL(accel_globals->key);
@@ -3156,6 +3151,11 @@ static void accel_move_code_to_huge_pages(void)
31563151
# endif /* defined(MAP_HUGETLB) || defined(MADV_HUGEPAGE) */
31573152
#endif /* HAVE_HUGE_CODE_PAGES */
31583153

3154+
void start_accel_extension(void)
3155+
{
3156+
zend_register_extension(&opcache_extension_entry, NULL);
3157+
}
3158+
31593159
static int accel_startup(zend_extension *extension)
31603160
{
31613161
#ifdef ZTS
@@ -3174,11 +3174,7 @@ static int accel_startup(zend_extension *extension)
31743174
# endif
31753175
#endif
31763176

3177-
if (start_accel_module() == FAILURE) {
3178-
accel_startup_ok = false;
3179-
zend_error(E_WARNING, ACCELERATOR_PRODUCT_NAME ": module registration failed!");
3180-
return FAILURE;
3181-
}
3177+
zend_accel_register_ini_entries();
31823178

31833179
#ifdef ZEND_WIN32
31843180
if (UNEXPECTED(accel_gen_uname_id() == FAILURE)) {
@@ -5084,7 +5080,7 @@ static void accel_activate(void) {
50845080
}
50855081
}
50865082

5087-
ZEND_EXT_API zend_extension zend_extension_entry = {
5083+
static zend_extension opcache_extension_entry = {
50885084
ACCELERATOR_PRODUCT_NAME, /* name */
50895085
PHP_VERSION, /* version */
50905086
"Zend Technologies", /* author */

‎ext/opcache/ZendAccelerator.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,9 +302,6 @@ extern zend_accel_shared_globals *accel_shared_globals;
302302
#ifdef ZTS
303303
# define ZCG(v) ZEND_TSRMG(accel_globals_id, zend_accel_globals *, v)
304304
extern int accel_globals_id;
305-
# ifdef COMPILE_DL_OPCACHE
306-
ZEND_TSRMLS_CACHE_EXTERN()
307-
# endif
308305
#else
309306
# define ZCG(v) (accel_globals.v)
310307
extern zend_accel_globals accel_globals;
@@ -314,6 +311,7 @@ extern const char *zps_api_failure_reason;
314311

315312
BEGIN_EXTERN_C()
316313

314+
void start_accel_extension(void);
317315
void accel_shutdown(void);
318316
ZEND_RINIT_FUNCTION(zend_accelerator);
319317
zend_result accel_post_deactivate(void);

0 commit comments

Comments
 (0)