Compare commits

...

1 Commits

Author SHA1 Message Date
coah
4dbff4c03b zi8cgetc: zi8InternalGetZH (42.7KB) translated, 77% fuzzy (worker 9b342d48) 2026-09-30 11:29:56 +00:00
3 changed files with 2476 additions and 6 deletions

View File

@@ -53,7 +53,7 @@ Progress
<!-- progress:start -->
| Decompiled | Matched | Linked | Data |
|:---:|:---:|:---:|:---:|
| 95.54% | 83.04% | 58.19% | 89.47% |
| 96.63% | 83.04% | 58.19% | 89.47% |
units 777/1027 complete, functions 11993/12563 matched.

File diff suppressed because it is too large Load Diff

View File

@@ -62,3 +62,22 @@ Recovered the initial mode normalization and non-phrase input validation, charse
3. Explicit byte loop: 244 prefix instructions. Bytewise clearing differs from the original word loop. Rejected.
No incomplete public function or placeholder body was added. The phrase paths and subsequent dictionary/candidate loops are not reconstructed. These prefix experiments do not satisfy full-unit completion or establish a compiler plateau for the complete engine.
## Engine continuation on 038cd6f9
Zi8GetElementCount, 460 target bytes: re-read all basic blocks in address order. Represented the separator backup as a saved work-state value with its actual separator field. This carries real state used after Zi8ZHaddSpace, with no unused fields or padding. It restores the target stack store/load and buffer offset. 115/115 instructions; thirteen remaining differences are solely the element-count/result register interchange. Scalar width, initialization placement, declaration order and scope variants did not improve those register choices. Quick full gate passes with zero regressions and 99.347824%, up from 97.48695%.
ZiMatchZHSpelling, 484 target bytes: all blocks are already translated, with 121/121 instructions. Re-read the complete assembly; all 29 remaining differences are register numbers. No control-flow or stack-offset mismatch remains.
## End-to-end engine reconstruction, round 2
- `zi8InternalGetZH`: wrote initialization, input/masks, fuzzy phonetics, dictionary preflight, OEM, PUD, context phrases, prediction/numeric tables, dictionary ranges, ordinal candidates, tones, user characters, global characters, component phrases, frequency merge, phonetic pairs/candidates, retry/finish, and filtered table search in successive source fragments. Object builds and ctxdiff snapshots 01 through 15 are in `/tmp/zi8-r2-engine-*.diff`; the final fragment resolves every control-flow label and includes the return and all retry paths. Temporary exits used during development are absent from the resulting source.
- The full body has 10,599 instructions against 10,676 target instructions; initialization still differs in stack layout, register allocation, and some later branch structure. It is an end-to-end reconstruction, not an exact match.
- The first full-body quick gate scored 75.59901% for the engine but failed because an extern declaration of the existing zero tone table changed its storage. Mutable storage was also incorrect. Moving the existing const tentative definition before its first use restored `.sbss2`, 24 matched data bytes, and zero regressions; engine score 75.60229%, unit fuzzy 78.19224%. Pool identical, forbidden additions 0, readability warnings 0, DOL hash correct, GATE PASS.
- Engine attempt 16: replaced conditional expressions for phrase length and final fallback eligibility with explicit logical branches. MWCC had allocated eight extra word temporaries for those expressions. Frame shrank from 0x500 to the target 0x4e0, instruction count 10,558/10,676, engine fuzzy 76.41532%; quick gate PASS, 0 regressions.
- Engine attempt 17: reordered the Boolean declarations to follow target stack slots; expressed phonetic pair rejection directly and initialized the pair-validation flag with branches. Aggregate and buffer offsets now align, frame remains 0x4e0, 10,535/10,676 instructions, engine fuzzy 76.57915%; quick gate PASS, 0 regressions.
- Engine attempt 18: sharing candidate status across matching/duplicate phases and correcting mask/range declaration order scored 76.535965%; this alone was below attempt 17. ASM review identified the missing independent phonetic-group wildcard byte at slot 0x48.
- Engine attempt 19: restored that real wildcard variable, separated it from candidate phonetic status, corrected byte truncation of secondary-match results, used the work-state halfword ordinal limit, and corrected OEM word-count increments. Engine 76.78999%; quick gate PASS, 0 regressions.
- Engine attempt 20: combined six phonetic-code assignments with their comparisons; engine score fell to 76.70392%, so restored attempt 19.
- Final read-only coverage check: every non-prologue helper has the same number of call sites as the target engine, including all 20 table-address calls, 22 table-count calls, 19 word-duplicate calls, and 11 secondary-character calls. All labels resolve, and no temporary completion exits remain. The initialization region after the save sequence has target stack offsets and instruction forms; the save sequence and GPR choices still differ.
- Final clean full gate: PASS; 5/8 instruction-exact functions, code 4168/47816, data 24/536, fuzzy 79.2530%. Pool identical, zero baseline regressions, zero forbidden patterns and readability warnings. Full build passed with target DOL SHA1 26116613f624061ba99c8d1a299aaa6efa85670d.