Skip to content

Disable JIT when pthread protection is unavailable#22853

Open
realFlowControl wants to merge 5 commits into
php:masterfrom
realFlowControl:florian/fix-apple-silicon-zts-jit-runtime-check
Open

Disable JIT when pthread protection is unavailable#22853
realFlowControl wants to merge 5 commits into
php:masterfrom
realFlowControl:florian/fix-apple-silicon-zts-jit-runtime-check

Conversation

@realFlowControl

@realFlowControl realFlowControl commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Follow up to #22712 (comment)

This moves the runtime capability check into zend_jit_check_support(). When pthread_jit_write_protect_supported_np() reports that per-thread JIT write protection is unavailable, OPcache now logs an ACCEL_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

  • Clean Apple Silicon ZTS build.
  • Supported Apple Silicon JIT fork test passes.
  • Forced-unsupported OPcache tracing suite: 927 tests, 0 failures.

@iluuu1994 iluuu1994 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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===$

@iluuu1994 iluuu1994 Jul 22, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@realFlowControl realFlowControl Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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. 😉

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants