[pull] master from ruby:master - #1253
Merged
Merged
Conversation
This changes the following methods to compact the set after removal: * `^` * `-` * `difference` * `subtract` * `keep_if` * `select!` * `filter!` Fixes [#22210]
jmp_ptr_bytes() reserves room for a patchable jump -- it sets page_end_reserve and bounds conditional jump width. A single `b` suffices when every branch in the code region is in imm26 range; otherwise it reserves 5 instructions for an absolute load-address plus br. The range test was `virtual_region_size() / 4`, but two instructions in an S-byte region are at most S-4 bytes apart. At exactly 128MiB, S/4 is 2^25 while the widest imm26 offset is 2^25-1, so the check gave up one instruction early and took the 5-instruction fallback -- despite the comment right above it saying <= 128 should work. That boundary is the default. exec_mem_size falls back to mem_size in CodegenGlobals::init and mem_size defaults to 128MiB, so every arm64 run without an explicit --yjit-exec-mem-size reserved 20 bytes per patchable jump where 4 would do. On a branch-heavy method that is the difference between 1336 and 956 bytes of inline code. Test (S-4)/4 instead. The decision moves into a small jmp_ptr_bytes_for_region() so a unit test can pin both sides of the boundary without allocating a region that large. --yjit-exec-mem-size=129 still takes the fallback, as before. Checked with `make yjit-check` on arm64 macOS and on Linux/Graviton 4: 374 cargo tests, all bootstraptest at --yjit-call-threshold=1, and test_yjit.rb (142 tests, 0 failures). Since the default size is the boundary case, the whole suite ran on the tightened reservation.
Unlike in YJIT, we don't re-patch particular jump instructions, so there is no need to pad.
It's only for page switching, which is not a thing in ZJIT.
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )