Compare commits
1 Commits
main
...
agent/bitt
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
94b1c4d1ab |
@@ -17,7 +17,7 @@ typedef struct ziPudHeader {
|
||||
ziU8 options[4];
|
||||
ziPudSection sections[1];
|
||||
} ziPudHeader;
|
||||
ziU32 Zi8_8147FD7C(ziWChar*, ziU8, ziU8, ziWChar*, ziU16, ziU8, ziU8 ZI_NEED_WORK);
|
||||
ziU8 Zi8_8147FD7C(ziWChar*, ziU8, ziU8, ziWChar*, ziU16, ziU8, ziU8 ZI_NEED_WORK);
|
||||
|
||||
ziU32 ZiIsPhoneticChar(ziWChar character) {
|
||||
if ((character < 0xF305 || character > 0xF329) && (character < 0xF361 || character > 0xF37A)) return 0;
|
||||
@@ -56,7 +56,7 @@ ziU8 ZADP_Zi8SetPDremoveOpt(ziU8 option, struct __zi8_work_data_s* __zi8_work_da
|
||||
Zi8LogError(100, __zi8_work_data);
|
||||
return previous;
|
||||
}
|
||||
ziU32 Zi8MatchPUDdata_ZHS(ziWChar* pattern, ziU8 length, ziU8 language, ziWChar* output, ziU16 capacity, ziWChar* spelling, ziU16 spellingCapacity, ziU8 complete, ziU8 continuation ZI_NEED_WORK) {
|
||||
ziU8 Zi8MatchPUDdata_ZHS(ziWChar* pattern, ziU8 length, ziU8 language, ziWChar* output, ziU16 capacity, ziWChar* spelling, ziU16 spellingCapacity, ziU8 complete, ziU8 continuation ZI_NEED_WORK) {
|
||||
int fallback = 0;
|
||||
ziU8* bytePattern;
|
||||
ziWChar folded;
|
||||
@@ -88,8 +88,8 @@ ziU32 Zi8MatchPUDdata_ZHS(ziWChar* pattern, ziU8 length, ziU8 language, ziWChar*
|
||||
Zi8LogError(0x4F6, __zi8_work_data);
|
||||
return 0;
|
||||
}
|
||||
ZI_WORK->unk_0x314 = section->count[0] * 0x100 + section->count[1];
|
||||
ZI_WORK->unk_0x310 = (ziU32)table + section->offset[0] * 0x100 + section->offset[1];
|
||||
ZI_WORK->unk_0x314 = ((ziU16)section->count[0] << 8) + (ziU16)section->count[1];
|
||||
ZI_WORK->unk_0x310 = (ziU32)table + (((ziU16)section->offset[0] << 8) + (ziU16)section->offset[1]);
|
||||
ZI_WORK->unk_0x318 = 0;
|
||||
}
|
||||
for (;;) {
|
||||
@@ -174,12 +174,12 @@ matched:
|
||||
}
|
||||
}
|
||||
}
|
||||
ziU32 Zi8MatchPUDdata(ziWChar* pattern, ziU8 length, ziU8 language, ziWChar* output, ziU16 capacity, ziU8 complete, ziU8 continuation, struct __zi8_work_data_s* __zi8_work_data) {
|
||||
ziU32 result;
|
||||
ziU8 Zi8MatchPUDdata(ziWChar* pattern, ziU8 length, ziU8 language, ziWChar* output, ziU16 capacity, ziU8 complete, ziU8 continuation, struct __zi8_work_data_s* __zi8_work_data) {
|
||||
ziU8 result;
|
||||
if (continuation == 0) __zi8_work_data->pudCount = 1;
|
||||
for (;;) {
|
||||
result = Zi8_8147FD7C(pattern, length, language, output, capacity, complete, continuation, __zi8_work_data);
|
||||
if ((ziU8)result != 0) break;
|
||||
if (result != 0) break;
|
||||
if (++__zi8_work_data->pudCount <= 16) {
|
||||
continuation = 0;
|
||||
} else {
|
||||
@@ -189,6 +189,6 @@ ziU32 Zi8MatchPUDdata(ziWChar* pattern, ziU8 length, ziU8 language, ziWChar* out
|
||||
}
|
||||
return result;
|
||||
}
|
||||
ziU32 Zi8_8147FD7C(ziWChar* pattern, ziU8 length, ziU8 language, ziWChar* output, ziU16 capacity, ziU8 complete, ziU8 continuation ZI_NEED_WORK) {
|
||||
ziU8 Zi8_8147FD7C(ziWChar* pattern, ziU8 length, ziU8 language, ziWChar* output, ziU16 capacity, ziU8 complete, ziU8 continuation ZI_NEED_WORK) {
|
||||
return Zi8MatchPUDdata_ZHS(pattern, length, language, output, capacity, 0, 0, complete, continuation, __zi8_work_data);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
# PUD byte-return producer contract, 2026-10-03
|
||||
|
||||
Base: a894ff5c; branch agent/bittle/pud-return-contract.
|
||||
Owned source: zi8pud2.c only. The copied cache was refreshed by a configured
|
||||
full 43U build before recording the baseline. No caller or header changed.
|
||||
|
||||
## Producer and caller evidence
|
||||
|
||||
Every Zi8MatchPUDdata_ZHS exit returns zero, one, or an explicitly byte-cast
|
||||
copied count. Zi8_8147FD7C forwards that result directly. Zi8MatchPUDdata
|
||||
receives it, tests its byte value, and returns it; it never consumes any
|
||||
higher result bits. The target wrapper retains exactly this data flow.
|
||||
|
||||
All external callers use byte-return declarations: zi8alpha.c and zi81key.c
|
||||
for Zi8MatchPUDdata, and zi8cgetc.c for Zi8MatchPUDdata_ZHS. The previously
|
||||
attempted caller-side full-word corrections were therefore based on a
|
||||
misreconstructed producer chain rather than a demonstrated wide result.
|
||||
|
||||
Recovered ziU8 returns for all three functions and their local forward
|
||||
declaration, plus ziU8 for the wrapper result local. Its test now uses the
|
||||
typed byte directly. The explicit cast of copied in the actual producer
|
||||
remains. Changing the coherent chain preserves the complete compiled object;
|
||||
no compensating caller masks, local aliases, storage or register constraints
|
||||
are required.
|
||||
|
||||
## Validation
|
||||
|
||||
Baseline report: /tmp/ezi-pud-baseline.json.
|
||||
Baseline object: /tmp/ezi-pud-return-contract/baseline.o.
|
||||
Final report: /tmp/ezi-pud-return-full-report.json.
|
||||
Full build: /tmp/ezi-pud-return-full-build.log.
|
||||
Detailed gates: /tmp/ezi-pud-return-verification.txt.
|
||||
|
||||
The complete zi8pud2.o file is byte-identical to baseline, including symbol
|
||||
strings. Every function's disassembly is unchanged. All 1027 full-report
|
||||
unit measures are unchanged: unit fuzzy 98.88764%, ZHS 98.32204%, exact
|
||||
functions 6/7, exact code 720/2136 and exact data 48/120. This is a contract
|
||||
correction, not a percentage gain or a new exact function.
|
||||
|
||||
All six existing exact functions retain ctxdiff diffs 0 and identical counts:
|
||||
ZiIsPhoneticChar 16, ZiGetZHWordSize 31, Zi8CopyZHSpelling 33,
|
||||
ZADP_Zi8SetPDremoveOpt 21, Zi8MatchPUDdata 50, Zi8_8147FD7C 29.
|
||||
The unmatched producer remains 349/354 instructions. Allocated section sizes,
|
||||
payloads and canonical relocations are unchanged: .text 2116, extab 48,
|
||||
extabindex 72.
|
||||
|
||||
Pool first: identical and empty. Full 43U build passes with the approved
|
||||
wrapper and WIBO_SJIS_MISSING_IMPORTS=1. DOL SHA1:
|
||||
26116613f624061ba99c8d1a299aaa6efa85670d.
|
||||
git diff --check passes. No remote, linking, metadata, header, caller,
|
||||
assembly, volatile, dummy-storage or undefined-value change.
|
||||
@@ -0,0 +1,77 @@
|
||||
# PUD packed-header halfword decoding, 2026-10-03
|
||||
|
||||
Parent: a71dfa9c; its byte-return correction is unchanged.
|
||||
Owned source: two expressions in zi8pud2.c / Zi8MatchPUDdata_ZHS.
|
||||
|
||||
## Recovered arithmetic and widths
|
||||
|
||||
The eight-byte PUD section record contains two-byte big-endian count and
|
||||
offset fields. The target separately promotes each of their four component
|
||||
bytes through a halfword boundary before shifting or adding. The source
|
||||
previously expressed plain byte arithmetic and omitted those four target
|
||||
conversions.
|
||||
|
||||
Restored explicit ziU16 promotions for count[0], count[1], offset[0] and
|
||||
offset[1]. The offset is now decoded as one grouped big-endian value before
|
||||
adding the table base. This reproduces the target's base/high/low load and
|
||||
addition order, without a new local, helper, casted memory access or storage.
|
||||
|
||||
Bounded isolated trials, all retaining 6 exact functions and 48 exact data:
|
||||
- Halfword promotions with the existing offset association:
|
||||
ZHS 98.52542%, unit 99.02247%
|
||||
- Conventional grouped high/low offset sum:
|
||||
ZHS 99.717514%, unit 99.81274%; selected
|
||||
- Grouped low/high offset sum:
|
||||
ZHS 99.10452%, unit 99.406364%; rejected
|
||||
- Grouped multiplication form:
|
||||
ZHS 99.10452%, unit 99.406364%; rejected
|
||||
|
||||
All 65,536 possible packed values preserve the decoded count. Another
|
||||
524,288 offset/base combinations, covering eight bases including 32-bit
|
||||
wrap boundaries for every packed value, preserve the computed address.
|
||||
These arithmetic tests supplement the target instruction correspondence.
|
||||
|
||||
## Remaining workspace snapshot
|
||||
|
||||
The target stores its incoming workspace pointer once into frame 0x24 at
|
||||
function +0x3C. A width-aware access and address-provenance audit finds no
|
||||
read, overlapping use, or address escape for that slot. The workspace stays
|
||||
in its existing saved register. The only ordinary local whose address is
|
||||
passed to a helper is the halfword at frame 0x0E. Save/restore addresses the
|
||||
separate upper frame region. No source-visible distinct alias role was found.
|
||||
|
||||
That single dead store remains absent. No unused local, dummy assignment,
|
||||
padding, volatile or forced spill was added to manufacture it.
|
||||
|
||||
## Validation
|
||||
|
||||
Fresh final report: /tmp/ezi-pud-packed-full-report.json.
|
||||
Full build: /tmp/ezi-pud-packed-full-build.log.
|
||||
Detailed gates: /tmp/ezi-pud-packed-verification.txt.
|
||||
Snapshot audit: /tmp/ezi-pud-work-snapshot-audit.txt.
|
||||
|
||||
Zi8MatchPUDdata_ZHS: 98.32204% -> 99.717514%.
|
||||
Unit fuzzy: 98.88764% -> 99.81274%, about 19.76 weighted bytes gained.
|
||||
Exact functions remain 6/7, exact code 720/2136, exact data 48/120.
|
||||
All 1027 units and their per-function fuzzy scores were checked with no
|
||||
regressions; this unit/producer improvement is the only measure change.
|
||||
|
||||
Producer instructions: 349 -> 353 versus target 354.
|
||||
Producer size: 0x574 -> 0x584 versus target 0x588; frame remains 0x60.
|
||||
After accounting solely for the missing dead store and its four-byte branch
|
||||
destination displacement, every remaining instruction is identical, including
|
||||
registers, immediates, calls and memory operands. All 65 direct branches and
|
||||
13 calls correspond. This is not an exact match: the missing instruction
|
||||
and function extent are explicitly retained as unresolved.
|
||||
|
||||
All six existing exact functions retain ctxdiff diffs 0 and identical counts.
|
||||
The 48-byte extab is baseline-identical. The already-unmatched 72-byte
|
||||
extabindex changes only the producer extent byte at 0x2B, 0x74 -> 0x84;
|
||||
canonical relocations and its 98.61111% score are unchanged. No real data
|
||||
object, section extent or metadata declaration was changed.
|
||||
|
||||
Pool first: identical and empty. Full 43U build passes with the approved
|
||||
wrapper and WIBO_SJIS_MISSING_IMPORTS=1. DOL SHA1:
|
||||
26116613f624061ba99c8d1a299aaa6efa85670d.
|
||||
git diff --check passes. No remote, linking, header, new assembly, volatile,
|
||||
dummy-storage, undefined-value or forced-register changes.
|
||||
Reference in New Issue
Block a user