Skip to content

Commit 5652be1

Browse files
committed
Change default method of disabling JIT
1 parent 40908f3 commit 5652be1

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
@@ -111,6 +111,18 @@ PHP 8.4 UPGRADE NOTES
111111
contain null bytes. This never actually worked correctly in the first place,
112112
which is why it throws an exception nowadays.
113113

114+
- Opcache:
115+
. JIT config defaults changed from
116+
`opcache.jit=tracing`, `opcache.jit_buffer_size=0` to
117+
`opcache.jit=disable`, `opcache.jit_buffer_size=64M`:
118+
this does not change the default behavior,
119+
JIT was and still is disabled by default, however
120+
now it is now disabled by default
121+
using the `opcache.jit` setting, not the `opcache.jit_buffer_size` setting.
122+
This may affect users who enabled JIT by only setting a different
123+
`opcache.jit_buffer_size`, without specifying a JIT mode in `opcache.jit`.
124+
To enable JIT, it is now required to populate the `opcache.jit` config value.
125+
114126
========================================
115127
2. New Features
116128
========================================

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
@@ -3254,9 +3254,10 @@ static zend_result accel_post_startup(void)
32543254
if (JIT_G(buffer_size) == 0) {
32553255
JIT_G(enabled) = false;
32563256
JIT_G(on) = false;
3257-
} else if (!ZSMMG(reserved)) {
3258-
zend_accel_error_noreturn(ACCEL_LOG_FATAL, "Could not enable JIT: could not use reserved buffer!");
32593257
} else {
3258+
if (!ZSMMG(reserved)) {
3259+
zend_accel_error_noreturn(ACCEL_LOG_FATAL, "Could not enable JIT: could not use reserved buffer!");
3260+
}
32603261
zend_jit_startup(ZSMMG(reserved), jit_size, reattached);
32613262
}
32623263
}

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)