diff --git a/ext/opcache/jit/zend_jit.c b/ext/opcache/jit/zend_jit.c index 679b7db269f9..67e3e741551b 100644 --- a/ext/opcache/jit/zend_jit.c +++ b/ext/opcache/jit/zend_jit.c @@ -3124,6 +3124,8 @@ static int zend_jit_restart_hot_counters(zend_op_array *op_array) uint32_t i; jit_extension = (zend_jit_op_array_hot_extension*)ZEND_FUNC_INFO(op_array); + /* The JIT-ed code is gone, so allow compiling it again */ + jit_extension->func_info.flags &= ~ZEND_FUNC_JITED; for (i = 0; i < op_array->last; i++) { op_array->opcodes[i].handler = jit_extension->orig_handlers[i]; } diff --git a/ext/opcache/tests/jit/preload_restart_hot_counters.phpt b/ext/opcache/tests/jit/preload_restart_hot_counters.phpt new file mode 100644 index 000000000000..8f6af56b1671 --- /dev/null +++ b/ext/opcache/tests/jit/preload_restart_hot_counters.phpt @@ -0,0 +1,76 @@ +--TEST-- +Preloaded functions JIT-compiled by hot counters must be JIT-compiled again after an OPcache restart +--EXTENSIONS-- +opcache +--SKIPIF-- + +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.jit=1235 +opcache.jit_buffer_size=16M +--CONFLICTS-- +server +--FILE-- +> 2); + } + return $s; +} +PHP); + +/* A dynamic call keeps the function out of the call graph of the calling script */ +file_put_contents($dir . '/call.php', <<<'PHP' + ['timeout' => 5]]); +foreach (['call', 'reset', 'call', 'call'] as $script) { + echo @file_get_contents($base . $script . '.php', false, $context) ?: "no response\n"; +} +?> +--CLEAN-- + +--EXPECT-- +1502868 +bool(true) +bool(true) +1502868 +1502868