Skip to content

zAttribSys: 100% match#51

Open
JohnDeved wants to merge 87 commits intodbalatoni13:devfrom
JohnDeved:zattribsys
Open

zAttribSys: 100% match#51
JohnDeved wants to merge 87 commits intodbalatoni13:devfrom
JohnDeved:zattribsys

Conversation

@JohnDeved
Copy link
Copy Markdown
Contributor

@JohnDeved JohnDeved commented Mar 10, 2026

Summary

  • continue the zAttribSys matching work and keep the branch current with dev
  • restore the VecHashMap64.h post-merge regression that dropped the TU from 99.9% to 99.6%
  • document the remaining register-allocation dead end in AGENTS.md so future agents do not repeat the same 300+ exhausted experiments

Key changes

  • move ClassPrivate::CollectionHashMap constructor out of line so the DWARF/template-instantiation order matches the original
  • align VecHashMap layout and helper placement with DWARF, including unsigned int table size/count fields
  • inline Class::Reserve() and route Class::GetTableNodeSize() through mCollections
  • add NON_MATCHING notes to the two remaining near-match functions
  • add a Discovered Matching Patterns entry for the shared r6/r7 register-allocation tie-break dead end
  • restore the pre-merge VecHashMap64.h condition after syncing with dev

Validation

  • rm -f build/GOWE69/src/Speed/Indep/SourceLists/zAttribSys.o && ninja build/GOWE69/src/Speed/Indep/SourceLists/zAttribSys.o
  • python tools/decomp-status.py --unit main/Speed/Indep/SourceLists/zAttribSys
  • python tools/decomp-diff.py -u main/Speed/Indep/SourceLists/zAttribSys -s nonmatching -t function

Current status

  • .text: 99.9% (179/196 functions)
  • remaining nonmatching functions:
    • Attrib::Class::RemoveCollection(Attrib::Collection *)98.6%
    • Attrib::Database::RemoveClass(Attrib::Class const *)98.5%

Notes

  • both remaining mismatches share one root cause: an r6/r7 register-allocation tie-break inside inlined VecHashMap::FindIndex
  • once the diff has collapsed to this swap and DWARF locals/inlining match, source-level permutations have not moved it; only compiler/flag investigation is likely to help

- decomp-context.py: scope source output to function line range instead of full file; add Ghidra error diagnostics with stderr reporting and --ghidra-check flag
- tools/find-symbol.py: new CLI symbol finder to replace clangd workspace/symbol for checking existing definitions before declaring new types
- refiner/SKILL.md: new skill for resolving stubborn instruction mismatches with systematic lateral strategies
- AGENTS.md: document new tools, expand Matching Tips with branch/stack/vtable/register/inline patterns, add Discovered Matching Patterns section with entry template
- lookup/SKILL.md: replace clangd instructions with find-symbol.py
- scaffold/SKILL.md: fix typos, replace clangd reference, add jumbo unit identification guidance
- execute/SKILL.md: fix section numbering gap (1a/1c -> 1a/1b), link skill files in agent type list
- implement/SKILL.md: replace cat command with Read tool guidance
@decomp-dev
Copy link
Copy Markdown

decomp-dev Bot commented Mar 10, 2026

Report for SLES-53558-A124 (ef943a3 - 915e476)

📈 Matched code: 8.13% (+0.02%, +616 bytes)

✅ 4 new matches
Unit Item Bytes Before After
main/Speed/Indep/SourceLists/zAttribSys VecHashMap<unsigned int, Attrib::Collection, Attrib::Class::TablePolicy, true, 40>::~VecHashMap(void) +296 0.00% 100.00%
main/Speed/Indep/SourceLists/zAttribSys VecHashMap<unsigned int, Attrib::Class, Attrib::Class::TablePolicy, false, 16>::~VecHashMap(void) +168 2.51% 100.00%
main/Speed/Indep/SourceLists/zAttribSys global constructors keyed to Attrib::Class::Class(unsigned int, Attrib::ClassPrivate &) +35 75.29% 100.00%
main/Speed/Indep/SourceLists/zAttribSys Attrib::ClassPrivate::CollectionHashMap::~CollectionHashMap(void) +8 0.00% 100.00%
📈 6 improvements in unmatched items
Unit Item Bytes Before After
main/Speed/Indep/SourceLists/zAttribSys Attrib::Collection::Collection(Attrib::CollectionLoadData const &, Attrib::Vault *) +130 89.53% 99.99%
main/Speed/Indep/SourceLists/zAttribSys _Rb_tree<Attrib::TypeDesc, Attrib::TypeDesc, _Identity<Attrib::TypeDesc>, less<Attrib::TypeDesc>, allocator<Attrib::TypeDesc> >::_M_insert(_Rb_tree_node_base *, _Rb_tree_node_base *, Attrib::TypeDesc const &) +117 77.68% 90.74%
main/Speed/Indep/SourceLists/zAttribSys Attrib::Class::RemoveCollection(Attrib::Collection *) +91 91.28% 97.11%
main/Speed/Indep/SourceLists/zAttribSys Attrib::Database::RemoveClass(Attrib::Class const *) +62 93.66% 97.72%
main/Speed/Indep/SourceLists/zMisc Hermes::System::RemovePortMessage(unsigned long) +53 95.08% 98.72%
main/Speed/Indep/SourceLists/zEAXSound global constructors keyed to gAudioMemoryManager 0 0.56% 0.57%
📉 2 regressions in unmatched items
Unit Item Bytes Before After
main/Speed/Indep/SourceLists/zAI global constructors keyed to _AITrafficManager -27 12.57% 12.31%
main/Speed/Indep/SourceLists/zSim global constructors keyed to OBB::OBB(void) 0 1.52% 1.51%

Report for GOWE69 (ef943a3 - 915e476)

📈 Matched code: 14.09% (+0.07%, +2772 bytes)
📈 Matched data: 0.56% (+0.00%, +40 bytes)

✅ 8 new matches
Unit Item Bytes Before After
main/Speed/Indep/SourceLists/zAttribSys Attrib::ClassPrivate::CollectionHashMap::~CollectionHashMap(void) +284 0.00% 100.00%
main/Speed/Indep/SourceLists/zAttribSys Attrib::TypeTable::~TypeTable(void) +208 0.00% 100.00%
main/Speed/Indep/SourceLists/zAttribSys Attrib::ClassTable::~ClassTable(void) +137 33.14% 100.00%
main/Speed/Indep/SourceLists/zAttribSys Attrib::DatabasePrivate::~DatabasePrivate(void) +93 77.43% 100.00%
main/Speed/Indep/SourceLists/zAttribSys _STL::_Rb_tree<Attrib::TypeDesc, Attrib::TypeDesc, _STL::_Identity<Attrib::TypeDesc>, _STL::less<Attrib::TypeDesc>, _STL::allocator<Attrib::TypeDesc> >::_M_insert(_STL::_Rb_tree_node_base *, _STL::_Rb_tree_node_base *, Attrib::TypeDesc const &, _STL::_Rb_tree_node_base *) +92 74.26% 100.00%
main/Speed/Indep/SourceLists/zAttribSys __static_initialization_and_destruction_0 +45 77.82% 100.00%
main/Speed/Indep/SourceLists/zAttribSys Attrib::Collection::Collection(Attrib::CollectionLoadData const &, Attrib::Vault *) +37 96.73% 100.00%
main/Speed/Indep/SourceLists/zAttribSys .bss +9 77.78% 100.00%
📈 10 improvements in unmatched items
Unit Item Bytes Before After
main/Speed/Indep/SourceLists/zMisc Hermes::System::RemovePortMessage(unsigned long long) +77 94.89% 99.19%
main/Speed/Indep/SourceLists/zAttribSys Attrib::Class::RemoveCollection(Attrib::Collection *) +76 93.61% 98.59%
main/Speed/Indep/SourceLists/zAttribSys Attrib::Database::RemoveClass(Attrib::Class const *) +76 93.40% 98.53%
main/Speed/Indep/SourceLists/zFoundation __static_initialization_and_destruction_0 +28 12.63% 20.01%
main/Speed/Indep/SourceLists/zSim __static_initialization_and_destruction_0 +25 2.79% 4.04%
main/Speed/Indep/SourceLists/zPhysics __static_initialization_and_destruction_0 +24 0.68% 0.98%
main/Speed/Indep/SourceLists/zEcstasy __static_initialization_and_destruction_0 +20 13.99% 14.42%
main/Speed/Indep/SourceLists/zAI __static_initialization_and_destruction_0 +17 16.86% 17.04%
main/Speed/Indep/SourceLists/zWorld __static_initialization_and_destruction_0 +6 3.16% 3.21%
main/Speed/Indep/SourceLists/zEAXSound2 __static_initialization_and_destruction_0 0 6.68% 6.69%
📉 3 regressions in unmatched items
Unit Item Bytes Before After
main/Speed/Indep/SourceLists/zMisc __static_initialization_and_destruction_0 -27 30.08% 28.19%
main/Speed/Indep/SourceLists/zEAXSound __static_initialization_and_destruction_0 -9 0.99% 0.89%
main/Speed/Indep/SourceLists/zAnim __static_initialization_and_destruction_0 -5 29.43% 28.73%

Report for EUROPEGERMILESTONE (ef943a3 - 915e476)

📉 2 regressions in unmatched items
Unit Item Bytes Before After
NfsMWEuropeGerMilestone/Speed/Indep/SourceLists/zAttribSys public: class Attrib::Collection * __cdecl VecHashMap<unsigned int, class Attrib::Collection, class Attrib::Class::TablePolicy, 1, 40>::Find(unsigned int) const -151 71.60% 0.00%
NfsMWEuropeGerMilestone/Speed/Indep/SourceLists/zAttribSys public: class Attrib::Class * __cdecl VecHashMap<unsigned int, class Attrib::Class, class Attrib::Class::TablePolicy, 0, 16>::Find(unsigned int) const -45 29.15% 0.00%

JohnDeved and others added 4 commits March 11, 2026 13:05
Key changes:
- VecHashMap: struct, unsigned int members, private data, Clear() inlined into dtor
- CollectionHashMap: struct, out-of-line ctor+dtor matching DWARF method order
- Added Class::Reserve inline, GetTableNodeSize through mCollections
- Node: struct, removed operator new, unsigned int types throughout
- Moved GetNextValidIndex/GetKeyAtIndex to VecHashMap base
- AttribHashMap: restructured to match DWARF layout

NON_MATCHING (r6/r7 register swap, 300+ experiments exhausted):
- Class::RemoveCollection: 98.6%
- Database::RemoveClass: 98.5%

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add a Discovered Matching Patterns note for the stable r6/r7
register-allocation tie-break seen in zAttribSys RemoveCollection and
RemoveClass so future matching passes do not repeat 300+ exhausted
source-level experiments.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@JohnDeved JohnDeved changed the base branch from main to dev March 11, 2026 14:48
@JohnDeved JohnDeved marked this pull request as ready for review March 11, 2026 14:49
JohnDeved and others added 2 commits March 11, 2026 15:53
Restore the pre-merge VecHashMap64 condition form after syncing with
origin/dev. The merged condition regressed zAttribSys from 99.9% to
99.6%; this puts the translation unit back at the verified 99.9%
baseline.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@JohnDeved JohnDeved changed the title Zattribsys Zattribsys 99.9% Mar 11, 2026
JohnDeved and others added 14 commits March 11, 2026 19:54
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
# Conflicts:
#	.github/skills/execute/SKILL.md
#	.github/skills/implement/SKILL.md
#	AGENTS.md
#	tools/build-unit.py
#	tools/share_worktree_assets.py
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
JohnDeved and others added 27 commits March 23, 2026 11:53
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Refine the late VecHashMap remove path in zAttribSys.

- write Node::Get() as a ternary to drop the stray RemoveCollection DWARF mismatch
- rewrite the second UpdateSearchLength loop header as maxSearch > searchLen to make RemoveCollection DWARF-exact and raise the unit text floor

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Teach dwarf1_subroutine_tree to parse original params and locals from functions.nothpp when --show-non-subroutine is enabled so deep original-vs-rebuilt comparisons are meaningful.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Document the need to use --show-non-subroutine for overload-heavy DWARF checks and note that concrete VecHashMap member specializations are a valid ProDG lane when dependent names are expanded.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@JohnDeved JohnDeved changed the title Zattribsys 99.9% zAttribSys: 100% match Mar 25, 2026
@dbalatoni13 dbalatoni13 force-pushed the dev branch 2 times, most recently from 6f46fc6 to d282bc0 Compare March 28, 2026 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant