Disable JIT when pthread protection is unavailable#22853
Disable JIT when pthread protection is unavailable#22853realFlowControl wants to merge 5 commits into
Conversation
iluuu1994
left a comment
There was a problem hiding this comment.
Thank you Florian! Looks correct to me. The PR is still marked as draft, let me know when you think it's ok to merge.
| ===DONE=== | ||
| --EXPECTREGEX-- | ||
| ^(?:Warning: Cannot change opcache\.jit setting at run-time \(JIT is disabled\) in .+ on line 2 | ||
| )?===DONE===$ |
There was a problem hiding this comment.
I don't quite understand why this is a new problem? 🤔
Edit: Oh, I guess the JIT was just fully disabled at compile time and the INI setting didn't do anything.
There was a problem hiding this comment.
Exactly. After #22712 this behavior changed, but CI did not expose this particular follow-up problem because the initial test step printed a fatal error and failed. Consequently, the job never reached the later tracing/function JIT stages. See https://github.com/php/php-src/actions/runs/29793770728/job/88520997977
So the problem was already there with #22712, we just did not see it because CI failed before those stages were executed. 😉
There was a problem hiding this comment.
I am also unsure whether this warning represents a practical user-facing problem. It can occur when the configure-time check confirms that the pthread_jit_write_protect_np() symbol is available, but the runtime capability probe pthread_jit_write_protect_supported_np() returns false.
So far, I have only observed this on GitHub’s virtualized macOS runners. On a physical M4 Mac, the runtime capability is available and JIT works as expected.
Follow up to #22712 (comment)
This moves the runtime capability check into
zend_jit_check_support(). Whenpthread_jit_write_protect_supported_np()reports that per-thread JIT write protection is unavailable, OPcache now logs anACCEL_LOG_WARNING, disables JIT, and continues using the interpreter. This matches the existing unsupported-JIT behavior.OPcache tests that intentionally expose startup logs now accept the platform-dependent fallback warning, while JIT runtime configuration tests accept the corresponding runtime warning. The warnings remain optional so supported platforms continue exercising the original expectations under JIT.
Testing