-
Notifications
You must be signed in to change notification settings - Fork 8.1k
re-enable JIT for ZTS builds on Apple Silicon #22712
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
arnaud-lb
merged 10 commits into
php:master
from
realFlowControl:florian/apple-silicon-zts-jit
Jul 15, 2026
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
807e29d
re-enable JIT for ZTS builds on Apple Silicon
realFlowControl f7021f3
Indent nested JIT preprocessor directives
realFlowControl e883ad7
Simplify JIT shared memory sizing
realFlowControl 8f51da2
Require pthread JIT write protection on Apple Silicon ZTS
realFlowControl 20fc5c6
Scope pthread JIT protection to MAP_JIT
realFlowControl c626ddf
Check pthread JIT support in extension builds
realFlowControl 8624eb4
Merge branch 'master' into florian/apple-silicon-zts-jit
realFlowControl 0ddd5da
Preserve JIT buffer size reporting
realFlowControl f3e1e36
[ci skip] CI changes will be merged separately in 8.2
arnaud-lb 4d5f041
[ci skip] NEWS/UPGRADING
arnaud-lb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| --TEST-- | ||
| GH-13400: JIT code generated after fork is visible to the parent | ||
| --DESCRIPTION-- | ||
| OPcache metadata and generated JIT code are shared by forked workers, so the | ||
| JIT mapping and its allocation pointer must remain shared after fork. This test | ||
| records the available JIT space before forking and makes only the child call a | ||
| function often enough to generate code. The parent then verifies that it sees | ||
| the reduced free space and can execute the generated function. | ||
|
|
||
| Without shared inheritance, a private JIT mapping becomes copy-on-write in the | ||
| child. The parent's free-space check would print bool(false), while shared | ||
| OPcache metadata could point the parent at code bytes that exist only in the | ||
| child and cause a crash instead of printing int(42). A startup-only test would | ||
| not detect this failure in fork-based SAPIs such as FPM or Apache. | ||
| --EXTENSIONS-- | ||
| opcache | ||
| pcntl | ||
| --INI-- | ||
| opcache.enable=1 | ||
| opcache.enable_cli=1 | ||
| opcache.file_update_protection=0 | ||
| opcache.jit=tracing | ||
| opcache.jit_buffer_size=16M | ||
| opcache.jit_hot_func=1 | ||
| --SKIPIF-- | ||
| <?php | ||
| if (!function_exists('pcntl_fork')) die('skip pcntl_fork() not available'); | ||
| if (!(opcache_get_status()['jit']['on'] ?? false)) die('skip JIT is not available'); | ||
| ?> | ||
| --FILE-- | ||
| <?php | ||
| function value(): int { | ||
| return 42; | ||
| } | ||
|
|
||
| $bufferFree = opcache_get_status()['jit']['buffer_free']; | ||
| $pid = pcntl_fork(); | ||
| if ($pid === 0) { | ||
| for ($i = 0; $i < 100; $i++) { | ||
| value(); | ||
| } | ||
| exit(0); | ||
| } | ||
| if ($pid === -1) { | ||
| echo "pcntl_fork() failed\n"; | ||
| exit(1); | ||
| } | ||
|
|
||
| pcntl_waitpid($pid, $status); | ||
| var_dump(opcache_get_status()['jit']['buffer_free'] < $bufferFree); | ||
| var_dump(value()); | ||
| ?> | ||
| --EXPECT-- | ||
| bool(true) | ||
| int(42) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.