Compare commits
1 Commits
cleanup/ip
...
agent/w092
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b3257ccac2 |
@@ -53,7 +53,7 @@ Progress
|
||||
<!-- progress:start -->
|
||||
| Decompiled | Matched | Linked | Data |
|
||||
|:---:|:---:|:---:|:---:|
|
||||
| 96.71% | 83.23% | 58.19% | 89.93% |
|
||||
| 96.72% | 83.23% | 58.19% | 89.93% |
|
||||
|
||||
units 777/1027 complete, functions 12005/12563 matched.
|
||||
|
||||
|
||||
@@ -415,7 +415,7 @@ static int zi8InternalGetZH(ziGetParam* request, ZiChineseOptions* options, ziPt
|
||||
break;
|
||||
}
|
||||
if (rangeIndex) {
|
||||
rangeIndex = Zi8GetTableCount(1, 27, work);
|
||||
rangeIndex = (ziU16)Zi8GetTableCount(1, 27, work);
|
||||
if (rangeIndex) componentCharsetTable = (ziU8*)Zi8GetTableAddress(1, 27, work);
|
||||
charsetTable = (ziU8*)Zi8GetTableAddress(1, 21, work);
|
||||
}
|
||||
@@ -440,8 +440,7 @@ static int zi8InternalGetZH(ziGetParam* request, ZiChineseOptions* options, ziPt
|
||||
(getMode == 8 || getMode == 10)) {
|
||||
getMode = 7;
|
||||
} else if (getMode == 8 || getMode == 10 || getMode == 9) {
|
||||
phraseValues[0].bytes[0] = 0xFF;
|
||||
phraseMasks[0].bytes[0] = 0xFF;
|
||||
phraseMasks[0].bytes[0] = phraseValues[0].bytes[0] = 0xFF;
|
||||
if (request->elementCount > 3 ||
|
||||
(request->elementCount > 2 && elements[2] != ' ')) {
|
||||
if (getMode == 9) {
|
||||
@@ -452,8 +451,7 @@ static int zi8InternalGetZH(ziGetParam* request, ZiChineseOptions* options, ziPt
|
||||
} else {
|
||||
if (getMode == 10) getMode = 9;
|
||||
for (index = 0; index < 6; ++index) {
|
||||
match.arrD[index] = 0;
|
||||
match.arr1[index] = 0;
|
||||
match.arr1[index] = match.arrD[index] = 0;
|
||||
}
|
||||
if (elements[0] >= 'A' && elements[0] <= 'Y') {
|
||||
match.arr1[0] = 31;
|
||||
@@ -470,58 +468,59 @@ static int zi8InternalGetZH(ziGetParam* request, ZiChineseOptions* options, ziPt
|
||||
match.arr1[1] = 28;
|
||||
match.arrD[1] = (elements[1] - 0xEFF2) << 2;
|
||||
}
|
||||
phraseValues[1].bytes[0] = 0xFF;
|
||||
phraseMasks[1].bytes[0] = 0xFF;
|
||||
phraseMasks[1].bytes[0] = phraseValues[1].bytes[0] = 0xFF;
|
||||
totalResults = (match.arr1[0] << 3) | (match.arr1[1] << 8) | 7;
|
||||
phraseMasks[2].bytes[0] = totalResults;
|
||||
phraseMasks[2].bytes[1] = totalResults >> 8;
|
||||
phraseMasks[2].bytes[1] = (totalResults >> 8) & 0xff;
|
||||
totalResults = (match.arrD[0] << 3) | (match.arrD[1] << 8) | 2;
|
||||
phraseValues[2].bytes[0] = totalResults;
|
||||
phraseValues[2].bytes[1] = totalResults >> 8;
|
||||
phraseValues[2].bytes[1] = (totalResults >> 8) & 0xff;
|
||||
totalResults = (match.arr1[0] << 3) | (match.arr1[1] << 13) | 7;
|
||||
phraseMasks[3].bytes[0] = totalResults;
|
||||
phraseMasks[3].bytes[1] = totalResults >> 8;
|
||||
phraseMasks[3].bytes[2] = totalResults >> 16;
|
||||
phraseMasks[3].bytes[1] = (totalResults >> 8) & 0xff;
|
||||
phraseMasks[3].bytes[2] = (totalResults >> 16) & 0xff;
|
||||
totalResults = (match.arrD[0] << 3) | (match.arrD[1] << 13) | 3;
|
||||
phraseValues[3].bytes[0] = totalResults;
|
||||
phraseValues[3].bytes[1] = totalResults >> 8;
|
||||
phraseValues[3].bytes[2] = totalResults >> 16;
|
||||
phraseValues[3].bytes[1] = (totalResults >> 8) & 0xff;
|
||||
phraseValues[3].bytes[2] = (totalResults >> 16) & 0xff;
|
||||
totalResults = (match.arr1[0] << 3) | (match.arr1[1] << 18) | 7;
|
||||
phraseMasks[4].bytes[0] = totalResults;
|
||||
phraseMasks[4].bytes[1] = totalResults >> 8;
|
||||
phraseMasks[4].bytes[2] = totalResults >> 16;
|
||||
phraseMasks[4].bytes[1] = (totalResults >> 8) & 0xff;
|
||||
phraseMasks[4].bytes[2] = (totalResults >> 16) & 0xff;
|
||||
phraseMasks[4].bytes[3] = (Zi8UInt)totalResults >> 24;
|
||||
totalResults = (match.arrD[0] << 3) | (match.arrD[1] << 18) | 4;
|
||||
phraseValues[4].bytes[0] = totalResults;
|
||||
phraseValues[4].bytes[1] = totalResults >> 8;
|
||||
phraseValues[4].bytes[2] = totalResults >> 16;
|
||||
phraseValues[4].bytes[1] = (totalResults >> 8) & 0xff;
|
||||
phraseValues[4].bytes[2] = (totalResults >> 16) & 0xff;
|
||||
phraseValues[4].bytes[3] = (Zi8UInt)totalResults >> 24;
|
||||
totalResults = (match.arr1[0] << 3) | (match.arr1[1] << 23) | 7;
|
||||
phraseMasks[5].bytes[0] = totalResults;
|
||||
phraseMasks[5].bytes[1] = totalResults >> 8;
|
||||
phraseMasks[5].bytes[2] = totalResults >> 16;
|
||||
phraseMasks[5].bytes[3] = totalResults >> 24;
|
||||
phraseMasks[5].bytes[1] = (totalResults >> 8) & 0xff;
|
||||
phraseMasks[5].bytes[2] = (totalResults >> 16) & 0xff;
|
||||
phraseMasks[5].bytes[3] = (Zi8UInt)totalResults >> 24;
|
||||
totalResults = (match.arrD[0] << 3) | (match.arrD[1] << 23) | 5;
|
||||
phraseValues[5].bytes[0] = totalResults;
|
||||
phraseValues[5].bytes[1] = totalResults >> 8;
|
||||
phraseValues[5].bytes[2] = totalResults >> 16;
|
||||
phraseValues[5].bytes[3] = totalResults >> 24;
|
||||
phraseValues[5].bytes[1] = (totalResults >> 8) & 0xff;
|
||||
phraseValues[5].bytes[2] = (totalResults >> 16) & 0xff;
|
||||
phraseValues[5].bytes[3] = (Zi8UInt)totalResults >> 24;
|
||||
} else {
|
||||
if (request->elementCount > 1) {
|
||||
match.arr1[5] = 7;
|
||||
match.arrD[5] = 1;
|
||||
}
|
||||
phraseMasks[5].bytes[0] = phraseMasks[4].bytes[0] =
|
||||
phraseMasks[3].bytes[0] = phraseMasks[2].bytes[0] =
|
||||
phraseMasks[1].bytes[0] = (match.arr1[0] << 3) | match.arr1[5];
|
||||
totalResults = (match.arr1[0] << 3) | match.arr1[5];
|
||||
phraseMasks[1].bytes[0] = phraseMasks[2].bytes[0] =
|
||||
phraseMasks[3].bytes[0] = phraseMasks[4].bytes[0] =
|
||||
phraseMasks[5].bytes[0] = totalResults;
|
||||
totalResults = (match.arrD[0] << 3) | match.arrD[5];
|
||||
phraseValues[5].bytes[0] = phraseValues[4].bytes[0] =
|
||||
phraseValues[3].bytes[0] = phraseValues[2].bytes[0] =
|
||||
phraseValues[1].bytes[0] = totalResults;
|
||||
phraseValues[1].bytes[0] = phraseValues[2].bytes[0] =
|
||||
phraseValues[3].bytes[0] = phraseValues[4].bytes[0] =
|
||||
phraseValues[5].bytes[0] = totalResults;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (index = 0; index < 6; ++index) {
|
||||
match.arrD[index] = 0;
|
||||
match.arr1[index] = 0;
|
||||
match.arr1[index] = match.arrD[index] = 0;
|
||||
}
|
||||
for (index = 0; index < request->elementCount; ++index) {
|
||||
if (elements[index] >= 'A' && elements[index] <= 'Y') {
|
||||
@@ -543,24 +542,26 @@ static int zi8InternalGetZH(ziGetParam* request, ZiChineseOptions* options, ziPt
|
||||
}
|
||||
}
|
||||
}
|
||||
if (index > 5) {
|
||||
if (index >= 6) {
|
||||
resultFallback = 0;
|
||||
goto engine_finish;
|
||||
}
|
||||
if (!index) match.length = 1;
|
||||
else match.length = index;
|
||||
totalResults = (match.arr1[2] << 13) | (match.arr1[0] << 3) | (match.arr1[1] << 8);
|
||||
match.arr19[0] = (match.arr1[0] << 3) | match.arr1[5];
|
||||
match.arr19[1] = totalResults >> 8;
|
||||
totalResults |= (match.arr1[4] << 23) | (match.arr1[3] << 18);
|
||||
match.arr19[2] = totalResults >> 16;
|
||||
match.arr19[3] = totalResults >> 24;
|
||||
totalResults = (match.arrD[2] << 13) | (match.arrD[0] << 3) | (match.arrD[1] << 8);
|
||||
match.arr1D[0] = (match.arrD[0] << 3) | match.arrD[5];
|
||||
match.arr1D[1] = totalResults >> 8;
|
||||
totalResults |= (match.arrD[4] << 23) | (match.arrD[3] << 18);
|
||||
match.arr1D[2] = totalResults >> 16;
|
||||
match.arr1D[3] = totalResults >> 24;
|
||||
if (index) match.length = index;
|
||||
else match.length = 1;
|
||||
totalResults = match.arr1[5] | ((match.arr1[4] << 23) |
|
||||
((match.arr1[3] << 18) | ((match.arr1[2] << 13) |
|
||||
((match.arr1[0] << 3) | (match.arr1[1] << 8)))));
|
||||
match.arr19[0] = totalResults;
|
||||
match.arr19[1] = (totalResults >> 8) & 0xff;
|
||||
match.arr19[2] = (totalResults >> 16) & 0xff;
|
||||
match.arr19[3] = (Zi8UInt)totalResults >> 24;
|
||||
totalResults = match.arrD[5] | ((match.arrD[4] << 23) |
|
||||
((match.arrD[3] << 18) | ((match.arrD[2] << 13) |
|
||||
((match.arrD[0] << 3) | (match.arrD[1] << 8)))));
|
||||
match.arr1D[0] = totalResults;
|
||||
match.arr1D[1] = (totalResults >> 8) & 0xff;
|
||||
match.arr1D[2] = (totalResults >> 16) & 0xff;
|
||||
match.arr1D[3] = (Zi8UInt)totalResults >> 24;
|
||||
}
|
||||
totalResults = 0;
|
||||
if ((getMode == 1 || getMode == 2) && match.phon[0] == 0xFFFF && match.phon2[0] == 0xFFFF &&
|
||||
@@ -568,7 +569,7 @@ static int zi8InternalGetZH(ziGetParam* request, ZiChineseOptions* options, ziPt
|
||||
match.nCand = 0;
|
||||
goto engine_finish;
|
||||
}
|
||||
if (match.length >= 24) goto engine_finish;
|
||||
if (match.length > 23) goto engine_finish;
|
||||
if (wordMode && (getMode == 1 || getMode == 2)) {
|
||||
wordMode = 0;
|
||||
for (index = 0; index < match.nCand; ++index) {
|
||||
@@ -584,6 +585,9 @@ static int zi8InternalGetZH(ziGetParam* request, ZiChineseOptions* options, ziPt
|
||||
case 28: case 29:
|
||||
if (((ziFuzzyPYPairs*)&((struct __zi8_work_data_s*)work)->unk_0x1B28.word)->zANDzh) ordinalIndex = 0xFDFF;
|
||||
break;
|
||||
case 56: case 59:
|
||||
if (((ziFuzzyPYPairs*)&((struct __zi8_work_data_s*)work)->unk_0x1B28.word)->fANDh) ordinalIndex = 0xF9FF;
|
||||
break;
|
||||
case 38:
|
||||
if (((ziFuzzyPYPairs*)&((struct __zi8_work_data_s*)work)->unk_0x1B28.word)->nANDl) ordinalIndex = 0xE5FF;
|
||||
break;
|
||||
@@ -595,9 +599,6 @@ static int zi8InternalGetZH(ziGetParam* request, ZiChineseOptions* options, ziPt
|
||||
case 44:
|
||||
if (((ziFuzzyPYPairs*)&((struct __zi8_work_data_s*)work)->unk_0x1B28.word)->lANDr) ordinalIndex = 0xF1FF;
|
||||
break;
|
||||
case 56: case 59:
|
||||
if (((ziFuzzyPYPairs*)&((struct __zi8_work_data_s*)work)->unk_0x1B28.word)->fANDh) ordinalIndex = 0xF9FF;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch ((int)match.phon2[index] >> 9) {
|
||||
@@ -610,6 +611,15 @@ static int zi8InternalGetZH(ziGetParam* request, ZiChineseOptions* options, ziPt
|
||||
case 28: case 29:
|
||||
if (((ziFuzzyZYPairs*)&((struct __zi8_work_data_s*)work)->unk_0x1B2C.word)->zANDzh) ordinalIndex = 0xFDFF;
|
||||
break;
|
||||
case 56: case 59:
|
||||
if (((ziFuzzyZYPairs*)&((struct __zi8_work_data_s*)work)->unk_0x1B2C.word)->fANDh) ordinalIndex = 0xF9FF;
|
||||
break;
|
||||
case 52: case 55:
|
||||
if (((ziFuzzyZYPairs*)&((struct __zi8_work_data_s*)work)->unk_0x1B2C.word)->bANDp) ordinalIndex = 0xF9FF;
|
||||
break;
|
||||
case 60: case 63:
|
||||
if (((ziFuzzyZYPairs*)&((struct __zi8_work_data_s*)work)->unk_0x1B2C.word)->gANDk) ordinalIndex = 0xF9FF;
|
||||
break;
|
||||
case 38:
|
||||
if (((ziFuzzyZYPairs*)&((struct __zi8_work_data_s*)work)->unk_0x1B2C.word)->nANDl && ((ziFuzzyZYPairs*)&((struct __zi8_work_data_s*)work)->unk_0x1B2C.word)->rANDn) ordinalIndex = 0xE1FF;
|
||||
else if (((ziFuzzyZYPairs*)&((struct __zi8_work_data_s*)work)->unk_0x1B2C.word)->nANDl) ordinalIndex = 0xE5FF;
|
||||
@@ -625,15 +635,6 @@ static int zi8InternalGetZH(ziGetParam* request, ZiChineseOptions* options, ziPt
|
||||
else if (((ziFuzzyZYPairs*)&((struct __zi8_work_data_s*)work)->unk_0x1B2C.word)->rANDn) ordinalIndex = 0xE3FF;
|
||||
else if (((ziFuzzyZYPairs*)&((struct __zi8_work_data_s*)work)->unk_0x1B2C.word)->lANDr) ordinalIndex = 0xF1FF;
|
||||
break;
|
||||
case 52: case 55:
|
||||
if (((ziFuzzyZYPairs*)&((struct __zi8_work_data_s*)work)->unk_0x1B2C.word)->bANDp) ordinalIndex = 0xF9FF;
|
||||
break;
|
||||
case 56: case 59:
|
||||
if (((ziFuzzyZYPairs*)&((struct __zi8_work_data_s*)work)->unk_0x1B2C.word)->fANDh) ordinalIndex = 0xF9FF;
|
||||
break;
|
||||
case 60: case 63:
|
||||
if (((ziFuzzyZYPairs*)&((struct __zi8_work_data_s*)work)->unk_0x1B2C.word)->gANDk) ordinalIndex = 0xF9FF;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ordinalIndex) {
|
||||
@@ -652,10 +653,10 @@ static int zi8InternalGetZH(ziGetParam* request, ZiChineseOptions* options, ziPt
|
||||
if (((ziFuzzyPYPairs*)&((struct __zi8_work_data_s*)work)->unk_0x1B28.word)->anANDang) ordinalIndex = 0xFFF7;
|
||||
break;
|
||||
case 0x60:
|
||||
if (((ziFuzzyPYPairs*)&((struct __zi8_work_data_s*)work)->unk_0x1B28.word)->inANDing) ordinalIndex = 0xFFF7;
|
||||
if (((ziFuzzyPYPairs*)&((struct __zi8_work_data_s*)work)->unk_0x1B28.word)->enANDeng) ordinalIndex = 0xFFF7;
|
||||
break;
|
||||
case 0x180:
|
||||
if (((ziFuzzyPYPairs*)&((struct __zi8_work_data_s*)work)->unk_0x1B28.word)->enANDeng) ordinalIndex = 0xFFF7;
|
||||
if (((ziFuzzyPYPairs*)&((struct __zi8_work_data_s*)work)->unk_0x1B28.word)->inANDing) ordinalIndex = 0xFFF7;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -81,3 +81,45 @@ ZiMatchZHSpelling, 484 target bytes: all blocks are already translated, with 121
|
||||
- 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.
|
||||
|
||||
## First-divergence matching, round 3 on ad3da3bb
|
||||
|
||||
Baseline: engine 76.78999%, frame 0x4e0, 10,566/10,676 instructions. Exact first divergence is +0x000c, the individual register saves versus the target _savegpr_27 call. All initialization stack offsets agree; after aligning past the save sequence and ignoring GPR numbers and branch spans, the first instruction-form difference is +0x05e4, table 27 count assignment.
|
||||
|
||||
- Attempt 01: moved the two charset zero initializations into their declarations. Instruction stream and 76.78999% score unchanged; first divergence +0x000c. Rejected.
|
||||
- Attempt 02: explicitly converted the table 27 count to its halfword destination type. Engine 76.90586%, 10,563/10,676 instructions; first divergence +0x000c. First body form difference remains +0x05e4. Quick gate PASS, zero regressions. Kept for its measured score gain.
|
||||
- Attempt 03: changed the explicit conversion to unsigned int. Same 76.90586% stream and first divergence +0x000c; restored attempt 02.
|
||||
- Attempt 04: gave the table-range index a field in a range-state aggregate. Match buffer moved eight bytes, body form divergence moved earlier to +0x0020, engine 76.59067%; rejected. Exact first divergence stayed +0x000c.
|
||||
- Attempt 05: corrected the prepare-match return declaration to ziBool as in zprepare.c. Stream and 76.90586% unchanged, first divergence +0x000c; restored.
|
||||
- Attempt 06: combined the table-count assignment with its following condition. Engine 76.72677%, first divergence +0x000c; rejected.
|
||||
- Attempt 07: tried unsigned result-count storage; compiler rejected its address at the signed result-count helper parameter. No measurement from that failed build is used. Restored the signed count.
|
||||
- Attempt 08: used zaddress.c's word return declaration for table addresses, with correctly typed pointer conversions. Stream and 76.90586% unchanged, first divergence +0x000c; restored.
|
||||
- Attempt 09: tried a word-return table-count declaration. Extra halfword conversions regressed the already-exact phonetic helper, engine 76.524635%, first divergence +0x000c; rejected.
|
||||
- Attempt 10: reconstructed the full six-term packed masks in target expression order and masked the extracted bytes. Engine 76.83871%, first divergence +0x000c; retained only as a scratch precursor to attempt 11.
|
||||
- Attempt 11: completed that prefix block with shared clear/fill assignments, target store order, the two missing fourth-byte writes, and target bound/branch forms. Engine 77.37008%, frame 0x4e0, 10,568/10,676 instructions; first divergence +0x000c. Four individual register saves now differ from the target five-register helper. Quick gate PASS, zero regressions.
|
||||
- Attempt 12: used the library signed-word typedef for the phase counter. Same 77.37008% stream, first divergence +0x000c; rejected.
|
||||
- Attempt 13: converted the complete packed-mask expressions to unsigned word values. Same 77.37008% stream, first divergence +0x000c; rejected.
|
||||
- Attempt 14: restored fuzzy-phonetic case emission order and corrected the PY final-code flags from the target bit extractions: code 0x60 tests enANDeng and code 0x180 tests inANDing. Engine 77.52538%, 10,568/10,676 instructions, first divergence +0x000c; quick gate PASS, zero regressions.
|
||||
- Attempt 15: used signed-word result storage and the corresponding helper output parameter type. Same 77.52538% stream and first divergence +0x000c; rejected.
|
||||
- Attempt 16: removed the earlier explicit table-count conversion after the mask reconstruction. Engine fell to 77.498505%, first divergence +0x000c; restored.
|
||||
- Attempt 17: used an unsigned-word engine return type for the nonnegative count. Engine stream and 77.52538% score unchanged, first divergence +0x000c; wrapper stayed instruction-exact. Restored the accepted declaration.
|
||||
|
||||
### Zi8GetElementCount, round 3
|
||||
|
||||
1. Put count before the two cursor declarations. Same 115/115 instructions, thirteen GPR differences, 99.347824%. Rejected.
|
||||
2. Widen count to int. Ctxdiff still showed thirteen GPR differences; objdiff reported 98.391304%, so restored the byte count.
|
||||
3. Use explicit count = count + 1 assignments. 117/115 instructions, redundant byte conversions, 97.608696%. Rejected.
|
||||
|
||||
Remaining accepted difference: elementCount uses r27 instead of r28; count uses r28 instead of r27. All thirteen differing instructions are those two GPR names.
|
||||
|
||||
### ZiMatchZHSpelling, round 3
|
||||
|
||||
1. Store the Boolean result in ziBool. 122/121 instructions, extra byte conversion, 97.06612%. Rejected.
|
||||
2. Initialize matches and the read-only candidate length in their declarations. Same 121/121 instructions, 29 GPR differences, 98.80165%. Rejected.
|
||||
3. Pass the typed ZI_WORK view to the helpers. Same 121/121 instructions, 29 GPR differences, 98.80165%. Rejected.
|
||||
|
||||
Remaining accepted differences: candidate, spelling, input length, work, candidate length and Boolean result GPR assignments. Branches, stack offsets and instruction counts agree.
|
||||
|
||||
No exact functions were added in this round. The engine's frame and local offsets are correct, but the first exact divergence remains +0x000c. Its four individual saves differ from the target _savegpr_27 sequence, and later expression/control-flow differences remain. All rejected source variants were restored.
|
||||
|
||||
Final clean full gate: PASS; pool identical, zero baseline regressions, zero forbidden-pattern additions and readability warnings. Full build passed with target DOL SHA1 26116613f624061ba99c8d1a299aaa6efa85670d. Unit 5/8 exact, code 4168/47816, data 24/536, fuzzy 79.9097%. Engine 76.78999% to 77.52538%, first divergence +0x000c to +0x000c; element count 99.347824% and spelling 98.80165% unchanged.
|
||||
|
||||
Reference in New Issue
Block a user