Compare commits

...

1 Commits

5 changed files with 1407 additions and 1575 deletions

View File

@@ -53,7 +53,7 @@ Progress
<!-- progress:start -->
| Decompiled | Matched | Linked | Data |
|:---:|:---:|:---:|:---:|
| 97.17% | 83.64% | 58.20% | 89.94% |
| 97.59% | 83.64% | 58.20% | 89.94% |
units 778/1027 complete, functions 12026/12563 matched.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -103,3 +103,38 @@ Starting this continuation: 4/9 instruction-exact, code 2588/21460, data 1160/13
- MatchAltSound1Key: reversed scalar declarations (339/341); made the signed midpoint sum explicit (339/341); changed backward-search decrement to assignment (339/341). None fixed table-load/search ordering.
- Zi8Get1KeyPressSpelling: unsigned terminator equality (1571/1700, 59.628235%); reverse local declarations (1572/1700, 59.968235%); integer expansion count and integer boolean conversions (1536/1700, 59.57353%). All scored below the starting 59.97%; retained the baseline.
- Zi8Get1KeyPressCandidates: reverse local declarations (2775/2397, 53.831455%); while-form terminator trimming (2773/2397, 53.523155%); explicit unsigned charset result (2775/2397, 53.775135%). Retained the small fuzzy-score improvement from reversing the candidate function declarations; instruction count and the target stack-layout mismatch remain unchanged. This is a partial improvement, not an exact match. No additional exact function was found.
## Complete-body continuation, 2026-09-30
Starting from f20fc7b8: spelling 59.97%, candidates 53.831455%; unit 4/9 exact. Spelling target frame is 0x90; the prior source used 0xb0. Recovered byte/halfword/pointer declaration order from stack accesses, separated the input-conversion flag from the pinyin flag, and reused the target's character and scan variables across their successive roles. Restored mode-selection address order, postfix expansion/output writes, and missing spelling-call result narrowing. Frame now 0x90, 1577/1700 instructions, 79.560585%; first exact divergence +0x1c is a register choice. Quick gate PASS, zero regressions, identical pool.
Spelling address-order pass: restored a separate condition for every phonetic expansion store, including the target's fourth EFF5 expansion F316. Corrected increment forms, language-support branch direction, early returns, spelling length's shared stack slot, explicit comparison breaks, and the exact/extended table passes through the final return. Every target basic-block region is represented; there is no stub or omitted tail. 1697/1700 instructions, 96.225296%; first exact divergence +0x20 is register allocation. Remaining structural differences are a few result moves, output scan scheduling and the remaining-skip branch. Quick gate PASS, zero regressions.
Spelling final scan attempt: restored highlighted-output increment scheduling, workspace length comparison operand order and the final remaining-candidate branch direction. 1696/1700, 96.82353%; first exact divergence +0x20. Kept the gain after quick gate PASS. The remaining four-instruction difference consists mainly of compiler-generated copies after calls and postfix stores; all table passes and exits are present.
Candidates frame pass: recovered separate key-value/key-mask arrays, byte declaration order and the original shared scan index. Removed decompiler-only call-result locals and added typed OEM/PUD arguments. Recovered switch dispatches and sequential phrase cursor operations. 2451/2397 instructions, frame 0x160 versus target 0x140, 68.29662%. The remaining extra frame words are compiler-generated Boolean temporaries from comma expressions. Quick gate PASS; every previously exact function remains exact.
Candidates prefix pass: expanded comma-expression Boolean tests into sequential table loads and checks, removing five compiler temporaries; frame now exactly 0x140. Restored charset switches and branches, key-value/mask writes, division, call-result narrowing and output operand order. 2390/2397 instructions, 72.67042%; first exact divergence +0x28 is a register choice. Quick gate PASS. Continuing through OEM, PUD, phrase, sorted ordinal, user ordinal and ordinary ordinal paths.
Candidates OEM/PUD address-order pass: recovered typed byte-return dictionary calls, corrected key-mask activation, replaced reconstructed output labels with the original skip/word/character branches and postfix output indexing. Restored the OEM and PUD scan loops through their exhaustion paths. Frame remains 0x140; candidates 80.75636% versus 53.831455% at entry. Quick gate PASS, zero regressions, identical pool.
Candidates phrase/sorted-ordinal passes: restored the context-count decrement after comparison, first phrase-ordinal consumption and charset scan from the saved entry cursor. Rebuilt each group before continuing. Recovered character-first duplicate filtering, word output, table-filter narrowing and sorted ordinal explicit loop breaks/output increments. Candidate score 82.131%, then 84.724236%, then 88.3033%; frame 0x140 throughout. Quick gate PASS, no regressions.
Candidates final body pass: restored user-ordinal and ordinary-ordinal duplicate branches, byte/word emission, capacity exits and cursor increment order through the final return. Measured after each pass: 91.54819%, then 94.64998%. Both huge bodies now cover every target basic-block region; candidates frame 0x140 and first exact divergence +0x28 (register choice). Quick gate PASS, zero regressions.
Near-match continuation: candidate byte narrowing/branch inversion combined scored 94.54735% and regressed the previously exact matcher to 98.96907%; restoring its tone parameter recovered the matcher but candidates remained 94.56404%. Isolated duplicate-result casts plus final postfix store scored 94.335%; both rejected, restoring 94.64998%. MatchAltSound1Key recovered address-order search labels and halfword table indices (98.2698%, 345/341), then correct integer offset and low-byte expression (99.80939%, 341/341); restored the search restart assignment. Quick gate PASS, zero regressions.
Additional near-match trials after the complete-body pass: MatchAltSound1Key with a generic context argument and typed local alias retained 341/341 instructions and the same twelve register differences; reversing declarations produced fifty differences; postfix backward-search decrement retained the same twelve. Restored the best readable source: 99.82404%, 341/341, context and phonetic table base exchange r25/r26. All bodies remain complete.
Additional near-match source trials in this continuation:
- Zi8SpellingZY: decoded components as signed halfwords; 94.10569%, src 0x1f8 base 0x1ec insns 126/123. --- replace mine 8:10 base 8:9.
- Zi8SpellingZY: initialize length at declaration; 99.756096%, src 0x1ec base 0x1ec insns 123/123. diffs 6: [27, 28, 35, 36, 37, 38].
- Zi8SpellingZY: explicit scan for loop; 99.756096%, src 0x1ec base 0x1ec insns 123/123. diffs 6: [27, 28, 35, 36, 37, 38].
- Zi8SpellingPY: constant tone at declaration; 94.968155%, src 0x278 base 0x274 insns 158/157. --- delete mine 4:7 base 4:4.
- Zi8SpellingPY: decode all components in declaration order; 97.54777%, src 0x278 base 0x274 insns 158/157. --- replace mine 4:5 base 4:5.
- Zi8SpellingPY: explicit scan for loops; 97.038216%, src 0x278 base 0x274 insns 158/157. --- delete mine 4:5 base 4:4.
Retained PY component initialization in declaration order: 97.54777% versus 97.038216% at entry, 158/157 instructions. Initializing length first restored the lower baseline score; constant tone worsened it. Quick gate PASS, zero regressions. ZY retains six table-base register differences; no rejected source variant remains.
Final full gate over zi81key and zi8alpha: PASS, original DOL hash, identical pools, zero regressions, zero net forbidden patterns and readability warnings. zi81key remains 4/9 instruction-exact; exact code 2588/21460, exact data 1208/1388, weighted fuzzy 96.51463%. Entry exact data was 1160/1388. Final function scores: ZY 99.756096%, PY 97.54777%, alternate sound 99.82404%, spelling 96.82353%, candidates 94.64998%; the four exact functions remain exact. Both large bodies cover all original block regions. Remaining differences and rejected source variants are recorded above; no new exact function is claimed.

View File

@@ -102,3 +102,33 @@ Zi8AlphaGetCandidates:
3. Explicit switch for phonetic separators F331 through F335: 4450/3946, 44.217434%.
All three candidate-engine scores were below the 44.43563% baseline. The stack frame remains 0x330 instead of 0x2B0, with branch, conversion and load differences throughout. No additional exact function was found; no source variant was retained.
## Complete-body continuation from f20fc7b8, 2026-09-30
Entry: engine 44.43563%, case conversion 99.09091%, unit 10/12 instruction-exact. Both source functions remain public; configuration remains NonMatching. The engine was walked against the original disassembly, with object rebuilds and ctxdiff after each group of blocks.
- Recovered the byte, halfword, pointer and integer declaration order from stack accesses. Separated primary/secondary completion and vowel flags, prefix flags, dictionary state, retry state, output language and phonetic flags. Removed comma-expression Boolean temporaries. Recovered the 65-character candidate buffer, including its terminator capacity: frame now 0x2b0, matching the original, rather than 0x330.
- Restored normalization, early highlighted-word output, prefix preparation, language selection and dictionary dispatch in address order. Recovered separate loop indices and lengths rather than sharing variables with overlapping lifetimes. Rebuilt the ROM/PUD/UWD/OEM and punctuation paths, candidate filtering, detokenization, duplicate filtering, key-layout filtering, output, dictionary exhaustion and all prefix/suffix retries through the final return. Intermediate engine scores: 65%, 70.35226%, then 70.829445%; no tail is omitted.
- Typed-workspace alias experiments were rejected: a local typed alias scored 67.28865%; a const pointer alias scored 67.75748%; a generic dictionary-work alias at the target initialization position scored 70.29625%. None resolved the target's unused workspace-copy stack slot without extra loads. No unused local or padding was added to reproduce that slot.
- Recovered Zi8GetTableCount's halfword return type from matched siblings. Score initially 70.65965%. Corrected the post-dictionary vowel filter to use the prefix-vowel flag and restored Italian/French/vowel call order and failure exits: 71.42676%.
- Reversed the lookup-versus-output branch to match the target's WCharCount-before-conversion order: 72.92676%. Reversed locked/unlocked suffix branches: 73.289406%. Recovered the stack-resident suffix element index and postfix field increments, preserving sequenced prefix reads/stores: 74.21439%.
Quick authority gate PASS: identical pool, zero regressions, zero added forbidden patterns and readability warnings. Engine frame matches; first strict instruction divergence is +0x14, the parameter/workspace register swap. Remaining differences include scalar stack offsets, branch structure, call conversions and register allocation, not just compiler register choices. Behavior is reviewed against assembly, without an independent runtime harness.
Additional near-match source trials in this continuation:
- Zi8ChangeWordCase: case switch; 74.88636%, src 0xc0 base 0xb0 insns 48/44. --- replace mine 9:21 base 9:14.
- Zi8ChangeWordCase: explicit cursor advance in for loop; 94.545456%, src 0xb0 base 0xb0 insns 44/44. diffs 11: [9, 10, 11, 19, 22, 25, 27, 29, 30, 31, 32].
- Zi8ChangeWordCase: loop break at entry; 67.27273%, src 0xb0 base 0xb0 insns 44/44. diffs 18: [9, 10, 11, 19, 21, 22, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35].
Restored the case-conversion baseline after all three rejected variants. A generic workspace argument copied into a typed local and used for the entire engine scored 70.34288%, 4096/3946 instructions; rejected in favor of the 74.21439% committed body.
Further address-order audit: changing the engine workspace formal to the shared generic pointer type, with typed field access, moved the first strict divergence from +0x14 to +0x20 and scored 74.8036%. A const dictionary-work alias in a nested scope scored 72.05246%; a cached phonetic character scored 74.60922%; rejected both rather than manufacture the unused target stack copy. Recovered invalid-language-first branch order: 75.2666%. Recovered default-buffer-first order, chained flag-store order, unsigned field casts and the signature's halfword length argument: 75.28484%.
Replaced the reconstructed Finnish retry labels with the target's backward scan and switch, including the shared vowel/space stop and decrement. Moved apostrophe punctuation termination from the loop condition into the body. Corrected the final punctuation-history check to use primary/secondary vowel restrictions rather than completion flags, as shown by target slots 0x8c/0x94. 76.430305%, frame still 0x2b0. Quick authority gate PASS, no regressions. These remaining structural fixes are separate from the unresolved workspace-copy stack slot; no padding or unused local was added.
Highlighted-output audit: recovered the element-index length slot, the last-highlighted-character test at index minus one, body comparison breaks, skip-before-emit branch and suffix output scan through the shared index. Preserved a zero dictionary index before the early highlighted-output exit; the baseline initialized it, and leaving it undefined would make the optional dictionary-count finalization read an uninitialized local. That initialization is a deliberate remaining assembly difference, not a matching trick. Corrected Zi8Memset's full-width value argument from its matched definition. 76.94551%.
Dictionary-mode dispatch audit: replaced the reconstructed comparison chain with the target's switch, in address order: punctuation, OEM, UWD, alternate sound, completion/default, ROM/PUD. Restored the forward dictionary-kind scan with a body break and initialized scan position only on the dual-language path. 81.71363%, 3978/3946 instructions. Recovered previous-count-before-clear order, ordinary-dictionary-before-terminal-punctuation order and the secondary-pass skip switch: 81.86037%. Quick gate PASS, identical pool, zero regressions and readability warnings. Every engine exit and dictionary/prefix/suffix pass remains present.
Final full gate over both units: PASS. Alpha remains 10/12 instruction-exact; exact code 5704/21664, exact data 72/564, weighted fuzzy 86.776405%. Final engine score 81.86037%, 3978/3946 instructions, frame 0x2b0; first strict divergence +0x40, before the target's retry-flag initialization. Case conversion remains 99.09091% with eight register differences. All 330 emitted rodata bytes equal the target prefix; its remaining six bytes are trailing alignment, which was not reproduced with padding objects. The target's workspace-copy slot and some field meanings remain unresolved. All source functions are complete; no additional exact function or linked-unit completion is claimed.