Fix GH-17770: allow opcache.file_cache writes when JIT is enabled#21219
Fix GH-17770: allow opcache.file_cache writes when JIT is enabled#21219gregharmon wants to merge 2 commits intophp:masterfrom
Conversation
|
Addressed the Windows CI failure in the new GH-17770 regression test. Update in
This keeps the regression intent unchanged while avoiding startup/path issues on Windows workers. |
JIT compilation takes time. And it's not going to be profitable in case we re-do it on each request. Probably, this change may be helpful for some cases - e.g rare opcache resets, but it's probably not a big problem to recompile php from sources. In case of often resets, enabling JIT will probably increase CPU load and for file_cache_only increase it significantly. |
Summary
zend_file_cache_script_store()had an explicit JIT guard that returnedFAILUREwheneverJIT_G(on)was true, which prevented second-level file cache writes under JIT.This change removes that behavior and allows
opcache.file_cachewrites with JIT enabled.Details
ext/opcache/zend_file_cache.czend_file_cache_script_store(), stop unconditionally failing when JIT is enabled.JIT_G(on)=0during file-cache serialization/write and restoring it on all exits.ZEND_VM_SET_OPCODE_HANDLER) so runtime JIT handlers are not serialized into file cache payloads.This preserves the intended model: file cache stores OPcache bytecode/metadata only; JIT machine code is not persisted and is rebuilt at runtime as usual.
Tests
Added regression test:
ext/opcache/tests/gh17770_jit_file_cache_write.phptThe test enables JIT + file cache, compiles a temp script, and asserts that at least one file is written under
opcache.file_cache.Local runs:
Results: new test passes; focused file-cache subset passes (with
bug78189skipped on non-Windows).