Skip to content

Commit 7712504

Browse files
committed
Change default method of disabling JIT
1 parent 175b438 commit 7712504

File tree

6 files changed

+20
-5
lines changed

6 files changed

+20
-5
lines changed

UPGRADING

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,18 @@ PHP 8.4 UPGRADE NOTES
8383
contain null bytes. This never actually worked correctly in the first place,
8484
which is why it throws an exception nowadays.
8585

86+
- Opcache:
87+
. JIT config defaults changed from
88+
`opcache.jit=tracing`, `opcache.jit_buffer_size=0` to
89+
`opcache.jit=disable`, `opcache.jit_buffer_size=64M`:
90+
this does not change the default behavior,
91+
JIT was and still is disabled by default, however
92+
now it is now disabled by default
93+
using the `opcache.jit` setting, not the `opcache.jit_buffer_size` setting.
94+
This may affect users who enabled JIT by only setting a different
95+
`opcache.jit_buffer_size`, without specifying a JIT mode in `opcache.jit`.
96+
To enable JIT, it is now required to populate the `opcache.jit` config value.
97+
8698
========================================
8799
2. New Features
88100
========================================

benchmark/benchmark.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ function runValgrindPhpCgiCommand(
118118
'-T' . ($warmup ? $warmup . ',' : '') . $repeat,
119119
'-d max_execution_time=0',
120120
'-d opcache.enable=1',
121-
'-d opcache.jit_buffer_size=' . ($jit ? '128M' : '0'),
121+
'-d opcache.jit=' . ($jit ? 'tracing' : 'disable'),
122+
'-d opcache.jit_buffer_size=128M',
122123
'-d opcache.validate_timestamps=0',
123124
...$args,
124125
]);

ext/opcache/ZendAccelerator.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3251,9 +3251,10 @@ static zend_result accel_post_startup(void)
32513251
if (JIT_G(buffer_size) == 0) {
32523252
JIT_G(enabled) = false;
32533253
JIT_G(on) = false;
3254-
} else if (!ZSMMG(reserved)) {
3255-
zend_accel_error_noreturn(ACCEL_LOG_FATAL, "Could not enable JIT: could not use reserved buffer!");
32563254
} else {
3255+
if (!ZSMMG(reserved)) {
3256+
zend_accel_error_noreturn(ACCEL_LOG_FATAL, "Could not enable JIT: could not use reserved buffer!");
3257+
}
32573258
zend_jit_startup(ZSMMG(reserved), jit_size, reattached);
32583259
}
32593260
}

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)