Repository navigation
Allow sparse text to use disjoint patch-area reaches - #2119
Open
thehobbit85 wants to merge 1 commit into
Open
thehobbit85 wants to merge 1 commit into
thehobbit85 wants to merge 1 commit into
Conversation
Spelunky 2 embeds a large data region between small code islands. Requiring a continuous front/back reach rejected it before checking any actual rewrite site. Keep the normal front reservation when the reaches do not overlap, and retain all entry and return branch range checks. Synthetic regressions exercise real layout and x18 stub emission, including rejection of an unreachable middle site. Refs seedds#1504. Embedded shader extraction and allocator requirements remain separate.
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What and why
Addresses the rewriter assertion in issue #1504. Spelunky 2 has hundreds of megabytes of embedded data between small code islands. The rewriter rejected its layout before examining the actual patch sites because the front and back patch areas could not reach a continuous interval.
Retain the normal front reservation when those reaches do not overlap. Early sites use the front area and late sites use the back area. Every emitted entry and return branch still passes the existing range check; a required site in the unreachable middle still fails. Existing overlapping layouts and explicit reservations retain their behavior. No addresses are relocated and no instructions are silently skipped.
This is separate from #1288's middle-area solution: that PR requires a function start in the middle interval where it can insert a new area. The reported sparse data gap has none. Its current implementation was inspected, together with #856 and fresh main, before starting and again before publication.
This PR does not close #1504: compressed embedded shaders and large allocator regions remain separate unresolved problems, and gameplay has not been tested.
Checked
Apple M2 Max, macOS 26.6, Python 3.14.6, Capstone 5.
0x100and0x11001800, emitting 40-byte front and back stubs. Temporary synthetic binary and outputs were removed afterward; only validation metadata remains outside the repository.nvn_mtl.m, independently reproduced on pristine base6c676444; existing test_dmsh_abi's ratchet no longer counts "?": the unknown binding kind is also what log lines write for a name they do not have, and the third such placeholder in nvn_mtl.m fails the Tool tests on main (issue #1656) #1981 addresses it. Documentation tests in that suite pass.dmsh_build.py:166–167type findings, independently reproduced on base and addressed by existing Fix shader-tool lint and stale shader test fixtures #2111. No new findings.git diff --check: PASS. No host or shader code changes, and no shader-chain version change.regress.py impact HEAD: four broad rewriter profiles and 149 without usage manifests. Attemptedregress.py check --games 0100C49025D3E000,0100B04011742000,010093801237C000,010015100B514000,01007EC013ABC000: exit 2 because noREGRESS_ROOT,REGRESS_GAMESor game files are available. FC27 exercises two patch areas, Rise a compact front reservation, Metroid Dread large BSS with a front area, Wonder the ordinary layout, and Spelunky 2 the reported sparse layout (no profile yet). None was run; no gameplay validation is claimed.Fresh main and all 1471 open/draft/closed/merged PR descriptions plus the issue timeline were checked before publication. No existing sparse-layout solution was found.
Docs
docs/reference/rewriter.md; packing behavior indocs/development.md; symptom index regenerated.