perf(relinker): flat address-taken vector and region query caching in strict reachability #6974
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/6974"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by HamidRezaLS on 2026-10-16T23:29:38Z.
What
A follow-up performance pass on
StrictReachabilityand relocation handling after #2304:std::set<VirtualAddress> addressTakenwith a contiguousstd::vector<VirtualAddress>, sorted once withstd::sort+std::unique. On large binaries, this cuts out 3.3 million individual heap node allocations and tree rebalancings.lastOwnerpointer cache inowner(VirtualAddress address). SinceaddressTakenroots are processed in ascending order, the majority of consecutive queries hit the exact same function region, turning millions of tree lookups into directO(1)checks.branchTargetsinWindowsTlsBuilderfromstd::setto a flat sortedstd::vector, queried usingstd::upper_bound.emplace_hintduring sequential instruction collection inCodeInstructionCollector.Tested
PPSA15552, 39.7 MB executable, 23.8 MB.text)sha256sum):528ada1f9c1ee3a804fc71af08844d485fc44881af0b6ee2f4094c48e177813384993f509af2c330f69dc2b33f4eea5e6d59b3dff5bfd9cf9d93d30ea00b02dfctest -R "strict_nid_filter|relinker_conversion|to_intel_linux_stubs"passed cleanly.check_conventions.pypassed with 0 findings.Dead Cells (PPSA15552) conversion timings (
unused-filter=2):main)unused-filter=2)--windows unused-filter=2)Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-16T23:33:41Z.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
core/relinker/relinker/src/analysis/CodeInstructionCollector.cppcore/relinker/relinker/src/analysis/CodeInstructionCollector.cppImported from boykopovar/AnyPS5. Originally posted by simonbbby on 2026-10-17T02:23:22Z.
Independent Linux correctness check on exact head
5d9fd5103f8e6a0f9b60f6411a1eab362013676e(Ubuntu 24.04 x86-64, GCC 13.3, Release relinker-only). This checks equivalence; it does not reproduce the Dead Cells timing measurement.AnalyzeStrictReachabilityagree with an independent region-graph traversal on all six result fields: exact instruction/import sets, indirect transfers, live/total regions and unique address-taken roots. Five fixed seeds cover 2–64 adjacent regions, shuffled entry order, interior and exact-boundary roots, duplicate pointer/data roots, cyclic extra edges, import slots and out-of-code pointer values. All code is generated NOP/RET functions; no title data is used.Scope: the generated oracle covers the flat-root/region-cache changes, not every x86 instruction or relative-table encoding. The 84-case byte comparison is synthetic; it does not establish title performance, full large-title equivalence, Windows host execution or a current-main merge result.
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-19T12:42:41Z.
This pull request is labeled
perf, so it needs the summary line of a capture onmainand one with the change, from the same title, scene and machine, as the Performance report form asks. Please paste bothaps5-summary.jsonllines, attach the two traces and add the output oftools/trace_digest.py.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-19T15:54:13Z.
Rebased onto current main (only conflict: the
branchTargetsdeclaration next to the newgsTrapsinWindowsTlsBuilder.cpp). Checked that the sorted/unique vector +upper_boundis equivalent to thestd::setlookups, thatlastOwnerpoints into astd::map(stable nodes), and that the cached code-header lookup returns the same header as the linear scan. Relinker build and ctest pass after the rebase; merged.