Skip to content

Commit 1b9f536

Browse files
committed
Change default method of disabling JIT
1 parent 3db87ea commit 1b9f536

File tree

6 files changed

+15
-7
lines changed

6 files changed

+15
-7
lines changed

UPGRADING

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ PHP 8.4 UPGRADE NOTES
6969
. The typed properties XSLTProcessor::$cloneDocument and
7070
XSLTProcessor::$doXInclude are now declared.
7171

72+
- Opcache:
73+
. JIT config defaults changed from `opcache.jit=tracing`, `opcache.jit_buffer_size=0` to `opcache.jit=disable`, `opcache.jit_buffer_size=64M`: this does not change the default behavior, JIT was and still is disabled by default, however now it is now disabled by default using the `opcache.jit` setting, not the `opcache.jit_buffer_size` setting.
74+
This may affect users who enabled JIT by only setting a different `opcache.jit_buffer_size`, without specifying a JIT mode with `opcache.jit`.
75+
To enable JIT, it is now required to populate the `opcache.jit` config value.
76+
7277
========================================
7378
2. New Features
7479
========================================

benchmark/benchmark.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ function runValgrindPhpCgiCommand(
118118
'-T' . ($warmup ? $warmup . ',' : '') . $repeat,
119119
'-d max_execution_time=0',
120120
'-d opcache.enable=1',
121+
'-d opcache.jit=tracing',
121122
'-d opcache.jit_buffer_size=' . ($jit ? '128M' : '0'),
122123
'-d opcache.validate_timestamps=0',
123124
...$args,

ext/opcache/ZendAccelerator.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3249,13 +3249,14 @@ static zend_result accel_post_startup(void)
32493249
#ifdef HAVE_JIT
32503250
if (JIT_G(enabled)) {
32513251
if (JIT_G(buffer_size) == 0) {
3252-
JIT_G(enabled) = false;
3253-
JIT_G(on) = false;
3254-
} else if (!ZSMMG(reserved)) {
3252+
zend_accel_error_noreturn(ACCEL_LOG_FATAL, "Could not enable JIT: the buffer size is 0, please disable JIT using opcache.jit=disable!");
3253+
}
3254+
3255+
if (!ZSMMG(reserved)) {
32553256
zend_accel_error_noreturn(ACCEL_LOG_FATAL, "Could not enable JIT: could not use reserved buffer!");
3256-
} else {
3257-
zend_jit_startup(ZSMMG(reserved), jit_size, reattached);
32583257
}
3258+
3259+
zend_jit_startup(ZSMMG(reserved), jit_size, reattached);
32593260
}
32603261
#endif
32613262
zend_shared_alloc_save_state();

ext/opcache/jit/zend_jit.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
#define ZEND_JIT_REG_ALLOC_GLOBAL (1<<1) /* global linear scan register allocation */
4848
#define ZEND_JIT_CPU_AVX (1<<2) /* use AVX instructions, if available */
4949

50-
#define ZEND_JIT_DEFAULT_BUFFER_SIZE "0"
50+
#define ZEND_JIT_DEFAULT_BUFFER_SIZE "64m"
5151

5252
#define ZEND_JIT_COUNTER_INIT 32531
5353

ext/opcache/zend_accelerator_module.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ ZEND_INI_BEGIN()
317317
STD_PHP_INI_ENTRY("opcache.cache_id" , "" , PHP_INI_SYSTEM, OnUpdateString, accel_directives.cache_id, zend_accel_globals, accel_globals)
318318
#endif
319319
#ifdef HAVE_JIT
320-
STD_PHP_INI_ENTRY("opcache.jit" , "tracing", PHP_INI_ALL, OnUpdateJit, options, zend_jit_globals, jit_globals)
320+
STD_PHP_INI_ENTRY("opcache.jit" , "disable", PHP_INI_ALL, OnUpdateJit, options, zend_jit_globals, jit_globals)
321321
STD_PHP_INI_ENTRY("opcache.jit_buffer_size" , ZEND_JIT_DEFAULT_BUFFER_SIZE, PHP_INI_SYSTEM, OnUpdateLong, buffer_size, zend_jit_globals, jit_globals)
322322
STD_PHP_INI_ENTRY("opcache.jit_debug" , "0", PHP_INI_ALL, OnUpdateJitDebug, debug, zend_jit_globals, jit_globals)
323323
STD_PHP_INI_ENTRY("opcache.jit_bisect_limit" , "0", PHP_INI_ALL, OnUpdateLong, bisect_limit, zend_jit_globals, jit_globals)

ext/phar/tests/024-opcache-win32.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ opcache.file_cache={PWD}/024-file_cache
1717
opcache.memory_consumption=64
1818
opcache.interned_strings_buffer=8
1919
opcache.max_accelerated_files=4000
20+
opcache.jit=tracing
2021
opcache.jit_buffer_size=64M
2122
opcache.revalidate_freq=60
2223
opcache.fast_shutdown=1

0 commit comments

Comments
 (0)