[PHP] refactor: preserve first-fit mmap gap selection#751
Merged
brandonpayton merged 1 commit intoJul 11, 2026
Conversation
This was referenced Jul 10, 2026
Merge the address-sorted guest mapping and host reservation streams without materializing a combined list. Normalize fork-restored mappings once at their ingestion boundary so the ordering invariant is explicit. Reference-equivalence tests cover interleaving, equal starts, overlap, exact fits, exhaustion, and systematic relative orderings. The copied munmap regression from the original PR remains owned by #756. This is an unmeasured internal refactor. It makes no throughput or PHP/PHPT coverage claim and changes no intended host or ABI contract.
brandonpayton
force-pushed
the
gascity/kd-6nz/split-pr717-mmap-gap-sort
branch
from
July 11, 2026 19:39
bb8a322 to
7336e52
Compare
brandonpayton
changed the base branch from
integration/kd-6nz-php-phpt-harness-only-base
to
integration/kd-6nz-php-phpt-platform-fixes
July 11, 2026 19:40
13 tasks
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.
Why
MemoryManagerselects automatic mmap and host-reserved ranges from two address-ordered collections. The previous implementation concatenated and sorted those collections before every scan. This replacement walks the two ordered collections together while preserving the same first-fit result.The original split also carried an unrelated munmap-rounding regression test whose implementation and stronger focused coverage are now owned by #756.
This is an unmeasured internal refactor. It makes no throughput or PHP/PHPT coverage claim.
What
find_gap().Review changes
The original source commit was not replayed. Review found that its copied #756 test failed on the stale source branch and that its measurable-overhead, throughput, and retained-PHP claims had no benchmark or exact-tree PHPT evidence. The replacement makes the restored-order invariant explicit, adds reference-equivalence coverage, removes the redundant test, and states the evidence boundary directly.
Contract scope
Automatic mmap addresses are observable, so equivalence with the former first-fit algorithm is the load-bearing requirement. No host, browser, libc, package, or structural ABI surface is intended to change.
Validation
On replacement source commit
7336e524836773027951dda95f1607fbc39429c1:git diff HEAD^ HEAD --check: clean.memory::tests: 36/36 passed.scripts/dev-shell.sh cargo test -p kandelo --target aarch64-apple-darwin --lib: 1,104/1,104 passed.scripts/dev-shell.sh bash scripts/check-abi-version.sh: passed; snapshot, C header, and TypeScript bindings are synchronized.Full host, libc, POSIX, Sortix, browser, PHPT, and performance gates remain deferred to the Batch 2 aggregate. Performance was not measured.
Review view
Accept as an unmeasured kernel-internal equivalence refactor. The replacement preserves first-fit selection across ordered streams, normalizes restored input at its boundary, removes stale duplicated coverage, and makes no workload claim beyond the evidence run.