Compare commits

...

19 Commits

Author SHA1 Message Date
Devin AI
1b1d8478ee fossils: volatile-cast lever assessed on _create_icon — webs are address math, not polled reloads
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-09 05:59:23 +00:00
Devin AI
fa54f5273b fossils: document w1011e decode batch — inputChar dead-cmp fossil + dTT/#1305 rotation + _create_icon assoc
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-09 04:30:58 +00:00
Devin AI
1d98763ae1 fossils: drop dTT source changes in favor of merged #1305
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-09 04:10:41 +00:00
Devin AI
c3e418f687 fossils: dTT insn-equal via if+while guards, addic. fuse, hoisted needles
- newline counter: if+while (beq guard + b-to-test) replaces if+do-while
- totalLines guard if(totalLines>0)+while -> addic.+ble zero-trip fusion
- named sep needles inside guard blocks -> callee-reg hoisted args
- fmuls operand order via visibleRows * rowHeight
- 447v451/38d -> 451v451/36d; residual = frame-slot packing + reg renames

Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-09 04:10:33 +00:00
Devin AI
77883a9e61 fossils: structural-decode pass on inputChar compare fossil — wall confirmed
~10 more arm variants (dead-store arms, control forms, narrow/uninit
index decls, count-as-index) all fold or add insns. Wall documented: the
phi arm must emit zero insns while keeping the index symbolic — requires
MWCC to elide both the arm li and the guard branch; likely a phase-order
quirk no source form reproduces.

Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-09 04:10:27 +00:00
Devin AI
65c25e01f4 fossils: scheduling/opt-level pragma pass — all levers inert or regressions
- dTT: scheduling 604/750/7400, schedule_twice, opt_level 0/2/4, TU
  -ipa function/off, -O4 variants, shared-gx, named-assign objects —
  451/451 insn-equal stands at 90d; residual = slot-pool assignment +
  arg remat + reg permutation (documented pool-overlay decode)
- inputChar: all scheduling/opt/ipa inert; committed -O4,p is
  load-bearing (removing drops 4 insns); bool-assign arm rejected
- _create_icon: all levers inert (20d) or regressions

Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-09 04:10:27 +00:00
Devin AI
82dde0ce67 fossils: ppc_iro_level + discarded-temp decode -> insn-equal on 2 fns
drawTransferTitles: #pragma ppc_iro_level 0 + bare discarded
nw4r::ut::Color(*re) statement keeps the third copy alive => 451/451
insn-equal (was 438/451). Residual: frame +0x10, temp-slot packing,
mr-vs-addi remat, reg coloring.

inputChar: ppc_iro_level 4 + inputBuf second-pointer + phi arm =>
136/136 insn-equal (was 125/136). Residual: compare-without-branch
fossil arm (produces no insns in orig), mr-vs-addi base copy.

_create_icon: pragma rejected (0 and 1 both regress 100v100->124v100);
committed form stands.

Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-09 04:10:27 +00:00
Devin AI
1c7e31510e tiString inputChar: symbolic-index decode (135/136); document fossils walls
inputChar: u32 inputIndex + if(ch==10) phi reproduces orig's symbolic
indexed stores + clrlwi count-narrow (135/136, was 125/136). Dead
cmplwi fossil remains - no source form emits compare-without-branch.

Documented: drawTransferTitles three-Color-copy structure (orig keeps
one dead Color copy per call; every eliminability lever fails), create
3-web pin rotation, _create_icon remat-vs-pin - all allocator-internal.

Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-09 04:10:27 +00:00
coah
55891734ae fix(chansvm): use compatible const converter callback types (#1307) 2026-10-08 22:46:39 -05:00
coah
20cf9f9f25 decomp(aterm): GC/3.0a5 build, AutoConfigThread and AES key expansion exact (worker b7300afa) (#1306) 2026-10-08 22:25:25 -05:00
coah
2a7cc791b1 decomp(sdmemory): drawTransferTitles via MSL wcsstr overload and TextBox::SetTextColor (363->50) (worker 9b634499) (#1305) 2026-10-08 22:23:33 -05:00
coah
b2c43f5a66 decomp(chansvm): ConvertToFloatFromStr const source, VmDateDtor scoped tables (worker db63d910) (#1304) 2026-10-08 22:22:23 -05:00
coah
d9b8013644 decomp(aoss): match AOSSXorBufferWithKey (worker 8c6b3076) (#1303) 2026-10-08 22:20:46 -05:00
coah
40b87edd73 fix(odh): preserve unsigned refills and defer planar addressing (#1302) 2026-10-08 21:45:46 -05:00
coah
3d7e767cf7 decomp(odh): match LineConv11 and huffmanDecoder, link odh (worker 9b2c5837) (#1301) 2026-10-08 21:32:36 -05:00
coah
10146c1b5f decomp(candidatebox): match createAnmPane_ and link tiCandidateBox (worker 6dca7c84) (#1300) 2026-10-08 21:23:21 -05:00
coah
82783c6edb decomp(bs2): match UpdateThread and link BS2Update (Flags0 as function-local static) (worker 85186112) (#1299) 2026-10-08 21:19:40 -05:00
coah
72e9c8d658 decomp(kbd): match kbdProcMod and link kbd_lib (worker 86bbfe55) (#1298) 2026-10-08 20:55:10 -05:00
coah
0062d65a27 decomp(chansvm): VmBlobPackCommon per-phase locals (230 -> 47) (worker 69c0cd0d) (#1297) 2026-10-08 20:01:19 -05:00
31 changed files with 1449 additions and 633 deletions

View File

@@ -42,7 +42,7 @@ AppLoaderHdr = .bss:0x810ABF40; // type:object size:0x20 align:32 data:4byte
bi2 = .bss:0x810ABF60; // type:object size:0x2000 align:32 data:4byte
UpdateDiskID = .bss:0x810ADF60; // type:object size:0x20 align:32 data:4byte
TicketViewsBuf = .bss:0x810ADF80; // type:object size:0x3600 scope:local align:32
Flags0 = .bss:0x810B1580; // type:object size:0x800 scope:local
Flags0$1129 = .bss:0x810B1580; // type:object size:0x800 scope:local
Flags1 = .bss:0x810B1D80; // type:object size:0x800 scope:local
Thread = .bss:0x810B2580; // type:object size:0x318 scope:local
UpdateHeader0 = .bss:0x810B38A0; // type:object size:0x20 scope:local
@@ -4900,8 +4900,8 @@ onDialogState23__Q33ipl5scene8SDMemoryFv = .text:0x813EEDF8; // type:function si
onDialogState24__Q33ipl5scene8SDMemoryFv = .text:0x813EEE70; // type:function size:0xC0
draw__Q33ipl5scene8SDMemoryFv = .text:0x813EEF30; // type:function size:0x88
drawTransferTitles__Q33ipl5scene8SDMemoryFv = .text:0x813EEFB8; // type:function size:0x70C
writeFourFlagBytes__Q23ipl5sceneFPUcUcUcUcUc = .text:0x813EF6C4; // type:function size:0x14
setTitleRowColors__Q23ipl5sceneFPQ34nw4r3lyt7TextBoxRCQ34nw4r2ut5ColorRCQ34nw4r2ut5Color = .text:0x813EF6D8; // type:function size:0x48
__ct__Q34nw4r2ut5ColorFiiii = .text:0x813EF6C4; // type:function size:0x14
SetTextColor__Q34nw4r3lyt7TextBoxFQ34nw4r2ut5ColorQ34nw4r2ut5Color = .text:0x813EF6D8; // type:function size:0x48
GetBeginIter__Q34nw4r2ut28LinkList<Q34nw4r3lyt4Pane,4>Fv = .text:0x813EF720; // type:function size:0x8
GetEndIter__Q34nw4r2ut28LinkList<Q34nw4r3lyt4Pane,4>Fv = .text:0x813EF728; // type:function size:0x8
__ne__Q24nw4r2utFQ44nw4r2ut28LinkList<Q34nw4r3lyt4Pane,4>8IteratorQ44nw4r2ut28LinkList<Q34nw4r3lyt4Pane,4>8Iterator = .text:0x813EF730; // type:function size:0x18
@@ -17727,7 +17727,7 @@ __vt__Q39textinput4util9Animation = .data:0x8165D258; // type:object size:0x24
@STRING@GetTextColor__Q34nw4r3lyt7TextBoxCFUl = .data:0x8165D28C; // type:object size:0x41 data:string
scT_prdc_Text_00 = .data:0x8165D2D0; // type:object size:0xF data:string
scP_prdc_scrl_Left = .data:0x8165D2E0; // type:object size:0x11 data:string
scCandidatePaneData = .data:0x8165D2F8; // type:object size:0x680
csPaneToAnimation__Q29textinput12candidatebox = .data:0x8165D2F8; // type:object size:0x680 scope:local
@9934 = .data:0x8165D978; // type:object size:0x9 scope:local data:string
@9935 = .data:0x8165D984; // type:object size:0x9 scope:local data:string
@9936 = .data:0x8165D990; // type:object size:0xB scope:local data:string

View File

@@ -658,7 +658,7 @@ config.libs = [
Object(Matching, "system/iplChannelRsoThread.cpp"),
Object(Matching, "system/RsoSystem.cpp"),
Object(Matching, "system/iplCdbBackup.cpp"),
Object(NonMatching, "system/odh.cpp"),
Object(Matching, "system/odh.cpp"),
Object(Matching, "system/iplSDVFWorker.cpp"),
Object(Matching, "system/iplNandWrapper.cpp"),
Object(Matching, "system/main.cpp"),
@@ -719,7 +719,7 @@ config.libs = [
Object(Matching, "BS2/BS2.c"),
Object(Matching, "BS2/BS2Init.c"),
Object(NonMatching, "BS2/BS2Mach.c"),
Object(NonMatching, "BS2/BS2Update.c"),
Object(Matching, "BS2/BS2Update.c"),
Object(Matching, "BS2/BS2ParentalControl.c"),
Object(Matching, "BS2/BS2BringUp.c"),
Object(Matching, "BS2/BS2Reset.c"),
@@ -880,7 +880,7 @@ config.libs = [
Object(Matching, "scene/setting/iplRakuRakuThread.cpp"),
Object(NonMatching, "scene/setting/AOSS.c", extra_cflags=["-O4,p", "-inline off"]),
Object(Matching, "scene/setting/AOSSData.c"),
Object(NonMatching, "scene/setting/ATERM.c", extra_cflags=["-O4,p", "-inline on"]),
Object(NonMatching, "scene/setting/ATERM.c", mw_version="GC/3.0a5", extra_cflags=["-O4,p", "-inline on"]),
]
),
IPLSection("settingSelect", [
@@ -912,7 +912,7 @@ config.libs = [
Object(Matching, "keyboard/tiPcKeyboard.cpp", extra_cflags=["-O4,p"]),
Object(Matching, "keyboard/tiCellPhone.cpp", extra_cflags=["-O4,p"]),
Object(NonMatching, "keyboard/tiInputForm.cpp", extra_cflags=["-O4,p"]),
Object(NonMatching, "keyboard/tiCandidateBox.cpp", extra_cflags=["-O4,p"]),
Object(Matching, "keyboard/tiCandidateBox.cpp", extra_cflags=["-O4,p"]),
Object(Matching, "keyboard/tiToolBar.cpp", extra_cflags=["-O4,p"]),
Object(Matching, "keyboard/tiPredictLang.cpp", extra_cflags=["-O4,p"]),
Object(Matching, "keyboard/tiSignWindow.cpp", extra_cflags=["-O4,p"]),
@@ -1886,7 +1886,7 @@ config.libs = [
]
),
RVLSDKLib("kbd", [
Object(NonMatching, "kbd/kbd_lib.c"),
Object(Matching, "kbd/kbd_lib.c"),
Object(NonMatching, "kbd/kbd_lib_map_jp.c"),
Object(Matching, "kbd/kbd_lib_map_us.c"),
Object(NonMatching, "kbd/kbd_lib_map_eu.c"),

View File

@@ -7,7 +7,7 @@
extern "C" {
#endif
typedef CHANSVmObjHdr* (*VmConvertFunc)(CHANSVm*, CHANSVmObjType, CHANSVmObjHdr*);
typedef CHANSVmObjHdr* (*VmConvertFunc)(CHANSVm*, CHANSVmObjType, const CHANSVmObjHdr*);
typedef struct VmConvertEntry {
VmConvertFunc convFunc[6]; // 0x00

View File

@@ -77,7 +77,7 @@ namespace textinput {
class Base : public CommandSender {
public:
#ifdef TIMANAGER_IMPLEMENTATION
#if defined(TIMANAGER_IMPLEMENTATION) || defined(TI_CANDIDATEBOX_SAMPLE_CLASS)
Base(Manager* manager) : mpCandidates(NULL), mpAllocator(NULL), mbOn(false), mbInvalid(true), meLanguage(USA), mpManager(manager) {}
#endif
virtual ~Base();
@@ -114,7 +114,7 @@ namespace textinput {
class EventHandler : public nw4rmanager::TiEventHandler {
public:
#ifdef TIMANAGER_IMPLEMENTATION
#if defined(TIMANAGER_IMPLEMENTATION) || defined(TI_CANDIDATEBOX_SAMPLE_CLASS)
EventHandler(LayoutByNW4R* layout) : mpLayoutByNW4R(layout) {}
#endif
virtual void onTiEvent(gui::PaneComponent* paneComponent, u32 event, Input* input) override; // 0x18
@@ -302,7 +302,7 @@ namespace textinput {
// TODO
class LayoutByNW4R : public Base, public nw4rmanager::Layout, public UIObj::Listener {
public:
#ifdef TIMANAGER_IMPLEMENTATION
#if defined(TIMANAGER_IMPLEMENTATION) || defined(TI_CANDIDATEBOX_SAMPLE_CLASS)
LayoutByNW4R(Manager* manager, nw4r::lyt::MultiArcResourceAccessor* accessor, EventObserver* observer, const char* layoutName)
: Base(manager), nw4rmanager::Layout(accessor, layoutName, observer), mEventHandler(this), mpTiString(NULL),
mTextArea(0, this, this), mLeftScroll(1, this, this), mRightScroll(2, this, this), mOnOffButton(3, this, this),
@@ -371,6 +371,15 @@ namespace textinput {
bool mbActive;
};
#ifdef TI_CANDIDATEBOX_SAMPLE_CLASS
class Sample : public LayoutByNW4R {
public:
Sample(Manager* manager, nw4r::lyt::MultiArcResourceAccessor* accessor, EventObserver* observer, const char* layoutName)
: LayoutByNW4R(manager, accessor, observer, layoutName) {}
virtual ~Sample() {}
};
#endif
class CandidateTextAnmPane : public nw4rmanager::AnmPane {
public:
CandidateTextAnmPane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer)

View File

@@ -15,7 +15,7 @@ namespace ipl {
Manager(EGG::Heap* heap);
/** @return The message data in use. */
const wchar_t* getMessage(u32 id) const { return mpMessage->getMessage(id); }
wchar_t* getMessage(u32 id) const { return mpMessage->getMessage(id); }
void setResource(u8* msgData) const { mpMessage->setResource(msgData); }
private:

View File

@@ -302,7 +302,7 @@ namespace ipl {
}
/** @return The Message ID as a Wide-string. */
static const wchar_t* getMessage(u32 id) { return smArg.mpMessageMgr->getMessage(id); }
static wchar_t* getMessage(u32 id) { return smArg.mpMessageMgr->getMessage(id); }
static message::Manager* getMessageManager() { return smArg.mpMessageMgr; }
static void* getFont();

View File

@@ -27,7 +27,11 @@ wchar_t* wcscat(wchar_t* dest, const wchar_t* src);
wchar_t* wcsncat(wchar_t* dest, const wchar_t* src, size_t num);
int wcsncmp(const wchar_t* s1, const wchar_t* s2, size_t num);
wchar_t* wcschr(wchar_t* ws, wchar_t wc);
#ifndef __cplusplus
wchar_t* wcsstr(const wchar_t* s1, const wchar_t* s2);
#else
const wchar_t* wcsstr(const wchar_t* s1, const wchar_t* s2);
#endif
int swprintf(wchar_t* ws, size_t len, const wchar_t* format, ...);
int vswprintf(wchar_t* ws, size_t len, const wchar_t* format, va_list arg);
@@ -36,6 +40,12 @@ int wcsnicmp(const char* dst, const char* src, size_t num);
#ifdef __cplusplus
}
extern "C++" {
inline wchar_t* wcsstr(wchar_t* s1, const wchar_t* s2) {
return const_cast<wchar_t*>(wcsstr(static_cast<const wchar_t*>(s1), s2));
}
}
#endif
#endif // MSL_WCHAR_H

View File

@@ -55,16 +55,14 @@ namespace nw4r {
NW4R_ASSERT(type < TEXTCOLOR_MAX);
return mTextColors[type];
}
#ifdef IPL_SDMEMORY_SET_TEXT_COLORS
void SetTextColors(const ut::Color& first, const ut::Color& second) {
mTextColors[0] = first;
mTextColors[1] = second;
}
#endif
void SetTextColor(u32 type, ut::Color value) {
NW4R_ASSERT(type < TEXTCOLOR_MAX);
mTextColors[type] = value;
}
void SetTextColor(ut::Color top, ut::Color bottom) {
mTextColors[0] = top;
mTextColors[1] = bottom;
}
void SetTextPositionH(u8 pos) { detail::SetHorizontalPosition(&mTextPosition, pos); }
void SetTextPositionV(u8 pos) { detail::SetVerticalPosition(&mTextPosition, pos); }

View File

@@ -396,6 +396,8 @@ static void kbdProcKey(u32 key, u32 pressed, u32 channel) {
kbdSendKey(&event);
}
#pragma push
#pragma opt_propagation off
static void kbdProcMod(u32 key, u32 pressed, u32 channel) {
KBDChannel* data;
u32 modState;
@@ -524,6 +526,7 @@ static void kbdProcMod(u32 key, u32 pressed, u32 channel) {
finalState = modState | 0x1000;
KBDSetModState(channel, finalState);
}
#pragma pop
static void kbdSendKey(KBDKeyEventData* event) {
KBDChannel* data;

View File

@@ -9,12 +9,11 @@
#include <string.h>
static u32 Flags0[BS2_UPDATE_ENTRY_COUNT] = {0};
static u32 Flags1[BS2_UPDATE_ENTRY_COUNT] = {0};
static OSThread Thread = {0};
static u8 ThreadStack[4096] = {0};
static BS2UpdateHeader UpdateHeader0 ALIGN32 = {0};
static BS2UpdateHeader UpdateHeader1 ALIGN32 = {0};
static u32 Flags1[BS2_UPDATE_ENTRY_COUNT];
static OSThread Thread;
static u8 ThreadStack[4096];
static BS2UpdateHeader UpdateHeader0 ALIGN32;
static BS2UpdateHeader UpdateHeader1 ALIGN32;
BS2UpdateEntry DiscEntries[BS2_UPDATE_ENTRY_COUNT] ADDRESS(0x80480000);
@@ -50,32 +49,8 @@ char* getSuffix(const char* path) {
return suffix;
}
static void* UpdateThread(void* argument);
void BS2UpdateInit(void* allocator) {
BS2Report("initialize BS2Update\n");
ConsoleType = OSGetConsoleType();
VersionES = __OSGetHollywoodRev();
VersionMEM2 = OSGetPhysicalMem2Size();
__OSGetIOSRev((OSIOSRev*)&VersionIOS);
BS2Report("Console Type : %08X\n", ConsoleType);
BS2Report("Hollywood Rev : %08X\n", VersionES);
BS2Report("MEM2 Size : %08X\n", VersionMEM2);
MemAllocator = allocator;
State = 0;
CurrentEntry = NULL;
pEntries = NULL;
EntriesCount = 0;
memset(DiscEntries, 0, 0x40000);
memset(EntriesToImport, 0, 0x40000);
memset(Flags1, 0, sizeof(Flags1));
BS2Report("Create update thread\n");
OSCreateThread(&Thread, UpdateThread, NULL, ThreadStack + sizeof(ThreadStack),
sizeof(ThreadStack), 31, OS_THREAD_ATTR_DETACH);
OSResumeThread(&Thread);
}
static inline u32 BS2SelectUpdateEntries(void) {
static u32 Flags0[BS2_UPDATE_ENTRY_COUNT];
BOOL missingFile;
u32 index;
u32 selectedCount;
@@ -418,6 +393,31 @@ selection_complete:
return selectedCount;
}
static void* UpdateThread(void* argument);
void BS2UpdateInit(void* allocator) {
BS2Report("initialize BS2Update\n");
ConsoleType = OSGetConsoleType();
VersionES = __OSGetHollywoodRev();
VersionMEM2 = OSGetPhysicalMem2Size();
__OSGetIOSRev((OSIOSRev*)&VersionIOS);
BS2Report("Console Type : %08X\n", ConsoleType);
BS2Report("Hollywood Rev : %08X\n", VersionES);
BS2Report("MEM2 Size : %08X\n", VersionMEM2);
MemAllocator = allocator;
State = 0;
CurrentEntry = NULL;
pEntries = NULL;
EntriesCount = 0;
memset(DiscEntries, 0, 0x40000);
memset(EntriesToImport, 0, 0x40000);
memset(Flags1, 0, sizeof(Flags1));
BS2Report("Create update thread\n");
OSCreateThread(&Thread, UpdateThread, NULL, ThreadStack + sizeof(ThreadStack),
sizeof(ThreadStack), 31, OS_THREAD_ATTR_DETACH);
OSResumeThread(&Thread);
}
static void* UpdateThread(void* argument) {
u32 index;
s32 importResult;

View File

@@ -647,7 +647,7 @@ static s32 CHANSVmParseInt(const CHANSVmObjHdr* obj, s32 base, u64* out) {
return 0;
}
CHANSVmObjHdr* CHANSVmConvertToIntFromFloat(CHANSVm* vm, CHANSVmObjType type, CHANSVmObjHdr* object) {
CHANSVmObjHdr* CHANSVmConvertToIntFromFloat(CHANSVm* vm, CHANSVmObjType type, const CHANSVmObjHdr* object) {
// Convert to int from float
CHANSVmObjHdr* newObj = CHANSVmNewObject(vm, vmFalse, vmNull, CHANS_VM_OBJ_TYPE_INTEGER, 0);
if (newObj != vmNull) {
@@ -660,7 +660,7 @@ CHANSVmObjHdr* CHANSVmConvertToIntFromFloat(CHANSVm* vm, CHANSVmObjType type, CH
return newObj;
}
CHANSVmObjHdr* CHANSVmConvertToIntFromStr(CHANSVm* vm, CHANSVmObjType type, CHANSVmObjHdr* object) {
CHANSVmObjHdr* CHANSVmConvertToIntFromStr(CHANSVm* vm, CHANSVmObjType type, const CHANSVmObjHdr* object) {
CHANSVmObjHdr* newObj = CHANSVmNewObject(vm, vmFalse, vmNull, CHANS_VM_OBJ_TYPE_INTEGER, 0);
if (newObj != vmNull && !CHANSVmParseInt(object, 0, (u64*)&newObj->value.int_v)) {
newObj = vmNull;
@@ -668,11 +668,11 @@ CHANSVmObjHdr* CHANSVmConvertToIntFromStr(CHANSVm* vm, CHANSVmObjType type, CHAN
return newObj;
}
CHANSVmObjHdr* CHANSVmConvertToIntFromArray(CHANSVm* vm, CHANSVmObjType type, CHANSVmObjHdr* object) {
CHANSVmObjHdr* CHANSVmConvertToIntFromArray(CHANSVm* vm, CHANSVmObjType type, const CHANSVmObjHdr* object) {
return vmNull;
}
CHANSVmObjHdr* CHANSVmConvertToFloatFromUndefined(CHANSVm* vm, CHANSVmObjType type, CHANSVmObjHdr* object) {
CHANSVmObjHdr* CHANSVmConvertToFloatFromUndefined(CHANSVm* vm, CHANSVmObjType type, const CHANSVmObjHdr* object) {
CHANSVmObjHdr* result = CHANSVmNewObject(vm, vmFalse, vmNull, CHANS_VM_OBJ_TYPE_FLOAT, 0);
if (result != vmNull) {
result->value.float_v = VM_NAN;
@@ -680,7 +680,7 @@ CHANSVmObjHdr* CHANSVmConvertToFloatFromUndefined(CHANSVm* vm, CHANSVmObjType ty
return result;
}
CHANSVmObjHdr* CHANSVmConvertToFloatFromInt(CHANSVm* vm, CHANSVmObjType type, CHANSVmObjHdr* intObj) {
CHANSVmObjHdr* CHANSVmConvertToFloatFromInt(CHANSVm* vm, CHANSVmObjType type, const CHANSVmObjHdr* intObj) {
CHANSVmObjHdr* result = CHANSVmNewObject(vm, vmFalse, vmNull, CHANS_VM_OBJ_TYPE_FLOAT, 0);
if (result != vmNull) {
result->value.float_v = VmIntToFloat(intObj->value.int_v);
@@ -716,7 +716,7 @@ const CHANSVmFloatConstantList scFloatConstantList[] = {
char scFloatPrintfFmt[] = "%.16lg";
// clang-format on
static inline s32 CHANSVmParseFloat(CHANSVmObjHdr* obj, f64* out) {
static inline s32 CHANSVmParseFloat(const CHANSVmObjHdr* obj, f64* out) {
u8 type = obj->type;
u32 stringLength;
u32 charCount;
@@ -768,7 +768,7 @@ static inline s32 CHANSVmParseFloat(CHANSVmObjHdr* obj, f64* out) {
return 0;
}
CHANSVmObjHdr* CHANSVmConvertToFloatFromStr(CHANSVm* vm, CHANSVmObjType type, CHANSVmObjHdr* object) {
CHANSVmObjHdr* CHANSVmConvertToFloatFromStr(CHANSVm* vm, CHANSVmObjType type, const CHANSVmObjHdr* object) {
// Convert string keyword into float value
CHANSVmObjHdr* newObj = CHANSVmNewObject(vm, vmFalse, vmNull, CHANS_VM_OBJ_TYPE_FLOAT, 0);
@@ -778,7 +778,7 @@ CHANSVmObjHdr* CHANSVmConvertToFloatFromStr(CHANSVm* vm, CHANSVmObjType type, CH
return newObj;
}
CHANSVmObjHdr* CHANSVmConvertToStrFromUndefined(CHANSVm* vm, CHANSVmObjType type, CHANSVmObjHdr* object) {
CHANSVmObjHdr* CHANSVmConvertToStrFromUndefined(CHANSVm* vm, CHANSVmObjType type, const CHANSVmObjHdr* object) {
return (CHANSVmObjHdr*)CHANSVmConstStringObjectUndefined_;
}
@@ -796,7 +796,7 @@ static int VmToStrFromInt(vmWString output, vmSize length, vmInteger integer) {
return len;
}
CHANSVmObjHdr* CHANSVmConvertToStrFromInt(CHANSVm* vm, CHANSVmObjType type, CHANSVmObjHdr* object) {
CHANSVmObjHdr* CHANSVmConvertToStrFromInt(CHANSVm* vm, CHANSVmObjType type, const CHANSVmObjHdr* object) {
CHANSVmObjHdr* newObject = CHANSVmNewObject(vm, vmFalse, vmNull, CHANS_VM_OBJ_TYPE_STRING, VM_STR_LENGTH(64));
if (newObject) {
vmS32 len = VmToStrFromInt(newObject->value.wstring_v->spData, 64, object->value.int_v);
@@ -812,7 +812,7 @@ error:
return vmNull;
}
CHANSVmObjHdr* CHANSVmConvertToStrFromFloat(CHANSVm* vm, CHANSVmObjType type, CHANSVmObjHdr* value) {
CHANSVmObjHdr* CHANSVmConvertToStrFromFloat(CHANSVm* vm, CHANSVmObjType type, const CHANSVmObjHdr* value) {
const CHANSVmObjHdr* base;
CHANSVmObjHdr* newObj;
s32 result;
@@ -843,13 +843,13 @@ error:
return vmNull;
}
static CHANSVmObjHdr* VmArrayJoinCommon(CHANSVm* vm, u32 retObjAddr, CHANSVmObjHdr* object, u32 separatorAddr, u32 separatorLen);
static CHANSVmObjHdr* VmArrayJoinCommon(CHANSVm* vm, u32 retObjAddr, const CHANSVmObjHdr* object, u32 separatorAddr, u32 separatorLen);
CHANSVmObjHdr* CHANSVmConvertToStrFromArray(CHANSVm* vm, CHANSVmObjType type, CHANSVmObjHdr* object) {
CHANSVmObjHdr* CHANSVmConvertToStrFromArray(CHANSVm* vm, CHANSVmObjType type, const CHANSVmObjHdr* object) {
return VmArrayJoinCommon(vm, 0, object, 0, 0);
}
CHANSVmObjHdr* CHANSVmConvertObjectTypeError(CHANSVm* vm, CHANSVmObjType type, CHANSVmObjHdr* object) {
CHANSVmObjHdr* CHANSVmConvertObjectTypeError(CHANSVm* vm, CHANSVmObjType type, const CHANSVmObjHdr* object) {
CHANS_VM_PRINTF(1176, ", type to %d from %d\n", type, object->type);
return vmNull;
}
@@ -1962,7 +1962,7 @@ error:
return vmFalse;
}
static ArrayChunk* VmArraySeekTop(CHANSVmObjHdr* array) {
static ArrayChunk* VmArraySeekTop(const CHANSVmObjHdr* array) {
ArrayChunk* cur = vmNull;
if (array != vmNull) {
cur = *array->value.ptr_v;
@@ -2089,7 +2089,7 @@ u32 CHANSVmGetArrayLength(CHANSVm* vm, CHANSVmObjHdr* array) {
return 0;
}
static u32 VmArrayJoinEstimateStrSize(CHANSVmObjHdr* object, u32 sepLen) {
static u32 VmArrayJoinEstimateStrSize(const CHANSVmObjHdr* object, u32 sepLen) {
ArrayChunk* chunk;
u32 total;
u32 countInChunk;
@@ -2137,7 +2137,7 @@ error:
return 0;
}
static u32 VmArrayJoinSub(CHANSVmObjHdr* obj, CHANSVmObjHdr* array, wchar_t* separator, u32 sepLen, u32 bufSize, u32 offset) {
static u32 VmArrayJoinSub(CHANSVmObjHdr* obj, const CHANSVmObjHdr* array, wchar_t* separator, u32 sepLen, u32 bufSize, u32 offset) {
ArrayChunk* chunk;
u32 countInChunk;
u32 savedOffset;
@@ -2216,7 +2216,7 @@ error:
return 0;
}
CHANSVmObjHdr* VmArrayJoinCommon(CHANSVm* vm, u32 retObjAddr, CHANSVmObjHdr* object, u32 separatorAddr, u32 separatorLen) {
CHANSVmObjHdr* VmArrayJoinCommon(CHANSVm* vm, u32 retObjAddr, const CHANSVmObjHdr* object, u32 separatorAddr, u32 separatorLen) {
CHANSVmObjHdr* result;
u32 estSize;
u32 actualLen;
@@ -2581,10 +2581,9 @@ VmCtorDefine(Date) {
#define RANGE(val, min, max) ((val) >= (min) && (val) <= (max))
const char* VmDateDayTbl[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
const char* VmDateMonthTbl[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
VmDtorDefine(Date) {
static const char* VmDateDayTbl[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
static const char* VmDateMonthTbl[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
char buffer[32];
unsigned int uv;
OSCalendarTime date;
@@ -4994,30 +4993,47 @@ static inline void VmBlobCopyPadded(BlobHeader* parentBlob, const BlobHeader* sr
static vmBoolInt VmBlobPackCommon(CHANSVm* VmInst, CHANSVmObjHdr* VmParentObj, CHANSVmObjHdr* VmReturnObj, vmU32 flag) {
u32 packBuf[2];
s32 writeHexBufSize;
CHANSVmObjHdr* argArr;
CHANSVmObjHdr* measureStringObj;
s32 measureBlobCount;
u32 writeFmtPos;
u32 writeHexI;
BlobHeader* parentBlob;
CHANSVmObjHdr* argStr;
CHANSVmObjHdr* measureHexObj;
CHANSVmObjHdr* writeStringStrObj;
u32 writeIntegerValHigh;
CHANSVmObjHdr* writeHexStrObj;
u32 writeIntegerValLow;
u8* writeStringDest;
const wchar_t* fmtStr;
u8* writeHexSrcData;
u32 writeStringStrLen;
u32 fmtLen;
CHANSVmObjHdr* argArr;
u32 fmtPos;
u32 writeArgCount;
u8* writeHexDest;
s32 measureHexCount;
s32 writeIntegerCount;
BlobHeader* measureBlobSrcBlob;
u32 writeIntegerI;
s32 writeStringCount;
CHANSVmObjHdr* writeBlobObj;
u32 argCount;
CHANSVmObjHdr* measureBlobObj;
s32 writeBlobCopySize;
s32 measureIntegerCount;
CHANSVmObjHdr* writeIntegerIntObj;
BlobHeader* writeBlobSrcBlob;
u8* writeStringSrcData;
u32 writeStringCharCount;
u32 fmtPos;
u32 totalSize;
s32 count;
u32 i;
CHANSVmObjHdr* obj;
BlobHeader* srcBlob;
s32 copySize;
CHANSVmObjHdr* strObj;
u8* srcData;
u32 charCount;
u32 strLen;
CHANSVmObjHdr* intObj;
u32 valLow;
u32 valHigh;
s32 bufSize;
u8* dest;
u32 ch;
CHANSVmExecutionCtx* execCtx;
u32 writeHexCh;
s32 measureStringCount;
s32 writeHexCount;
CHANSVmExecutionCtx* measureIntegerExecCtx;
CHANSVmExecutionCtx* writeIntegerExecCtx;
parentBlob = (BlobHeader*)VmGetStrFromObjHdr(VmParentObj);
argStr = CHANSVmConvertObjectType(VmInst, CHANS_VM_OBJ_TYPE_STRING, CHANSVmGetArg(VmInst, 0));
@@ -5057,26 +5073,26 @@ static vmBoolInt VmBlobPackCommon(CHANSVm* VmInst, CHANSVmObjHdr* VmParentObj, C
case 4: {
if (paramValue < 0) {
if (argArr != vmNull) {
obj = CHANSVmGetArrayElement(VmInst, argArr, argCount);
measureBlobObj = CHANSVmGetArrayElement(VmInst, argArr, argCount);
} else {
obj = CHANSVmGetArg(VmInst, argCount + 1);
measureBlobObj = CHANSVmGetArg(VmInst, argCount + 1);
}
if (CHANSVmCheckNativeInstance(obj, VmBlobClassName)) {
srcBlob = (BlobHeader*)VmGetStrFromObjHdr(obj);
if (CHANSVmCheckNativeInstance(measureBlobObj, VmBlobClassName)) {
measureBlobSrcBlob = (BlobHeader*)VmGetStrFromObjHdr(measureBlobObj);
} else {
srcBlob = vmNull;
measureBlobSrcBlob = vmNull;
}
if (srcBlob == vmNull) {
if (measureBlobSrcBlob == vmNull) {
goto error;
}
count = srcBlob->size - srcBlob->offset;
measureBlobCount = measureBlobSrcBlob->size - measureBlobSrcBlob->offset;
} else {
count = paramValue;
measureBlobCount = paramValue;
}
if (count < 0) {
if (measureBlobCount < 0) {
goto error;
}
totalSize += count;
totalSize += measureBlobCount;
argCount++;
break;
}
@@ -5093,20 +5109,20 @@ static vmBoolInt VmBlobPackCommon(CHANSVm* VmInst, CHANSVmObjHdr* VmParentObj, C
case 9: {
if (paramValue < 0) {
if (argArr != vmNull) {
count = CHANSVmGetArrayLength(VmInst, argArr);
count = count - argCount;
measureIntegerCount = CHANSVmGetArrayLength(VmInst, argArr);
measureIntegerCount = measureIntegerCount - argCount;
} else {
execCtx = ((CHANSVmPrivate*)VmInst)->pActiveCtx;
count = execCtx->argc - argCount - 1;
measureIntegerExecCtx = ((CHANSVmPrivate*)VmInst)->pActiveCtx;
measureIntegerCount = measureIntegerExecCtx->argc - argCount - 1;
}
} else {
count = paramValue;
measureIntegerCount = paramValue;
}
if (count < 0) {
if (measureIntegerCount < 0) {
goto error;
}
argCount += count;
totalSize += elemSize * count;
argCount += measureIntegerCount;
totalSize += elemSize * measureIntegerCount;
break;
}
case 10:
@@ -5115,47 +5131,47 @@ static vmBoolInt VmBlobPackCommon(CHANSVm* VmInst, CHANSVmObjHdr* VmParentObj, C
case 13: {
if (paramValue < 0) {
if (argArr != vmNull) {
obj = CHANSVmGetArrayElement(VmInst, argArr, argCount);
obj = CHANSVmConvertObjectType(VmInst, CHANS_VM_OBJ_TYPE_STRING, obj);
measureStringObj = CHANSVmGetArrayElement(VmInst, argArr, argCount);
measureStringObj = CHANSVmConvertObjectType(VmInst, CHANS_VM_OBJ_TYPE_STRING, measureStringObj);
} else {
obj = CHANSVmGetArg(VmInst, argCount + 1);
obj = CHANSVmConvertObjectType(VmInst, CHANS_VM_OBJ_TYPE_STRING, obj);
measureStringObj = CHANSVmGetArg(VmInst, argCount + 1);
measureStringObj = CHANSVmConvertObjectType(VmInst, CHANS_VM_OBJ_TYPE_STRING, measureStringObj);
}
if (obj == vmNull) {
if (measureStringObj == vmNull) {
goto error;
}
count = (u32)obj->value.int32_v->val >> 1;
measureStringCount = (u32)measureStringObj->value.int32_v->val >> 1;
} else {
count = paramValue;
measureStringCount = paramValue;
}
if (count < 0) {
if (measureStringCount < 0) {
goto error;
}
argCount++;
totalSize += elemSize * count;
totalSize += elemSize * measureStringCount;
break;
}
case 14: {
if (paramValue < 0) {
if (argArr != vmNull) {
obj = CHANSVmGetArrayElement(VmInst, argArr, argCount);
obj = CHANSVmConvertObjectType(VmInst, CHANS_VM_OBJ_TYPE_STRING, obj);
measureHexObj = CHANSVmGetArrayElement(VmInst, argArr, argCount);
measureHexObj = CHANSVmConvertObjectType(VmInst, CHANS_VM_OBJ_TYPE_STRING, measureHexObj);
} else {
obj = CHANSVmGetArg(VmInst, argCount + 1);
obj = CHANSVmConvertObjectType(VmInst, CHANS_VM_OBJ_TYPE_STRING, obj);
measureHexObj = CHANSVmGetArg(VmInst, argCount + 1);
measureHexObj = CHANSVmConvertObjectType(VmInst, CHANS_VM_OBJ_TYPE_STRING, measureHexObj);
}
if (obj == vmNull) {
if (measureHexObj == vmNull) {
goto error;
}
count = (u32)obj->value.int32_v->val >> 1;
measureHexCount = (u32)measureHexObj->value.int32_v->val >> 1;
} else {
count = paramValue;
measureHexCount = paramValue;
}
if (count < 0) {
if (measureHexCount < 0) {
goto error;
}
argCount++;
totalSize += (s32)((u32)count + 1U) / 2;
totalSize += (s32)((u32)measureHexCount + 1U) / 2;
break;
}
}
@@ -5180,8 +5196,8 @@ static vmBoolInt VmBlobPackCommon(CHANSVm* VmInst, CHANSVmObjHdr* VmParentObj, C
}
}
argCount = 0;
fmtPos = 0;
writeArgCount = 0;
writeFmtPos = 0;
while (vmTrue) {
u32 nextPos = 0;
@@ -5189,7 +5205,7 @@ static vmBoolInt VmBlobPackCommon(CHANSVm* VmInst, CHANSVmObjHdr* VmParentObj, C
u32 elemSize = 1;
s32 paramValue = 1;
fmtPos = vmBlobParsePackFormatString(&nextPos, &elemType, &elemSize, (void*)&paramValue, fmtStr, fmtLen, fmtPos);
writeFmtPos = vmBlobParsePackFormatString(&nextPos, &elemType, &elemSize, (void*)&paramValue, fmtStr, fmtLen, writeFmtPos);
if (elemType == 1) {
break;
@@ -5202,33 +5218,33 @@ static vmBoolInt VmBlobPackCommon(CHANSVm* VmInst, CHANSVmObjHdr* VmParentObj, C
switch (elemType) {
case 4: {
if (argArr != vmNull) {
obj = CHANSVmGetArrayElement(VmInst, argArr, argCount);
writeBlobObj = CHANSVmGetArrayElement(VmInst, argArr, writeArgCount);
} else {
obj = CHANSVmGetArg(VmInst, argCount + 1);
writeBlobObj = CHANSVmGetArg(VmInst, writeArgCount + 1);
}
if (CHANSVmCheckNativeInstance(obj, VmBlobClassName)) {
srcBlob = (BlobHeader*)VmGetStrFromObjHdr(obj);
if (CHANSVmCheckNativeInstance(writeBlobObj, VmBlobClassName)) {
writeBlobSrcBlob = (BlobHeader*)VmGetStrFromObjHdr(writeBlobObj);
} else {
srcBlob = vmNull;
writeBlobSrcBlob = vmNull;
}
argCount++;
writeArgCount++;
if (srcBlob == vmNull) {
if (writeBlobSrcBlob == vmNull) {
goto error;
}
if (paramValue < 0) {
copySize = srcBlob->size - srcBlob->offset;
writeBlobCopySize = writeBlobSrcBlob->size - writeBlobSrcBlob->offset;
} else {
copySize = paramValue;
writeBlobCopySize = paramValue;
}
if (copySize < 0 || !CHANSVmBlobHasSpace(parentBlob, copySize)) {
if (writeBlobCopySize < 0 || !CHANSVmBlobHasSpace(parentBlob, writeBlobCopySize)) {
goto error;
}
VmBlobCopyPadded(parentBlob, srcBlob, copySize);
VmBlobCopyPadded(parentBlob, writeBlobSrcBlob, writeBlobCopySize);
break;
}
case 5: {
@@ -5247,38 +5263,38 @@ static vmBoolInt VmBlobPackCommon(CHANSVm* VmInst, CHANSVmObjHdr* VmParentObj, C
case 9: {
if (paramValue < 0) {
if (argArr != vmNull) {
count = CHANSVmGetArrayLength(VmInst, argArr) - argCount;
writeIntegerCount = CHANSVmGetArrayLength(VmInst, argArr) - writeArgCount;
} else {
execCtx = ((CHANSVmPrivate*)VmInst)->pActiveCtx;
count = execCtx->argc - argCount - 1;
writeIntegerExecCtx = ((CHANSVmPrivate*)VmInst)->pActiveCtx;
writeIntegerCount = writeIntegerExecCtx->argc - writeArgCount - 1;
}
} else {
count = paramValue;
writeIntegerCount = paramValue;
}
if (count < 0) {
if (writeIntegerCount < 0) {
goto error;
}
if (!CHANSVmBlobHasSpace(parentBlob, elemSize * count)) {
if (!CHANSVmBlobHasSpace(parentBlob, elemSize * writeIntegerCount)) {
goto error;
}
for (i = 0; i < count; i++) {
for (writeIntegerI = 0; writeIntegerI < writeIntegerCount; writeIntegerI++) {
packBuf[1] = 0;
packBuf[0] = 0;
if (argArr != vmNull) {
intObj = CHANSVmGetArrayElement(VmInst, argArr, argCount);
intObj = CHANSVmConvertObjectType(VmInst, CHANS_VM_OBJ_TYPE_INTEGER, intObj);
writeIntegerIntObj = CHANSVmGetArrayElement(VmInst, argArr, writeArgCount);
writeIntegerIntObj = CHANSVmConvertObjectType(VmInst, CHANS_VM_OBJ_TYPE_INTEGER, writeIntegerIntObj);
} else {
intObj = CHANSVmGetArg(VmInst, argCount + 1);
intObj = CHANSVmConvertObjectType(VmInst, CHANS_VM_OBJ_TYPE_INTEGER, intObj);
writeIntegerIntObj = CHANSVmGetArg(VmInst, writeArgCount + 1);
writeIntegerIntObj = CHANSVmConvertObjectType(VmInst, CHANS_VM_OBJ_TYPE_INTEGER, writeIntegerIntObj);
}
argCount++;
if (intObj == vmNull) {
writeArgCount++;
if (writeIntegerIntObj == vmNull) {
goto error;
}
valLow = (u32)intObj->value.int_v;
valHigh = (u32)((u64)intObj->value.int_v >> 32);
writeIntegerValLow = (u32)writeIntegerIntObj->value.int_v;
writeIntegerValHigh = (u32)((u64)writeIntegerIntObj->value.int_v >> 32);
switch ((s32)elemType) {
case 6:
@@ -5286,20 +5302,20 @@ static vmBoolInt VmBlobPackCommon(CHANSVm* VmInst, CHANSVmObjHdr* VmParentObj, C
// signed
switch (elemSize) {
case 1: {
*(s8*)packBuf = (s8)valLow;
*(s8*)packBuf = (s8)writeIntegerValLow;
break;
}
case 2: {
*(s16*)packBuf = (s16)valLow;
*(s16*)packBuf = (s16)writeIntegerValLow;
break;
}
case 4: {
packBuf[0] = valLow;
*(s32*)packBuf = writeIntegerValLow;
break;
}
case 8: {
packBuf[1] = valLow;
packBuf[0] = valHigh;
((s32*)packBuf)[1] = writeIntegerValLow;
*(s32*)packBuf = writeIntegerValHigh;
break;
}
default: {
@@ -5313,15 +5329,15 @@ static vmBoolInt VmBlobPackCommon(CHANSVm* VmInst, CHANSVmObjHdr* VmParentObj, C
// unsigned
switch (elemSize) {
case 1: {
*(u8*)packBuf = (u8)valLow;
*(u8*)packBuf = (u8)writeIntegerValLow;
break;
}
case 2: {
*(u16*)packBuf = (u16)valLow;
*(u16*)packBuf = (u16)writeIntegerValLow;
break;
}
case 4: {
packBuf[0] = valLow;
*(u32*)packBuf = writeIntegerValLow;
break;
}
default: {
@@ -5350,7 +5366,7 @@ static vmBoolInt VmBlobPackCommon(CHANSVm* VmInst, CHANSVmObjHdr* VmParentObj, C
break;
}
case 4: {
__stwbrx(packBuf[0], packBuf, 0);
__stwbrx(*(u32*)packBuf, packBuf, 0);
break;
}
case 8: {
@@ -5371,100 +5387,100 @@ static vmBoolInt VmBlobPackCommon(CHANSVm* VmInst, CHANSVmObjHdr* VmParentObj, C
case 12:
case 13: {
if (argArr != vmNull) {
strObj = CHANSVmGetArrayElement(VmInst, argArr, argCount);
strObj = CHANSVmConvertObjectType(VmInst, CHANS_VM_OBJ_TYPE_STRING, strObj);
writeStringStrObj = CHANSVmGetArrayElement(VmInst, argArr, writeArgCount);
writeStringStrObj = CHANSVmConvertObjectType(VmInst, CHANS_VM_OBJ_TYPE_STRING, writeStringStrObj);
} else {
strObj = CHANSVmGetArg(VmInst, argCount + 1);
strObj = CHANSVmConvertObjectType(VmInst, CHANS_VM_OBJ_TYPE_STRING, strObj);
writeStringStrObj = CHANSVmGetArg(VmInst, writeArgCount + 1);
writeStringStrObj = CHANSVmConvertObjectType(VmInst, CHANS_VM_OBJ_TYPE_STRING, writeStringStrObj);
}
argCount++;
if (strObj == vmNull) {
writeArgCount++;
if (writeStringStrObj == vmNull) {
goto error;
}
if (paramValue < 0) {
count = (u32)strObj->value.int32_v->val >> 1;
writeStringCount = (u32)writeStringStrObj->value.int32_v->val >> 1;
} else {
count = paramValue;
writeStringCount = paramValue;
}
if (count < 0) {
if (writeStringCount < 0) {
goto error;
}
if (!CHANSVmBlobHasSpace(parentBlob, elemSize * count)) {
if (!CHANSVmBlobHasSpace(parentBlob, elemSize * writeStringCount)) {
goto error;
}
srcData = (u8*)VmGetStrFromObjHdr(strObj);
strLen = (u32)VmGetIntFromObjHdr(strObj) >> 1;
charCount = strLen;
dest = parentBlob->pData + parentBlob->offset;
writeStringSrcData = (u8*)VmGetStrFromObjHdr(writeStringStrObj);
writeStringStrLen = (u32)VmGetIntFromObjHdr(writeStringStrObj) >> 1;
writeStringCharCount = writeStringStrLen;
writeStringDest = parentBlob->pData + parentBlob->offset;
if (charCount > count) {
charCount = count;
if (writeStringCharCount > writeStringCount) {
writeStringCharCount = writeStringCount;
}
memset(dest, 0, elemSize * count);
memset(writeStringDest, 0, elemSize * writeStringCount);
if (elemSize == 1) {
CHANSVmStrCpyToU8FromU16(dest, srcData, charCount);
CHANSVmStrCpyToU8FromU16(writeStringDest, writeStringSrcData, writeStringCharCount);
} else {
memcpy(dest, srcData, elemSize * charCount);
memcpy(writeStringDest, writeStringSrcData, elemSize * writeStringCharCount);
}
parentBlob->offset += elemSize * count;
parentBlob->offset += elemSize * writeStringCount;
break;
}
case 14: {
if (argArr != vmNull) {
strObj = CHANSVmGetArrayElement(VmInst, argArr, argCount);
strObj = CHANSVmConvertObjectType(VmInst, CHANS_VM_OBJ_TYPE_STRING, strObj);
writeHexStrObj = CHANSVmGetArrayElement(VmInst, argArr, writeArgCount);
writeHexStrObj = CHANSVmConvertObjectType(VmInst, CHANS_VM_OBJ_TYPE_STRING, writeHexStrObj);
} else {
strObj = CHANSVmGetArg(VmInst, argCount + 1);
strObj = CHANSVmConvertObjectType(VmInst, CHANS_VM_OBJ_TYPE_STRING, strObj);
writeHexStrObj = CHANSVmGetArg(VmInst, writeArgCount + 1);
writeHexStrObj = CHANSVmConvertObjectType(VmInst, CHANS_VM_OBJ_TYPE_STRING, writeHexStrObj);
}
argCount++;
if (strObj == vmNull) {
writeArgCount++;
if (writeHexStrObj == vmNull) {
goto error;
}
if (paramValue < 0) {
count = (u32)strObj->value.int32_v->val >> 1;
writeHexCount = (u32)writeHexStrObj->value.int32_v->val >> 1;
} else {
count = paramValue;
writeHexCount = paramValue;
}
if (count < 0) {
if (writeHexCount < 0) {
goto error;
}
bufSize = (s32)((u32)count + 1U) / 2;
if (!CHANSVmBlobHasSpace(parentBlob, bufSize)) {
writeHexBufSize = (s32)((u32)writeHexCount + 1U) / 2;
if (!CHANSVmBlobHasSpace(parentBlob, writeHexBufSize)) {
goto error;
}
srcData = (u8*)VmGetStrFromObjHdr(strObj);
strLen = (u32)VmGetIntFromObjHdr(strObj) >> 1;
dest = parentBlob->pData + parentBlob->offset;
memset(dest, 0, bufSize);
writeHexSrcData = (u8*)VmGetStrFromObjHdr(writeHexStrObj);
VmGetIntFromObjHdr(writeHexStrObj);
writeHexDest = parentBlob->pData + parentBlob->offset;
memset(writeHexDest, 0, writeHexBufSize);
for (i = 0; (s32)i < count; i++) {
ch = ((const u16*)srcData)[i];
if (ch >= 0x30 && ch <= 0x39) {
ch -= 0x30;
} else if (ch >= 0x61 && ch <= 0x66) {
ch -= 0x57;
} else if (ch >= 0x41 && ch <= 0x46) {
ch -= 0x37;
for (writeHexI = 0; (s32)writeHexI < writeHexCount; writeHexI++) {
writeHexCh = ((const u16*)writeHexSrcData)[writeHexI];
if (writeHexCh >= 0x30 && writeHexCh <= 0x39) {
writeHexCh -= 0x30;
} else if (writeHexCh >= 0x61 && writeHexCh <= 0x66) {
writeHexCh -= 0x57;
} else if (writeHexCh >= 0x41 && writeHexCh <= 0x46) {
writeHexCh -= 0x37;
} else {
ch = 0;
writeHexCh = 0;
}
if ((i & 1) == 0) {
ch *= 16;
if ((writeHexI & 1) == 0) {
writeHexCh *= 16;
}
*dest |= ch & 0xFF;
if (i & 1) {
dest++;
*writeHexDest |= writeHexCh & 0xFF;
if (writeHexI & 1) {
writeHexDest++;
}
}
parentBlob->offset += bufSize;
parentBlob->offset += writeHexBufSize;
break;
}
default: {

View File

@@ -1,5 +1,7 @@
#define TI_CANDIDATEBOX_IMPLEMENTATION
#define TI_CANDIDATEBOX_SAMPLE_CLASS
#include "keyboard/tiCandidateBox.h"
#undef TI_CANDIDATEBOX_SAMPLE_CLASS
#include "keyboard/tiManager.h"
@@ -60,11 +62,7 @@ namespace textinput {
{ANM_InvalidOff, "fs_VK_predictInput_a_invalidMode_OFF.brlan"},
};
struct CandidatePaneData {
PaneToAnimation panes[26];
};
extern "C" const CandidatePaneData scCandidatePaneData __attribute__((aligned(8))) = {{
static const PaneToAnimation csPaneToAnimation[] = {
{KT_CandidateText, "N_predictInput", 1, NULL, {&csAninationFile[0]}},
{KT_ScrollButton,
"P_prdc_scrl_Left",
@@ -195,7 +193,7 @@ namespace textinput {
6,
NULL,
{&csAninationFile[0], &csAninationFile[8], &csAninationFile[9], &csAninationFile[10], &csAninationFile[11], &csAninationFile[12]}},
}};
};
void CandidateBoxCaller::Candidates::addCandidate(const wchar_t* wcString) {
wcsncpy(szwcPredicted[mNumCandidate], wcString, ARRAY_LENGTH(szwcPredicted[0]));
@@ -376,50 +374,44 @@ namespace textinput {
}
void LayoutByNW4R::createAnmPane_(MEMAllocator* allocator) {
u32 animationCount;
const char* forceAddName;
u16 i;
for (i = 0; i < ARRAY_LENGTH(scCandidatePaneData.panes); i++) {
const PaneToAnimation& p = scCandidatePaneData.panes[i];
for (u16 i = 0; i < ARRAY_LENGTH(csPaneToAnimation); i++) {
const PaneToAnimation& paneAnimations = csPaneToAnimation[i];
CandidateTextAnmPane* pane = NULL;
switch (p.type) {
switch (paneAnimations.type) {
case KT_ScrollButton: {
void* pBtnBuf = MEMAllocFromAllocator(allocator, sizeof(CandidateScrollAnmPane));
pane = new (pBtnBuf) CandidateScrollAnmPane(getPane(p.paneName), NULL);
pane = new (pBtnBuf) CandidateScrollAnmPane(getPane(paneAnimations.paneName), NULL);
break;
}
case KT_CandidateText: {
void* pBtnBuf = MEMAllocFromAllocator(allocator, sizeof(CandidateTextAnmPane));
pane = new (pBtnBuf) CandidateTextAnmPane(getPane(p.paneName), NULL);
pane = new (pBtnBuf) CandidateTextAnmPane(getPane(paneAnimations.paneName), NULL);
break;
}
case KT_OnOffButton: {
void* pBtnBuf = MEMAllocFromAllocator(allocator, sizeof(OnOffAnmPane));
pane = new (pBtnBuf) OnOffAnmPane(getPane(p.paneName), &mOnOffButton);
pane = new (pBtnBuf) OnOffAnmPane(getPane(paneAnimations.paneName), &mOnOffButton);
break;
}
case KT_Window: {
void* pBtnBuf = MEMAllocFromAllocator(allocator, sizeof(PredictWindow));
pane = new (pBtnBuf) PredictWindow(getPane(p.paneName), &mTextWindow);
pane = new (pBtnBuf) PredictWindow(getPane(paneAnimations.paneName), &mTextWindow);
break;
}
}
nw4r::ut::List_Append(&mAnmPanes, pane);
forceAddName = p.forceAddName;
animationCount = p.count;
for (u16 j = 0; j < animationCount; j++) {
const AnimationFile* const& animation = p.pAnims[j];
void* pResource = mpMultiArcResourceAccessor->GetResource(0, animation->fileName);
for (u16 j = 0; j < paneAnimations.count; j++) {
void* pResource = mpMultiArcResourceAccessor->GetResource(0, paneAnimations.pAnims[j]->fileName);
AnimTransformPane* transform =
static_cast<AnimTransformPane*>(getLayout()->CreateAnimTransform(pResource, mpMultiArcResourceAccessor));
if (forceAddName == NULL) {
pane->addAnimation(allocator, animation->id, transform, false, true);
if (paneAnimations.forceAddName == NULL) {
pane->addAnimation(allocator, paneAnimations.pAnims[j]->id, transform, false, true);
} else {
pane->forceAddAnimation(allocator, animation->id, transform, forceAddName, false, true);
pane->forceAddAnimation(allocator, paneAnimations.pAnims[j]->id, transform, paneAnimations.forceAddName, false, true);
}
}
}
@@ -678,8 +670,8 @@ namespace textinput {
}
void LayoutByNW4R::cancelStateFocusIn() {
const PaneToAnimation* pane = scCandidatePaneData.panes;
for (int i = 0; i < ARRAY_LENGTH(scCandidatePaneData.panes); i++) {
const PaneToAnimation* pane = csPaneToAnimation;
for (int i = 0; i < ARRAY_LENGTH(csPaneToAnimation); i++) {
CandidateTextAnmPane* p = static_cast<CandidateTextAnmPane*>(searchAnmPane(pane->paneName));
if (p != NULL) {
switch (p->getKeyType()) {
@@ -1766,3 +1758,48 @@ namespace textinput {
} // namespace candidatebox
} // namespace textinput
inline void textinput::util::Animation::startAnm(AnimObserver* observer, f32 start, f32 end, f32 duration, void* data) {
mfStartPoint = start;
mfEndPoint = end;
mfAnimationTime = duration;
mfCurrentFrame = 0.0f;
mbInAnimation = true;
mpAnimObserver = observer;
mpData = data;
mbSE = false;
if (observer) observer->onAnmEvent(AnimObserver::AE_0, data);
}
inline void textinput::util::Animation::calc() {
if (mbInAnimation) {
if (mfCurrentFrame < mfAnimationTime) {
mfCurrentFrame = 1.0f + mfCurrentFrame;
} else {
if (mbInAnimation && mpAnimObserver) {
mpAnimObserver->onAnmEvent(AnimObserver::AE_1, mpData);
}
mbInAnimation = false;
}
}
}
inline f32 textinput::util::Animation::getValue() {
return hermiteInterporation(mfCurrentFrame, 0.0f, mfStartPoint, 0.0f, mfAnimationTime, mfEndPoint, 0.0f);
}
inline bool textinput::util::Animation::isActive() {
return mbInAnimation;
}
inline void textinput::util::Animation::setSEFlag(bool flag) {
mbSE = flag;
}
inline bool textinput::util::Animation::isSEFlag() {
return mbSE;
}
inline void textinput::util::Animation::stop() {
mbInAnimation = false;
}

View File

@@ -163,6 +163,8 @@ private:
};
}
#pragma push
#pragma ppc_iro_level 4
void Decolated::inputChar(wchar_t ch) {
if (ch != 0xfffe) {
wchar_t input[8];
@@ -195,9 +197,16 @@ void Decolated::inputChar(wchar_t ch) {
}
nonKana:
if (mTranslateMode == 3) {
CharacterOutput output(input);
output.append(ch);
count = output.finish();
u32 inputIndex = 0;
wchar_t* inputBuf = input;
input[inputIndex] = 0;
if (ch == 10) {
inputIndex = 0;
}
input[inputIndex] = ch;
++inputIndex;
inputBuf[inputIndex] = 0;
count = inputIndex;
mKanaStream.mOutput[0] = 0;
} else {
count = 1;
@@ -220,6 +229,7 @@ inputReady:
mCursorEnd = mCursorStart;
}
}
#pragma pop
void Decolated::confirmKana() {
inputChar(10);

View File

@@ -194,7 +194,8 @@ namespace ipl {
mpCaptionString->clear();
mpCaptionString->set(System::getMessage(MESG_LETTERWRITER_LETTER_HEADER));
wchar_t* namePlaceholder = wcsstr(mpCaptionString->getWCString(), L"xxxxxxxxxx");
wchar_t* caption = mpCaptionString->getWCString();
wchar_t* namePlaceholder = wcsstr(caption, L"xxxxxxxxxx");
mpCaptionString->replace((namePlaceholder - mpCaptionString->getWCString()), RFL_NAME_LENGTH, headerCaption);
return mpCaptionString->getWCString();

View File

@@ -7,13 +7,11 @@
#define IPL_SDMEMORY_SD_CHANNEL_SELECT_LAYOUT
#define IPL_SDMEMORY_COMPLETION_PCT_ACCESSOR
#define IPL_SDMEMORY_DIALOG_PROGRESS_FRAME_ACCESSOR
#define IPL_SDMEMORY_SET_TEXT_COLORS
#define IPL_SDMEMORY_SCROLLER_STATE_ACCESSOR
#include "system/iplDialogWindow.h"
#undef IPL_SDMEMORY_DIALOG_PROGRESS_FRAME_ACCESSOR
#include "scene/sdChannelMemory/iplSDMemory.h"
#include "scene/sdChannelSelect/iplSDChannelSelect.h"
#undef IPL_SDMEMORY_SET_TEXT_COLORS
#undef IPL_SDMEMORY_SCROLLER_STATE_ACCESSOR
#undef IPL_SDMEMORY_DIALOG_STATE_ACCESSOR
#undef IPL_SDMEMORY_SET_TRANSLATE_OUT_OF_LINE
@@ -51,11 +49,6 @@ namespace ipl {
typedef ::gui::PaneComponent GuiPaneComponent;
typedef controller::Interface ControllerInterface;
void writeFourFlagBytes(u8* flags, u8 first, u8 second, u8 third, u8 fourth);
void setTitleRowColors(nw4r::lyt::TextBox* textBox, const nw4r::ut::Color& first,
const nw4r::ut::Color& second) NO_INLINE;
static const char* sControlPaneNames[] = {
"A", "B", "B_BtnA",
};
@@ -1269,10 +1262,6 @@ namespace ipl {
}
}
static inline void setChildrenAlpha(nw4r::lyt::Pane& pane, const u8 alpha);
#pragma push
#pragma ppc_iro_level 1
void SDMemory::drawTransferTitles() {
f32 rowY;
f32 rowTop;
@@ -1291,12 +1280,12 @@ namespace ipl {
u32 titleIndex;
s32 visibleRows;
s32 row;
const wchar_t* messageForCount;
wchar_t* messageForCount;
s32 lineCount;
const wchar_t* messageLine;
wchar_t* messageLine;
s32 totalLines;
s32 lineIndex;
const wchar_t* lineEnd;
wchar_t* lineEnd;
u32 lineLength;
nw4r::lyt::TextBox* messageText;
const nw4r::math::VEC3& translation = mpDialogLayout->FindPaneByName("N_Memo")->GetTranslate();
@@ -1324,12 +1313,10 @@ namespace ipl {
if (mNandTitleCount != 0) {
messageForCount = System::getMessage(0xCB);
lineCount = 0;
const wchar_t* newline = wcsstr(messageForCount, L"\n");
if (newline != NULL) {
do {
++lineCount;
newline = wcsstr(newline + 1, L"\n");
} while (newline != NULL);
wchar_t* newline = wcsstr(messageForCount, L"\n");
while (newline != NULL) {
++lineCount;
newline = wcsstr(newline + 1, L"\n");
}
messageLine = System::getMessage(0xCB);
@@ -1366,7 +1353,11 @@ namespace ipl {
titleSizePane = mpDialogLayout->FindPaneByName("N_Body");
rowHeight = titleSizePane->GetSize().height;
setChildrenAlpha(*titleSizePane, alpha);
nw4r::lyt::PaneList::Iterator bodyChild = titleSizePane->GetChildList().GetBeginIter();
while (bodyChild != titleSizePane->GetChildList().GetEndIter()) {
bodyChild->SetAlpha(alpha);
++bodyChild;
}
titleText = static_cast<nw4r::lyt::TextBox*>(
mpDialogLayout->FindPaneByName("T_Letter"));
@@ -1376,22 +1367,12 @@ namespace ipl {
for (titleIndex = 0; titleIndex < mTitleCount; ++titleIndex) {
utility::layout::set_string(titleText, mTitleNames[titleIndex]);
if (nandTitleIndex < mNandTitleCount && mTitleIds[titleIndex] == mNandTitleIds[nandTitleIndex]) {
GXColor gxActive;
++nandTitleIndex;
writeFourFlagBytes(&gxActive.r, 0x34, 0xBE, 0xED, 0xFF);
GXColor activeColor = gxActive;
GXColor activeTop = activeColor;
GXColor activeBottom = activeColor;
setTitleRowColors(titleText, *reinterpret_cast<const nw4r::ut::Color*>(&activeTop),
*reinterpret_cast<const nw4r::ut::Color*>(&activeBottom));
nw4r::ut::Color color(0x34, 0xBE, 0xED, 0xFF);
titleText->SetTextColor(color, color);
} else {
GXColor gxInactive;
writeFourFlagBytes(&gxInactive.r, 0x64, 0x64, 0x64, 0xFF);
GXColor inactiveColor = gxInactive;
GXColor inactiveTop = inactiveColor;
GXColor inactiveBottom = inactiveColor;
setTitleRowColors(titleText, *reinterpret_cast<const nw4r::ut::Color*>(&inactiveTop),
*reinterpret_cast<const nw4r::ut::Color*>(&inactiveBottom));
nw4r::ut::Color color(0x64, 0x64, 0x64, 0xFF);
titleText->SetTextColor(color, color);
}
nw4r::ut::Rect textRect = mpDialogLayout->getTextDrawRect("T_Letter");
@@ -1413,7 +1394,7 @@ namespace ipl {
titleText->CalculateMtx(*mpDialogLayout->getDrawInfo());
mpDialogLayout->draw(titleText);
}
titleOffset -= rowHeight * static_cast<f32>(visibleRows);
titleOffset -= visibleRows * rowHeight;
}
backgroundOffset += rowHeight;
@@ -1435,27 +1416,6 @@ namespace ipl {
mpDialogLayout->draw("N_Back");
mpDialogLayout->draw("N_Move");
}
#pragma pop
static inline void setChildrenAlpha(nw4r::lyt::Pane& pane, const u8 alpha) {
nw4r::lyt::PaneList::Iterator child = pane.GetChildList().GetBeginIter();
while (child != pane.GetChildList().GetEndIter()) {
child->SetAlpha(alpha);
++child;
}
}
void writeFourFlagBytes(u8* flags, u8 first, u8 second, u8 third, u8 fourth) {
flags[0] = first;
flags[1] = second;
flags[2] = third;
flags[3] = fourth;
}
void setTitleRowColors(nw4r::lyt::TextBox* textBox, const nw4r::ut::Color& first,
const nw4r::ut::Color& second) NO_INLINE {
textBox->SetTextColors(first, second);
}
s32 SDMemory::getControlPaneIndex(const char* paneName) {
s32 paneIndex = -1;

View File

@@ -2510,6 +2510,8 @@ int AOSSXorBufferWithKey(void* packet, s32 length, char* key, int keyLength) {
s32 index;
int result = -1;
u8* packetBytes;
u8* mask;
u8* output;
keyMask = (u8*)AOSSi_Alloc(halfLength);
if (keyMask == 0) {
@@ -2528,8 +2530,9 @@ int AOSSXorBufferWithKey(void* packet, s32 length, char* key, int keyLength) {
for (round = 0; round < 2; round++) {
keyIndex = round % keyLength;
for (index = 0; index < halfLength; index++) {
keyMask[index] = (u8)index;
keyMask[index] = keyMask[index] ^ (u8)key[keyIndex];
mask = &keyMask[index];
*mask = (u8)index;
*mask = *mask ^ (u8)key[keyIndex];
keyIndex++;
if (keyIndex >= keyLength) {
keyIndex = 0;
@@ -2537,9 +2540,9 @@ int AOSSXorBufferWithKey(void* packet, s32 length, char* key, int keyLength) {
}
for (index = 0; index < halfLength; index++) {
u8 inputByte = packetHalf[index];
inputByte ^= keyMask[index];
packetHalf[index] = inputByte;
mask = &keyMask[index];
output = &packetHalf[index];
*output = *output ^ *mask;
}
memcpy(temporary, packetHalf, halfLength);

View File

@@ -532,7 +532,7 @@ extern u8 gAtermDigestFill[64];
extern u8* gAtermRequestOptions;
int ATERMAesKeyWrap(u16* destination, u16* source, u32 length, void* key, u32 keyLength);
int ATERMAesKeyUnwrap(u16* destination, u16* source, u32 length, void* key, u32 keyLength);
int ATERMAesExpandEncryptKey(u32* expandedKey, const void* key, u32 keyBits);
int ATERMAesExpandEncryptKey(u32* roundKey, const void* key, int keyBits);
int ATERMAesExpandDecryptKey(u32* expandedKey, const void* key, u32 keyBits);
void ATERMAesEncryptBlock(const u32* expandedKey, u32 rounds, const u8* input, u8* output);
void ATERMAesDecryptBlock(const u32* expandedKey, u32 rounds, const u8* input, u8* output);
@@ -1901,120 +1901,91 @@ int ATERMAesKeyUnwrap(u16* destination, u16* source, u32 length, void* key, u32
return result;
}
#define ATERM_AES_SUB_BYTE(value) (gAtermAesSubstitutionTable[(value)] & 0xFF)
#define ATERM_AES_SUB_WORD(value) \
((ATERM_AES_SUB_BYTE(((value) >> 24) & 0xFF) << 24) | \
(ATERM_AES_SUB_BYTE(((value) >> 16) & 0xFF) << 16) | \
(ATERM_AES_SUB_BYTE(((value) >> 8) & 0xFF) << 8) | \
ATERM_AES_SUB_BYTE((value) & 0xFF))
#define ATERM_AES_GETU32(bytes) \
(((u32)(bytes)[0] << 24) ^ ((u32)(bytes)[1] << 16) ^ ((u32)(bytes)[2] << 8) ^ ((u32)(bytes)[3]))
#define ATERM_AES_READ_KEY_WORD(index) \
(((u32)keyBytes[(index) * 4] << 24) ^ \
((u32)keyBytes[(index) * 4 + 1] << 16) ^ \
((u32)keyBytes[(index) * 4 + 2] << 8) ^ \
keyBytes[(index) * 4 + 3])
int ATERMAesExpandEncryptKey(u32* expandedKey, const void* key, u32 keyBits) {
int ATERMAesExpandEncryptKey(u32* roundKey, const void* key, int keyBits) {
const u8* keyBytes = (const u8*)key;
u32* roundKey = expandedKey;
int round = 0;
u32 keyWord;
s32 generatedRounds = 0;
u32 initialKey[4];
s32 wordIndex;
for (wordIndex = 0; wordIndex < 4; wordIndex++) {
initialKey[wordIndex] =
(((u32)keyBytes[wordIndex * 4] << 24) ^
((u32)keyBytes[wordIndex * 4 + 1] << 16)) ^
((u32)keyBytes[wordIndex * 4 + 2] << 8) ^
keyBytes[wordIndex * 4 + 3];
}
for (wordIndex = 0; wordIndex < 4; wordIndex++) {
expandedKey[wordIndex] = initialKey[wordIndex];
}
if ((s32)keyBits == 0x80) {
const u32* roundConstant;
roundConstant = gAtermAesRoundConstants;
do {
roundKey[0] = ATERM_AES_GETU32(keyBytes);
roundKey[1] = ATERM_AES_GETU32(keyBytes + 4);
roundKey[2] = ATERM_AES_GETU32(keyBytes + 8);
roundKey[3] = ATERM_AES_GETU32(keyBytes + 12);
if (keyBits == 128) {
for (;;) {
keyWord = roundKey[3];
roundKey[4] =
(*roundConstant++ ^
((gAtermAesSubstitutionTable[keyWord >> 24] & 0xFF) ^
(gAtermAesSubstitutionTable[keyWord & 0xFF] & 0xFF00))) ^
((roundKey[0] ^
(gAtermAesSubstitutionTable[(keyWord >> 16) & 0xFF] & 0xFF000000)) ^
(gAtermAesSubstitutionTable[(keyWord >> 8) & 0xFF] & 0xFF0000));
roundKey[4] = roundKey[0] ^
(gAtermAesSubstitutionTable[(keyWord >> 16) & 0xFF] & 0xFF000000) ^
(gAtermAesSubstitutionTable[(keyWord >> 8) & 0xFF] & 0x00FF0000) ^
(gAtermAesSubstitutionTable[keyWord & 0xFF] & 0x0000FF00) ^
(gAtermAesSubstitutionTable[keyWord >> 24] & 0x000000FF) ^
gAtermAesRoundConstants[round];
roundKey[5] = roundKey[1] ^ roundKey[4];
roundKey[6] = roundKey[2] ^ roundKey[5];
roundKey[7] = roundKey[3] ^ roundKey[6];
if (++generatedRounds == 10) {
if (++round == 10) {
return 10;
}
roundKey += 4;
} while (1);
}
}
expandedKey[4] = (((u32)keyBytes[19] ^ ((u32)keyBytes[18] << 8)) ^ (((u32)keyBytes[16] << 24) ^ ((u32)keyBytes[17] << 16)));
expandedKey[5] = (((u32)keyBytes[23] ^ ((u32)keyBytes[22] << 8)) ^ (((u32)keyBytes[20] << 24) ^ ((u32)keyBytes[21] << 16)));
if ((s32)keyBits == 0xC0) {
const u32* substitution;
const u32* roundConstant;
roundConstant = gAtermAesRoundConstants;
substitution = gAtermAesSubstitutionTable;
do {
roundKey[4] = ATERM_AES_GETU32(keyBytes + 16);
roundKey[5] = ATERM_AES_GETU32(keyBytes + 20);
if (keyBits == 192) {
for (;;) {
keyWord = roundKey[5];
roundKey[6] = (*roundConstant++ ^ ((substitution[keyWord >> 24] & 0xFF) ^ (substitution[keyWord & 0xFF] & 0xFF00))) ^ ((roundKey[0] ^ (substitution[(keyWord >> 16) & 0xFF] & 0xFF000000)) ^ (substitution[(keyWord >> 8) & 0xFF] & 0xFF0000));
roundKey[6] = roundKey[0] ^
(gAtermAesSubstitutionTable[(keyWord >> 16) & 0xFF] & 0xFF000000) ^
(gAtermAesSubstitutionTable[(keyWord >> 8) & 0xFF] & 0x00FF0000) ^
(gAtermAesSubstitutionTable[keyWord & 0xFF] & 0x0000FF00) ^
(gAtermAesSubstitutionTable[keyWord >> 24] & 0x000000FF) ^
gAtermAesRoundConstants[round];
roundKey[7] = roundKey[1] ^ roundKey[6];
roundKey[8] = roundKey[2] ^ roundKey[7];
roundKey[9] = roundKey[3] ^ roundKey[8];
if (++generatedRounds == 8) {
if (++round == 8) {
return 12;
}
roundKey[10] = roundKey[4] ^ roundKey[9];
roundKey[11] = roundKey[5] ^ roundKey[10];
roundKey += 6;
} while (1);
return 12;
}
}
expandedKey[6] = (((u32)keyBytes[27] ^ ((u32)keyBytes[26] << 8)) ^ (((u32)keyBytes[24] << 24) ^ ((u32)keyBytes[25] << 16)));
expandedKey[7] = (((u32)keyBytes[31] ^ ((u32)keyBytes[30] << 8)) ^ (((u32)keyBytes[28] << 24) ^ ((u32)keyBytes[29] << 16)));
if ((s32)keyBits == 0x100) {
const u32* substitution;
const u32* roundConstant;
roundConstant = gAtermAesRoundConstants;
substitution = gAtermAesSubstitutionTable;
do {
roundKey[6] = ATERM_AES_GETU32(keyBytes + 24);
roundKey[7] = ATERM_AES_GETU32(keyBytes + 28);
if (keyBits == 256) {
for (;;) {
keyWord = roundKey[7];
roundKey[8] = (*roundConstant++ ^ ((substitution[keyWord >> 24] & 0xFF) ^ (substitution[keyWord & 0xFF] & 0xFF00))) ^ ((roundKey[0] ^ (substitution[(keyWord >> 16) & 0xFF] & 0xFF000000)) ^ (substitution[(keyWord >> 8) & 0xFF] & 0xFF0000));
roundKey[8] = roundKey[0] ^
(gAtermAesSubstitutionTable[(keyWord >> 16) & 0xFF] & 0xFF000000) ^
(gAtermAesSubstitutionTable[(keyWord >> 8) & 0xFF] & 0x00FF0000) ^
(gAtermAesSubstitutionTable[keyWord & 0xFF] & 0x0000FF00) ^
(gAtermAesSubstitutionTable[keyWord >> 24] & 0x000000FF) ^
gAtermAesRoundConstants[round];
roundKey[9] = roundKey[1] ^ roundKey[8];
roundKey[10] = roundKey[2] ^ roundKey[9];
roundKey[11] = roundKey[3] ^ roundKey[10];
if (++generatedRounds == 7) {
if (++round == 7) {
return 14;
}
keyWord = roundKey[11];
roundKey[12] = roundKey[4] ^
(substitution[keyWord >> 24] & 0xFF000000) ^
(substitution[(keyWord >> 16) & 0xFF] & 0x00FF0000) ^
(substitution[(keyWord >> 8) & 0xFF] & 0x0000FF00) ^
(substitution[keyWord & 0xFF] & 0x000000FF);
(gAtermAesSubstitutionTable[keyWord >> 24] & 0xFF000000) ^
(gAtermAesSubstitutionTable[(keyWord >> 16) & 0xFF] & 0x00FF0000) ^
(gAtermAesSubstitutionTable[(keyWord >> 8) & 0xFF] & 0x0000FF00) ^
(gAtermAesSubstitutionTable[keyWord & 0xFF] & 0x000000FF);
roundKey[13] = roundKey[5] ^ roundKey[12];
roundKey[14] = roundKey[6] ^ roundKey[13];
roundKey[15] = roundKey[7] ^ roundKey[14];
roundKey += 8;
} while (1);
return 14;
}
}
return 0;
}
#undef ATERM_AES_READ_KEY_WORD
#undef ATERM_AES_SUB_WORD
#undef ATERM_AES_SUB_BYTE
#undef ATERM_AES_SUB_BYTE
#undef ATERM_AES_GETU32
#define ATERM_AES_TRANSFORM_KEY(roundKey, index) \

View File

@@ -892,68 +892,62 @@ s32 CArGBAOdh::cdj_c_colorConv(SArCDJ_OdhMaster* master, u8* sourceData, int for
void CArGBAOdh::LineConv11(u8* source, u8* lumaOutput, u8* cbOutput, u8* crOutput, u16 width, u16 height,
const long* conversionTable, int format) {
u32 planeSize = (u32)width * (u32)height;
const s32* table = conversionTable;
u32 pixelIndex = 0;
for (int i = 0; i < width; i++) {
s32 red;
s32 green;
s32 blue;
s32 red;
s32 green;
s32 blue;
s32 cbValue;
s32 crValue;
if (format == ODH_FORMAT_RGB565) {
u8* pixelSource = source + (pixelIndex & 0x1FFFFFFC) * 8 + (pixelIndex & 3) * 2;
u16 pixel = pixelSource[1];
pixel |= (u16)pixelSource[0] << 8;
red = (pixel >> 11) & 0x1F;
green = (pixel >> 6) & 0x1F;
blue = pixel & 0x1F;
} else if (format == ODH_FORMAT_RGBA8) {
int blueOrPixelOffset = (pixelIndex & 0xFFFFFFFC) * 0x10 + (pixelIndex & 3) * 2;
u8* pixel = source + blueOrPixelOffset;
red = pixel[1] >> 3;
green = pixel[0x20] >> 3;
blue = pixel[0x21] >> 3;
} else {
int sourceOffset = (pixelIndex & 7) + (pixelIndex & 0x3FFFFFF8) * 4;
float y = (float)source[sourceOffset] - colorConvert16;
float cb = (float)source[planeSize + sourceOffset] - colorConvert128;
float cr = (float)source[planeSize * 2 + sourceOffset] - colorConvert128;
red = (int)(colorConvertY * y + colorConvertR * cr);
green = (int)(colorConvertY * y - colorConvertG1 * cb - colorConvertG2 * cr);
blue = (int)(colorConvertY * y + colorConvertB * cb);
if (red < 0) {
red = 0;
}
if (0xFF < red) {
red = 0xFF;
}
if (green < 0) {
green = 0;
}
if (0xFF < green) {
green = 0xFF;
}
if (blue < 0) {
blue = 0;
}
if (0xFF < blue) {
blue = 0xFF;
}
red >>= 3;
green >>= 3;
blue >>= 3;
if (format == ODH_FORMAT_RGB565) {
int offset = (i & ~3) * 8 + (i & 3) * 2;
u16 pixel = source[offset];
pixel <<= 8;
pixel |= source[offset + 1];
red = (pixel >> 11) & 0x1F;
green = (pixel >> 6) & 0x1F;
blue = pixel & 0x1F;
} else if (format == ODH_FORMAT_RGBA8) {
int offset = (i & ~3) * 16 + (i & 3) * 2;
red = source[offset + 1] >> 3;
green = source[offset + 0x20] >> 3;
blue = source[offset + 0x21] >> 3;
} else {
int offset = (i & 7) + (i & ~7) * 4;
float y = source[offset] - colorConvert16;
float cb = source[planeSize + offset] - colorConvert128;
float cr = source[planeSize * 2 + offset] - colorConvert128;
red = colorConvertY * y + colorConvertR * cr;
green = colorConvertY * y - colorConvertG1 * cb - colorConvertG2 * cr;
blue = colorConvertY * y + colorConvertB * cb;
if (red < 0) {
red = 0;
}
if (red > 0xFF) {
red = 0xFF;
}
if (green < 0) {
green = 0;
}
if (green > 0xFF) {
green = 0xFF;
}
if (blue < 0) {
blue = 0;
}
if (blue > 0xFF) {
blue = 0xFF;
}
red >>= 3;
green >>= 3;
blue >>= 3;
}
int cbValue = (table[red + 0x60] + table[green + 0x80] + table[blue + 0xA0]) >> 16;
int crValue = (table[red + 0xC0] + table[green + 0xE0] + table[blue + 0x100]) >> 16;
int luma = (table[red + 0] + table[green + 0x20] + table[blue + 0x40]) >> 16;
*lumaOutput++ = (u8)luma;
*cbOutput++ = (u8)cbValue;
*crOutput++ = (u8)crValue;
pixelIndex++;
cbValue = (conversionTable[red + 0x60] + conversionTable[green + 0x80] + conversionTable[blue + 0xA0]) >> 16;
crValue = (conversionTable[red + 0xC0] + conversionTable[green + 0xE0] + conversionTable[blue + 0x100]) >> 16;
*lumaOutput++ = (conversionTable[red] + conversionTable[green + 0x20] + conversionTable[blue + 0x40]) >> 16;
*cbOutput++ = cbValue;
*crOutput++ = crValue;
}
}
void CArGBAOdh::fdct_fast(u32* coefficients, u8* samples, u32 stride, u32* quantizationTable) {
@@ -2007,208 +2001,206 @@ void CArGBAOdh::LineDeconv22(u8* dest, u8* y, u8* cb, u8* cr, u16 width, u16 hei
}
s32 CArGBAOdh::huffmanDecoder(u32* coefficientOutput, SArCDJ_HuffmanRequest* request, u16** huffmanTables, int component, u32 sourceLimit) {
u32 bitBuffer;
u32 tableCount;
s32 decodeResult;
int bitIndex;
s32 maximumBitLength;
int maxHuffmanBits;
u16 tableEntry;
s32 valueCategory;
u32 tableIndex;
u32 magnitudeMask;
int bytesConsumed;
u8* sourceCursor;
u32 decodedSymbol;
u32 bitCountAndMask;
u32 bitOffset;
int coefficient;
s32 category;
int bytesConsumed;
u32 bitBuffer;
int length;
u32 tableIndex;
int maxLength;
u32 value;
u32 mask;
u32 leafIndex;
u32 run;
u32 i;
bytesConsumed = request->bytesConsumed;
sourceCursor = request->bitstream;
u32 bitOffset = *request->bitCount;
bitOffset = *request->bitCount;
if ((u32)(bytesConsumed + 4) > sourceLimit) {
decodeResult = ODH_ERROR_INVALID_BITSTREAM;
} else {
maximumBitLength = 0xB;
bitBuffer = ((u32)*sourceCursor << 0x18) | ((u32)sourceCursor[1] << 0x10) | ((u32)sourceCursor[2] << 8) | sourceCursor[3];
bitBuffer <<= bitOffset;
if (component == 0) {
maximumBitLength = 9;
}
bitIndex = 1;
tableIndex = 0;
maxHuffmanBits = (int)maximumBitLength;
for (; bitIndex <= maxHuffmanBits; bitIndex++) {
tableEntry = huffmanTables[0][tableIndex];
decodedSymbol = (u32)tableEntry & 0x3FFF;
if (((bitBuffer >> (0x20U - bitIndex)) & 1) == 0) {
if ((tableEntry & 0x8000) != 0) {
valueCategory = huffmanTables[0][tableIndex + decodedSymbol];
break;
}
tableIndex = tableIndex + decodedSymbol;
} else {
if ((tableEntry & 0x4000) != 0) {
u32 leafIndex = tableIndex + decodedSymbol + 1;
valueCategory = huffmanTables[0][leafIndex];
break;
}
tableIndex = tableIndex + decodedSymbol + 1;
}
}
if (bitIndex > maxHuffmanBits) {
decodeResult = ODH_ERROR_INVALID_BITSTREAM;
return ODH_ERROR_INVALID_BITSTREAM;
}
bitBuffer = ((u32)sourceCursor[0] << 24 | (u32)sourceCursor[1] << 16 | (u32)sourceCursor[2] << 8 | sourceCursor[3]) << bitOffset;
maxLength = component == 0 ? 9 : 11;
length = 1;
tableIndex = 0;
for (; length <= maxLength; length++) {
u32 branch;
u16 node;
node = huffmanTables[0][tableIndex];
branch = node & 0x3FFF;
if (((bitBuffer >> (32 - length)) & 1) == 0) {
if (node & 0x8000) {
category = huffmanTables[0][tableIndex + branch];
break;
}
tableIndex += branch;
} else {
if (valueCategory > 0) {
bitCountAndMask = (1 << (valueCategory)) - 1;
bitBuffer = bitCountAndMask & (bitBuffer >> ((0x20 - bitIndex) - valueCategory));
if ((bitBuffer & (1 << (valueCategory - 1))) == 0) {
bitBuffer = bitBuffer + 1 | ~bitCountAndMask;
}
} else {
bitBuffer = 0;
if (node & 0x4000) {
leafIndex = tableIndex + branch + 1;
category = huffmanTables[0][leafIndex];
break;
}
u32** predictors = request->predictors;
u32* predictor = predictors[component >> 1];
bitCountAndMask = bitOffset + bitIndex + valueCategory;
tableIndex = (bitCountAndMask >> 3);
decodedSymbol = 1;
bitIndex = (int)bitBuffer + *predictor;
*coefficientOutput = bitIndex;
*predictors[component >> 1] = bitIndex;
while (bitCountAndMask >= 8) {
sourceCursor++;
bytesConsumed++;
bitCountAndMask -= 8;
}
do {
if ((u32)(bytesConsumed + 4) > sourceLimit) {
decodeResult = ODH_ERROR_INVALID_BITSTREAM;
goto finishDecode;
}
bitIndex = 1;
tableIndex = 0;
bitBuffer = ((u32)*sourceCursor << 0x18) | ((u32)sourceCursor[1] << 0x10) | ((u32)sourceCursor[2] << 8) | sourceCursor[3];
bitBuffer <<= bitCountAndMask;
maximumBitLength = 6;
for (; maximumBitLength != 0; maximumBitLength--) {
tableEntry = huffmanTables[1][tableIndex];
tableCount = (u32)tableEntry & 0x3FFF;
if (((bitBuffer >> (0x20U - bitIndex)) & 1) == 0) {
if ((tableEntry & 0x8000) != 0) {
valueCategory = huffmanTables[1][tableIndex + tableCount];
break;
}
tableIndex = tableIndex + tableCount;
} else {
if ((tableEntry & 0x4000) != 0) {
valueCategory = huffmanTables[1][tableIndex + tableCount + 1];
break;
}
tableIndex = tableIndex + tableCount + 1;
}
bitIndex++;
}
if (bitIndex > 6) {
decodeResult = ODH_ERROR_INVALID_BITSTREAM;
goto finishDecode;
}
if (valueCategory == 7) {
bitCountAndMask += bitIndex;
tableIndex = (bitCountAndMask >> 3);
while (bitCountAndMask >= 8) {
sourceCursor++;
bytesConsumed++;
bitCountAndMask -= 8;
}
break;
}
if (valueCategory > 0) {
tableIndex = (u32)(1 << (valueCategory)) - 1 &
(bitBuffer >> ((0x20 - bitIndex) - valueCategory));
if ((tableIndex & (u32)(1 << (valueCategory - 1))) == 0) {
decodeResult = ODH_ERROR_INVALID_BITSTREAM;
goto finishDecode;
}
} else {
tableIndex = 0;
}
for (u32 zeroIndex = 0; zeroIndex < tableIndex; zeroIndex++) {
coefficientOutput[decodedSymbol] = 0;
decodedSymbol++;
}
bitCountAndMask = bitCountAndMask + bitIndex + valueCategory;
tableIndex = (bitCountAndMask >> 3);
while (bitCountAndMask >= 8) {
sourceCursor++;
bytesConsumed++;
bitCountAndMask -= 8;
}
if ((u32)(bytesConsumed + 4) > sourceLimit) {
decodeResult = ODH_ERROR_INVALID_BITSTREAM;
goto finishDecode;
}
maximumBitLength = 0xB;
bitBuffer = ((u32)*sourceCursor << 0x18) | ((u32)sourceCursor[1] << 0x10) | ((u32)sourceCursor[2] << 8) | sourceCursor[3];
bitBuffer <<= bitCountAndMask;
if (component == 0) {
maximumBitLength = 9;
}
bitIndex = 1;
tableIndex = 0;
maxHuffmanBits = (int)maximumBitLength;
for (; bitIndex <= maxHuffmanBits; bitIndex++) {
tableEntry = huffmanTables[0][tableIndex];
tableCount = (u32)tableEntry & 0x3FFF;
if (((bitBuffer >> (0x20U - bitIndex)) & 1) == 0) {
if ((tableEntry & 0x8000) != 0) {
valueCategory = huffmanTables[0][tableIndex + tableCount];
break;
}
tableIndex = tableIndex + tableCount;
} else {
if ((tableEntry & 0x4000) != 0) {
valueCategory = huffmanTables[0][tableIndex + tableCount + 1];
break;
}
tableIndex = tableIndex + tableCount + 1;
}
}
if (bitIndex > maxHuffmanBits) {
decodeResult = ODH_ERROR_INVALID_BITSTREAM;
goto finishDecode;
}
if (valueCategory > 0) {
magnitudeMask = (1 << (valueCategory)) - 1;
bitBuffer = magnitudeMask & (bitBuffer >> ((0x20 - bitIndex) - valueCategory));
if ((bitBuffer & (1 << (valueCategory - 1))) == 0) {
bitBuffer = bitBuffer + 1 | ~magnitudeMask;
}
} else {
bitBuffer = 0;
}
bitCountAndMask = bitCountAndMask + bitIndex + valueCategory;
coefficientOutput[decodedSymbol] = bitBuffer;
tableIndex = (bitCountAndMask >> 3);
decodedSymbol = decodedSymbol + 1;
while (bitCountAndMask >= 8) {
sourceCursor++;
bytesConsumed++;
bitCountAndMask -= 8;
}
} while ((int)decodedSymbol < 0x40);
for (; (int)decodedSymbol < 0x40; decodedSymbol++) {
coefficientOutput[decodedSymbol] = 0;
}
request->bytesConsumed = bytesConsumed;
decodeResult = 0;
request->bitstream = sourceCursor;
*request->bitCount = bitCountAndMask;
tableIndex += branch + 1;
}
}
finishDecode:
return decodeResult;
}
if (length > maxLength) {
return ODH_ERROR_INVALID_BITSTREAM;
}
if (category > 0) {
mask = (1 << category) - 1;
value = mask & (bitBuffer >> (32 - length - category));
if ((value & (1 << (category - 1))) == 0) {
value = (value + 1) | ~mask;
}
} else {
value = 0;
}
bitOffset += length + category;
coefficient = 1;
coefficientOutput[0] = value + *request->predictors[component >> 1];
*request->predictors[component >> 1] = coefficientOutput[0];
while (bitOffset >= 8) {
sourceCursor++;
bytesConsumed++;
bitOffset -= 8;
}
do {
if ((u32)(bytesConsumed + 4) > sourceLimit) {
return ODH_ERROR_INVALID_BITSTREAM;
}
bitBuffer = ((u32)sourceCursor[0] << 24 | (u32)sourceCursor[1] << 16 | (u32)sourceCursor[2] << 8 | sourceCursor[3]) << bitOffset;
length = 1;
tableIndex = 0;
for (; length <= 6; length++) {
u32 branch;
u16 node;
node = huffmanTables[1][tableIndex];
branch = node & 0x3FFF;
if (((bitBuffer >> (32 - length)) & 1) == 0) {
if (node & 0x8000) {
category = huffmanTables[1][tableIndex + branch];
break;
}
tableIndex += branch;
} else {
if (node & 0x4000) {
category = huffmanTables[1][tableIndex + branch + 1];
break;
}
tableIndex += branch + 1;
}
}
if (length > 6) {
return ODH_ERROR_INVALID_BITSTREAM;
}
if (category == 7) {
bitOffset += length;
while (bitOffset >= 8) {
sourceCursor++;
bytesConsumed++;
bitOffset -= 8;
}
break;
}
if (category > 0) {
run = ((1 << category) - 1) & (bitBuffer >> (32 - length - category));
if ((run & (1 << (category - 1))) == 0) {
return ODH_ERROR_INVALID_BITSTREAM;
}
} else {
run = 0;
}
for (i = 0; i < run; i++) {
coefficientOutput[coefficient] = 0;
coefficient++;
}
bitOffset += length + category;
while (bitOffset >= 8) {
sourceCursor++;
bytesConsumed++;
bitOffset -= 8;
}
if ((u32)(bytesConsumed + 4) > sourceLimit) {
return ODH_ERROR_INVALID_BITSTREAM;
}
bitBuffer = ((u32)sourceCursor[0] << 24 | (u32)sourceCursor[1] << 16 | (u32)sourceCursor[2] << 8 | sourceCursor[3]) << bitOffset;
maxLength = component == 0 ? 9 : 11;
length = 1;
tableIndex = 0;
for (; length <= maxLength; length++) {
u32 branch;
u16 node;
node = huffmanTables[0][tableIndex];
branch = node & 0x3FFF;
if (((bitBuffer >> (32 - length)) & 1) == 0) {
if (node & 0x8000) {
category = huffmanTables[0][tableIndex + branch];
break;
}
tableIndex += branch;
} else {
if (node & 0x4000) {
category = huffmanTables[0][tableIndex + branch + 1];
break;
}
tableIndex += branch + 1;
}
}
if (length > maxLength) {
return ODH_ERROR_INVALID_BITSTREAM;
}
if (category > 0) {
mask = (1 << category) - 1;
value = mask & (bitBuffer >> (32 - length - category));
if ((value & (1 << (category - 1))) == 0) {
value = (value + 1) | ~mask;
}
} else {
value = 0;
}
coefficientOutput[coefficient++] = value;
bitOffset += length + category;
while (bitOffset >= 8) {
sourceCursor++;
bytesConsumed++;
bitOffset -= 8;
}
} while (coefficient < 64);
for (; coefficient < 64; coefficient++) {
coefficientOutput[coefficient] = 0;
}
request->bytesConsumed = bytesConsumed;
request->bitstream = sourceCursor;
*request->bitCount = bitOffset;
return 0;
}
void CArGBAOdh::idct_fast(const u8* rangeLimitTable, u32* coefficients, u32* quantizationTable, u8* destination, u32 stride) {
int evenPart0, evenPart1, evenPart2, evenPart3, oddPart3, oddPart2, oddPart1, oddPart0;
int butterflyTerm0, butterflyTerm1, butterflyTerm2, evenInnerSum;

View File

@@ -0,0 +1,58 @@
# CHANSVm converter input types
Base: `20cf9f9f25b13b8cd6910e07cc5eb71558845d4e`, target 43U only.
## Change and source review
`CHANSVmConvertToFloatFromStr` took a pointer-to-const source header while
`VmConvertFunc` specified a mutable source header. The conversion table cast
hid that incompatible function-pointer type at the indirect call.
Give all 11 converters and the callback typedef the same pointer-to-const
source-header type, and remove the callback cast. All converters either read
source values, ignore the source, or pass it through the read-only array-join
path. They write only newly allocated result objects. Propagate the input type
through `VmArrayJoinCommon`, `VmArrayJoinEstimateStrSize`, `VmArrayJoinSub`, and
`VmArraySeekTop`, including the forward declaration. These helpers only read
the source header; the join routines write the destination string and local
state. `VmArraySeekTop` still returns a mutable chunk pointer because header
constness is shallow and other callers can mutate array elements. No cast is
needed at the array-join boundary.
The public `CHANSVmConvertObjectType` input remains mutable: its same-type fast
path returns the original mutable object. Passing it to a const-source
converter is valid. No executable expressions, flags, data or layout changed.
## Fresh leaf verification
Configured using the restored `wii-source-tools/build-43U.sh` tool paths and
flags, with commands run in the isolated leaf instead of that script's fixed
main directory. Baseline object was freshly compiled before editing.
- Entire CHANSVm object is byte-identical to that baseline, SHA256
`11fa48261cd93668d133d5ef73efbf3c9109181730b21409153b78316189e063`.
All 233 sibling function spans, allocated sections and relocations unchanged.
- All 15 emitted converter/dispatch/join functions: exact-name objdiff 100.0,
raw target function bytes and normalized relocation targets identical
(86 code relocations). VmArraySeekTop is inlined.
- All target data sections match including alignment padding: `.rodata` 1432,
`.data` 4672, `.sdata2` 184, `.sdata` 600, `.sbss` 16 bytes;
all 614 data relocations match by resolved section/function target.
- Pool: 125/125 strings identical. Dispatch ctxdiff: 47/47 instructions, 0 diffs.
FloatFromStr: 83/83 instructions, one textual symbol-alias difference
(`VmNaN` versus `lbl_81694F08`); raw bytes and resolved relocation target are
identical. This is not represented as a literal ctxdiff-zero result.
- Fresh full 43U build, report and `build/43U/ok` pass. DOL SHA1:
`26116613f624061ba99c8d1a299aaa6efa85670d`.
- All 1028 unit measures/functions/sections and overall report measures are
unchanged against the saved base report. All 22 workflow guards pass with
no skips. `git diff --check` passes.
This is a binary-neutral type correction, not a new matching/linking gain.
CHANSVm remains 229/233 exact, 45284/53564 exact code bytes, 6904/6904 matching
data bytes, and unlinked. The completion assertion still fails on the existing
project-wide incomplete code/link totals; no full-completion claim is made.
Local evidence: `../vm-converter-const-evidence/` contains baseline/candidate
build logs, original baseline object/report, verification script/results,
full-build/report/ok logs, pool and ctxdiff results, guards and completion logs.

View File

@@ -0,0 +1,30 @@
## Wave w1011c — scheduling/opt pragmas on _create_icon (no movement)
Baseline 100v100 insn-equal, 20 diff ops (remat-vs-pin wall):
- `scheduling 604` → 26d (worse); `scheduling 750`/`schedule_twice on` → 20d (inert)
- `optimization_level 2` → 104 insns (+4, 11d) — rejected
- `ppc_iro_level 2/3` → 21d/20d (inert); IRO 0/1 previously regressed to 124v100
- TU `-ipa function`/`-ipa off` → 20d (inert); TU `-O4,p` → 20d (inert)
## w1011e — _create_icon decode progress
Orig pattern decoded: literal `&mFileCell[slot][file].icon` in first call arg
(recomputed per call) + NAMED local declared between calls -> "recompute + pin"
(`add r3,sum; bl; add r24,sum; mr r3,r24`). texObj/tlutObj named locals reproduce
the pin structure — diff moved to pure reg rotation but stays 20d.
Assoc fossil: orig groups `+0x10EC` (0xFE8+0x104 = member+icon offsets) into the
ROW base BEFORE `file*0x15c` — `((this+slot*S)+0x10ec)+file*0x15c`. Natural
`[slot][file].member` assoc is index-first. cell*/flat-byte/row-ref variants
regress (26/24/24). Also orig saves args r25-r28 vs mine r24-r27 — one extra
early callee web again.
## w1011f — volatile-cast lever (#1309 idiom) assessed
`((volatile memorycard::IconState*)icon)->member` tried at three granularities:
named vicon local on all member reads -> 98v100 (-2 insns, 25d); site-casts on
fmt+offset+tlutOffset -> 98v100/25d; site-cast on iconOffset only -> 100v100/20d
(neutral, single-use read). Verdict: fossils' webs are ADDRESS arithmetic
(recomputed base+off per call arg), not polled member reloads — the volatile
lever doesn't apply. IconState's own volatile members (bannerEnable etc.)
are already correctly declared in the header.

View File

@@ -0,0 +1,47 @@
# ODH source-integrity checks
Base: 3d7e767cf729de96ac1cd88ddbf5c18eaa08187d (43U only).
- Restored unsigned arithmetic in all three huffmanDecoder word refills by
casting the shifted bytes to u32. The combined word and its bitOffset shift
now remain unsigned, including input words with the high bit set.
- Restored unsigned planeSize indexing in LineConv11. Chroma source pointers
are only formed by accesses in the planar-format branch. The RGB565 caller
passes a row-offset pointer into Capture's GXGetTexBufferSize allocation;
for tile-aligned dimensions that allocation is exactly width*height*2 bytes.
Unconditionally adding two planes to a nonzero row pointer could therefore
form an out-of-bounds pointer even though RGB565 never dereferences it.
- Reviewed the full huffmanDecoder rewrite against its preceding source.
Other category shifts and caller/table preconditions were already present;
no additional newly introduced arithmetic issue was identified in this pass.
One candidate, no compiler flags or other source changes. No debugger, compiler
memory access, forced registers, assembly, uninitialized values, or online source
references were used. Retail objects and disassembly remained local.
Validation:
- All allocated source-object sections, function spans, and resolved relocations
are identical to the unmodified base object (debug metadata differs).
- All 28 retail function spans are raw-byte exact: 14,684 bytes, with all 203
relocations identical after resolving local symbols to actual section offsets
and code symbols to function-relative targets.
- Data matches: .rodata 5,856, .data 464, .sdata2 40 bytes. The source .data is
459 bytes plus five zero alignment bytes in the split/link target.
- Pool identical, 10/10 strings. huffmanDecoder ctxdiff: 306/306, zero diffs.
LineConv11: 146/146; the strict-name local helper prints eight pre-existing
label-name differences. Exact bytes, resolved relocation destinations, and
referenced data independently match; none were ignored without resolution.
- Official objdiff: ODH 28/28 functions; code, data, fuzzy and link all 100%.
- Every measure, function and section in all 1,028 report units, plus all global
measures, is unchanged from the base report.
- Full 43U build and build/43U/ok pass. DOL SHA1:
26116613f624061ba99c8d1a299aaa6efa85670d.
- All 22 workflow-guard tests pass. A host UBSan refill test passes 524,288
cases against a 64-bit oracle (every high byte, offsets 0..7).
- The global completion checker still fails on pre-existing incomplete units;
this change does not claim repository-wide completion.
Local reproducible evidence: ../odh-unsigned-refills-evidence/verify.py,
verification.log, full-build.log, pool.log, guards.log, refill-test.cpp/log,
completion.log, status.json and dol.sha1. No publication or merge performed.

View File

@@ -109,3 +109,35 @@ AOSS_Init_old 1306/1584, AOSSApplyAuthOptions 22/114, AOSSXorBufferWithKey 34/14
AOSSData, 1128/1128). AOSS 18/21 exact (17 -> 18), code 7720 -> 8812/16192, ATERM 20/26 unchanged, pools
identical, global matched code 97.12163 -> 97.15810, fuzzy 99.88565 -> 99.88839, data 100%, 0 forbidden, 0
readability, DOL SHA1 OK.
# opus-aoss round 3 (2026-10-09): AOSSXorBufferWithKey, AOSS_Init_old
Worktree data-d1, branch agent/w1009/o-aoss at origin/main 72e9c8d6. Scratch
compiles in /tmp/opus-aoss (same flags as ninja, 0.2 s per unit).
## AOSSXorBufferWithKey: 34 -> 0
mwdbg on the old forms (base, compound `^=`, `P = P ^ K`, `output` pointer)
showed what decides the unrolled-loop registers. The second loop's index is
an IRO temp split late, so it is numbered below the IRO CSE cursors
(`packetHalf + index`, `keyMask + index`). With three per-copy values the
cursors are high-degree and colored before the index, so the index never got
r3. A function-scope `output` pointer (used for load and store) is a named
local and survives; a single-use `mask` pointer inside only the second loop
is propagated back into a CSE temp.
The fix is the same `mask` pointer used in both loops (the first loop writes
the mask byte through it twice). Then both cursors stay named locals, the
index temp is colored first (r3), mask (declared first) gets r4 and output
r5, and `mask =` before `output =` gives the target add order.
| trial | differing |
|---|---|
| 14 loop-body spellings (compound, P^K, K^P, temps u8/u32/int, casts) | 37-57 |
| 256-form sweep (P/K spellings x 16 bodies x shared/new index) | best 24 (`u8* output = &packetHalf[index]`) |
| scoped pragma x every form above (15 pragmas) | best 24 |
| `output`/`mask` function-scope, `mask` only in loop 2 | 24 |
| `mask` in both loops, `output =` before `mask =` | 2 (add order) |
| `mask` in both loops, `mask =` before `output =` | **0** |
Unit after: 20/21 exact, pool identical.

View File

@@ -0,0 +1,40 @@
# opus-aterm attempts (ATERM, 2026-10-09)
Baseline 72e9c8d6: ATERM 20/26 exact; open: BuildEncryptedMessage 2, AutoConfigThread 3,
AesExpandEncryptKey 6, DiscoverAccessPoints 17, BuildAssociationRequest 28, RunConfigProtocol 294.
## Pragma sweep (combosweep, GC/3.0a5.2)
Single and pairwise pragmas: no function improves (BEST = base for all six).
## Compiler version (new finding)
Compiled the unchanged ATERM.c with every GC/Wii compiler that accepts the unit's flags:
| compiler | exact | total diffs | AutoConfigThread |
| --- | ---: | ---: | ---: |
| GC/3.0a3, 3.0a3.2, 3.0a3.3, 3.0a3.4, 3.0a5 | 21/26 | 347 | 0 |
| GC/3.0a5.2 (previous) | 20/26 | 350 | 3 |
| Wii/* | 7/26 | 1590+ | 5 |
GC/3.0a5 makes ATERMi_AutoConfigThread exact with no other function changing; pool identical,
data 100%. The other third-party middleware in this project (Zi Corp eZiText, NHTTP, bte) is already
built with GC/3.0a5. Set `mw_version="GC/3.0a5"` on ATERM.c.
## ATERMBuildEncryptedMessage (2: entry `mr r29,r7` / `mr r3,r27` swapped)
Read MWCC's scheduler (rayanht/mwcc decomp: Scheduler.c, MachineSimulation750.c) and wrote a model
(/tmp/opus-aterm-sched/sim.py). It reproduces our entry block and six micro-tests exactly (count of
unlocked successors, then height, then opcode rank mr < li, then program order; 2 IU slots).
The entry block is scheduled once, before register allocation (block flag 8 stops the post-RA pass).
Exhaustive search over that model: no order of the same ten PCode instructions with the parameter
copies first gives the target, and no single extra/deleted instruction does either. The target order
needs the copy of r7 to come after memset's first-argument move in the scheduler input.
## ATERMAesExpandEncryptKey (6 -> 0, EXACT)
The function is rijndaelKeySetupEnc from the public reference rijndael-alg-fst.c (Te4 = the
substitution table, rcon = the round constants). Earlier forms (initialKey[] array + copy loop,
hand-reassociated XOR trees) left the second key word's two XOR halves scheduled in the other order.
Trials (all GC/3.0a5): array/scalar/direct stores x seven XOR associations: 9..268; reference
GETU32 + reference loops verbatim: 3 (only cmplwi vs cmpwi); with the reference `int keyBits`: 0.

View File

@@ -0,0 +1,44 @@
# opus-bs2update UpdateThread attempts
Worktree data-d10, branch agent/w1009/o-bs2update, base 72e9c8d6 (origin/main). Owned `src/BS2/BS2Update.c`; the fix also needs a one-line rename in `config/43U/symbols.txt` and the Matching flip in `configure.py`. Read opus-common, levers, the effort-policy entries, sol-x8, sol-y3 (`git show 4925fde2`) and sol-z1.
Start: UpdateThread 6/913 differing, equal size 0xe44. The other nine functions are exact. The remaining diffs are the three seat-loop scheduling swaps described by sol-x8, sol-y3 and sol-z1.
combosweep (single and pairwise allowed pragmas): `BEST src/BS2/BS2Update UpdateThread base 6 -> 6 []`. No pragma moves it.
## Diagnosis
The decompiled 1.2.5 scheduler (rayanht/mwcc `src/backend/Scheduler.c`, inspiredrobot/mwcc `docs/SCHEDULER.md`) adds a store-to-later-load edge for every memory pair the alias test cannot separate, with the store's latency. sol-y3's capture already showed that the seat loads carry a worst-case alias set that contains Flags0's bit, so `Flags0[index] = 0` wins the height race against the seat address `add`. The target schedules the `add` first. That is the order you get when no such edge exists.
I tested small probe functions with the unit's exact compiler flags: a loop that stores `FlagsX[i] = 0` and then tests `p[i].attr & 1`. The results:
| Seat entries come from | Flag array | Edge (store first)? |
| --- | --- | --- |
| absolute `T a[] : addr` (array, struct, single entry, const, static) | file-scope static | yes |
| integer cast `(T*)0x80480000 + n` (folds to `addis`, wrong form anyway) | file-scope static | yes |
| pointer parameter | file-scope static | yes |
| normal relocated global array | file-scope static | no, but needs `lis/addi` with relocs (wrong form) |
| absolute array (target's `lis r0,0x8048; add` form) | file-scope static, initialized or tentative, extern | yes |
| absolute array | **function-local static** | **no** |
| absolute array | global scalar / local stack array | no |
An unknown pointer (absolute storage counts as unknown) may alias every file-scope object, but not a function-local static whose address is never taken. The target keeps the absolute `lis r0, 0x8048; add` form and has no edge. So Flags0 was a function-local static of the selection code.
## .bss order
The target order is Flags0, Flags1, Thread, ThreadStack, UpdateHeader0, UpdateHeader1. Probes on the same compiler show the emission rules:
- initialized objects are emitted where they are defined;
- tentative definitions are emitted at their first use;
- a function static is emitted when its function is parsed.
So the static has to come from a function parsed before BS2UpdateInit, and the other five arrays have to be tentative definitions. Init first uses Flags1, Thread and ThreadStack, and the inlined selection code first uses UpdateHeader0 and UpdateHeader1. That gives exactly the target order.
## Trials
1. `seatEntries = (BS2UpdateEntry*)0x80480000 + wadCount`: 549/912 (address folds into `addis`; the swaps stay). Rejected.
2. `static u32 Flags0[...] = {0};` inside BS2SelectUpdateEntries, everything else unchanged: 18/913. All three swaps gone; the 18 left are .bss offsets because Flags0 lands after UpdateHeader1. Init 4 diffs from the same shift.
3. As 2, but the Flags1/Thread/ThreadStack/UpdateHeader0/UpdateHeader1 definitions are tentative (the `= {0}` initializers dropped) and BS2SelectUpdateEntries is defined before BS2UpdateInit: **UpdateThread 0/913, all 10 functions exact**. .bss layout identical to the target, pool 55/55 identical.
4. Rename the target symbol `Flags0` to the compiler's local-static name `Flags0$1129` in config/43U/symbols.txt. This is the project convention for function statics (144 `name$N` entries). Report: code 4052/4052, data 10488/10488, every section 100%, functions 10/10.
5. Flip BS2Update to Matching and run the full build: DOL SHA1 26116613f624061ba99c8d1a299aaa6efa85670d. build.ninja links build/43U/src/src/BS2/BS2Update.o.
No pragma, asm, volatile change, carrier, padding or dummy is added. The source change is: the selection helper moves above BS2UpdateInit, Flags0 becomes its function static, and five `= {0}` initializers are removed.

View File

@@ -0,0 +1,61 @@
# opus-candbox attempts
Worktree `sol-high`, branch `agent/w1009/o-candbox`, base `72e9c8d6`. Unit `src/keyboard/tiCandidateBox`, last open function `LayoutByNW4R::createAnmPane_` (6/216, count r23 and slot r31 swapped). Read opus-common.md, levers.md, effort-policy entries, sol-x9 log, sol-m4 log (branch `agent/w1009/candbox-max`), saved sol-r12/sol-y11 diffs.
Baseline: full build OK, DOL `26116613...`, odiff 6/216, pool identical 57/57. combosweep (single and pairwise pragmas): `base 6 -> 6`, no hit.
## Root cause
`tiPredictLang::create` is already exact and has the same inner loop with the same struct (`char paneName[20]`, `count`, `forceAddName`, `pAnims[8]`). Its target has count r31 and slot r23, which is what createAnmPane_ needs.
A private mwdbg trace of `tiPredictLang::create` (port 19931 copy of the launcher, shared tool unchanged) shows why. The slot base `p + j*4` is IRO CSE temp `@7026` (vreg r45) and forceAddName is IRO temp `@7028` (r44). Both are numbered after the named locals and before the hoisted constructor constants, so they simplify before the constants and color after them (slot r23). Count is a late anonymous load hoisted out of the loop condition (r131), so it colors first (r31).
The same natural loop inside tiCandidateBox (`j < paneAnimations.count`, `paneAnimations.pAnims[j]->` three times) gives 220 insns. No IRO temps are created, the slot is recomputed in each branch, and constant `2` survives pass-1 spilling.
Table declaration trials with that loop:
| trial | table | result |
| --- | --- | --- |
| 01 | `extern "C" const CandidatePaneData scCandidatePaneData` (struct wrapper, aligned(8)) | 158/220 |
| 02 | `static const CandidatePaneData` (struct wrapper) | 158/220 |
| 03 | `extern "C" const PaneToAnimation[]` (plain array) | 158/220 |
| 04 | `static const PaneToAnimation[]` (plain array, no aligned) | **0/216** |
IRO only CSEs the table loads and addresses when the table is a static plain array, which is how every sibling unit declares it (`csPaneToAnimation`). The `CandidatePaneData` wrapper and `extern "C"` were decomp scaffolding. Without `aligned(8)` the table still lands at .data 0x28, size 0x680.
## Source changes
- Table: `static const PaneToAnimation csPaneToAnimation[]`, same name as tiToolBar/tiPredictLang/pctype. Removed the unused `CandidatePaneData` struct.
- `createAnmPane_`: the tiPredictLang/tiToolBar loop form, with no count/forceAddName/animation locals.
- symbols.txt: `scCandidatePaneData` -> `csPaneToAnimation__Q29textinput12candidatebox` (scope:local). Same address and size. Only tiCandidateBox referenced the old name.
Unit after this: 112/112 functions, code 100%, data 100%, all sections 100%, pool identical.
## Link (Matching flip)
First flip: DOL `8d444a7b...`. Two causes, both checked against the original objects:
1. Thunk order. Target `@36@__dt__` comes before `@36@setRootPaneScaleFor4x3..init`; ours put it last (already true on the old baseline). This is the "move to end on touch" thunk list (eggAudioExpMgr, lever 12). tiPredictLang/tiToolBar/tiCellPhone fix it with a header `Sample : public LayoutByNW4R` behind a `*_SAMPLE_CLASS` macro, and `__vt__Q39textinput12candidatebox6Sample` exists in the DOL. A Sample with only `virtual ~Sample() {}` does not move the thunks. It needs the inline constructor, so the Base/EventHandler/LayoutByNW4R constructor guards also accept `TI_CANDIDATEBOX_SAMPLE_CLASS`, as tiPredictLang.h does. After that, all 112 common functions are in target order. Proof it is required: removing it leaves the wrong thunk order and DOL `5507fb9e...`.
2. Weak vtable hole. The target has 0x40 zero bytes between `__vt__...AnmObserver` (0xd48) and `__vt__Q39textinput4util12AnimObserver` (0xd94). Ours left only the deduplicated gui::EventHandler copy (0x18), so everything after shifted by -0x20/-0x24. util::Animation methods were inline in the original: they sit as scattered weak functions in tiInputForm's .text, and MyTiManager.cpp already defines them `inline`. UITextArea has a `util::Animation` member, so the original object also emitted a weak `__vt__Q39textinput4util9Animation` (0x24, kept from tiInputForm). EventHandler 0x18 at 0xd58 + Animation 0x24 at 0xd70 ends at 0xd94. I added the same inline definitions as MyTiManager.cpp at the end of tiCandidateBox.cpp, with startAnm in this TU's declared parameter order. Only virtual calls exist, so no code changes. .data is now 0xda0, the target size.
Flip with both: full build OK, `build/43U/main.dol` SHA1 `26116613f624061ba99c8d1a299aaa6efa85670d`.
Trial snapshots: `/tmp/opus-candbox/trials/`. Captures: `/tmp/opus-candbox-cap-predictlang`, `/tmp/opus-candbox-cap-f01`.
## Gate
```text
full build: ok
main.dol sha1: 26116613f624061ba99c8d1a299aaa6efa85670d
[src/keyboard/tiCandidateBox] pool: IDENTICAL
[src/keyboard/tiCandidateBox] objdiff: code 24000/24000 data 4652/4652 functions 112/112 fuzzy 100.0000 linked code 24000
[src/keyboard/tiCandidateBox] instruction-exact functions: 112/112
regressions vs baseline: 0
global matched_code_percent: 98.14728 -> 98.17613
global complete_code_percent: 91.22256 -> 92.02384
forbidden patterns added (net, per file): 0
readability warnings (net, per file; must be 0 in the final result): 0
GATE PASS
```
origin/main moved to `82783c6e` during the run (BS2Update lines in configure.py/symbols.txt only, no overlap). Not rebased.

View File

@@ -0,0 +1,47 @@
# opus-chansvm: CHANSVm round (ConvertToFloatFromStr, WinEmuWrite, DateDtor, BlobGetHexString, BlobPackCommon, Step)
Worktree data-d2, branch agent/w1009/o-chansvm, base 72e9c8d6. Start: 227/233 exact.
Scratch harness: /tmp/opus-chansvm (score.py compiles the unit with the Ninja flags and diffs every function).
## combosweep (single + pairwise pragmas, whole unit)
No setting improves any of the six functions (Float 2, Win 5, Date 7, Hex 14, Pack 47, Step 262).
## CHANSVmConvertToFloatFromStr: 2 -> 0 (exact)
Diff: target `lbz type; li 0; stw endPtr; cmplwi`, ours `... cmplwi; stw`.
Scheduler RE (mwcceppc 0x599ac0 builds the block graph bottom-up; 0x5a0150/0x5a0170 is Alias.c may_alias):
a load gets an edge to every later store it may alias, with the load latency as delay. The `obj->type`
load had the worst_case alias set, which contains the escaped local endPtr, so LBZ -> STW had delay 2
and the compare won the cycle-2 tie. A load whose base register comes from a pointer-to-const (or
restrict) variable gets a private pseudo-object alias instead (see zcanann/FFCC-Decomp
tools/patch_compiler_rw.py notes), so the edge disappears and the store issues at cycle 1.
The inlined parser's `const` parameter is copy-propagated into the caller's `object`, so the const has
to be on the caller's parameter. Small-harness check: const/restrict on the inline parameter alone keeps
the old order; on the caller parameter it gives the target order.
| attempt | Float | others |
|---|---|---|
| `const CHANSVmObjHdr* object` on ConvertToFloatFromStr, `(VmConvertFunc)` cast at its table slot | 0 | no change |
| VmConvertFunc typedef and all 11 converters take const, cast in StrFromArray | 0 | no change |
| `#pragma opt_pointer_analysis on` (diagnostic) | compiler segfaults | - |
Kept the first (minimal) form. Same lever as CHANSVmParseInt (`const CHANSVmObjHdr* obj`).
## VmDateDtor: 7 -> 0 (exact)
Diff: target loads `MonthTbl[mon]` before the outgoing `year` stack-argument store; ours after it.
Same mechanism: the stack-argument stores carry the worst_case alias, and global tables are members of
it, so every store -> table-load edge had delay 2. The target object has no symbols for the two tables
(0xb34, 0xb50 are unnamed local data), so they were never globals.
| attempt | Date | others |
|---|---|---|
| file-scope `static` on both tables | 7 | no change |
| file-scope `static` on one table (each) | 7 | no change |
| both tables as function-scope `static` inside VmDateDtor | 0 | no change, .data bytes identical |
| plus direct `date.x` access instead of `datePtr` | 84 | - |
Kept function-scope statics with the datePtr form.

View File

@@ -0,0 +1,68 @@
# opus-odh attempts (src/system/odh)
Worktree data-d6, branch agent/w1009/o-odh from origin/main 72e9c8d6. Read opus-common.md, sol-r4 and
sol-m2 logs, effort-policy entries, levers.md, the mwdbg README and the allocator reference.
Baseline: LineConv11 12/146, huffmanDecoder 171/306, unit 26/28 exact, pool identical.
## combosweep (run first)
- main source: LineConv11 12 -> 12, huffmanDecoder 171 -> 166 (opt_propagation off). No exact.
- sol-m2 seed: LineConv11 6 -> 6, huffmanDecoder 114 -> 114. No exact.
## LineConv11: EXACT
mwdbg capture of the seed: inside the loop r8 is the only free volatile GPR, so every other temp takes a
saved register and the lowest claimed one wins. The packed RGB565 word (v68) was colored before the
high byte (v66) and took r8. The target needs the high byte on r8, the pointer on r29, and the packed word
colored after cbValue claims r25. So the packed word has to be a named local numbered below cbValue.
Petari's matching SMG source (SMGCommunity/Petari src/Game/Screen/odh.cpp, read-only) does exactly that:
cbValue/crValue are declared with red/green/blue before the format chain, and `pixel` is built high byte
first (`pixel = src[o]; pixel <<= 8; pixel |= src[o + 1];`) inside the RGB565 block. Ported as-is with
this file's names: LineConv11 0/146, ctxdiff diffs 0, pool identical, no other function changes.
Lever isolation (each from the exact version):
- cbValue/crValue declared at their assignment instead: 5 diffs.
- pixel low byte first (`pixel = src[o + 1]; pixel |= src[o] << 8`): 6 diffs.
- pixel as one expression `(src[o] << 8) | src[o + 1]`: 6 diffs.
- planeSize indexing instead of cbSource/crSource pointers: 0 (either form works).
## huffmanDecoder: EXACT
Started from a fresh natural rewrite (early returns, `length`/`tableIndex`/`category` names, Petari-style
tree walks) instead of the Ghidra-shaped seed: 170 diffs, same 306 instructions. Structural fixes first:
- `coefficient = 1` before the first refill loop (the target sets it in the DC block): 163.
- DC leaf through a named `leafIndex` (target keeps `(idx + off + 1) * 2` + lhzx only in the DC walk).
- `length = 1;` before `tableIndex = 0;` in every walk (li order): 139, 0 structural left.
Then allocator work with mwdbg + a per-vreg want list built by aligning backend-04 PCode with the target
object (/tmp/opus-odh-want.py), and an annealer over the numbering (/tmp/opus-odh-anneal.py):
- A full renumbering (temps included) reached 1 miss and showed both maxLength values must be colored
after their walk temps, i.e. behave as codegen temps. `maxLength = component == 0 ? 9 : 11;` gets
copy-propagated into the ternary temp: 139 -> 80.
- `dc` must be colored before the predictor-index temp, so no named `dc`:
`coefficientOutput[0] = value + *pred; *pred = coefficientOutput[0];` (store forwarded, no reload): 68.
- AC tail: target creates the store address before `length + category`:
`coefficientOutput[coefficient++] = value; bitOffset += length + category;`: 66.
- Remaining misses were named-local order only. Simulator: declare sourceCursor, bitOffset, coefficient,
category before bytesConsumed (sourceCursor colors first and takes r12, bitOffset claims r31, then
coefficient r30, category r29, bytesConsumed r28). C89 declarations at the top of the function: 9.
- Last 9: the run walk needs `branch` numbered above `node` (declared first). Per-walk C89 blocks
`u32 branch; u16 node;` then assignments: 0. Only the run walk needs it; using it in all three walks
is also exact, so the final source is uniform.
Checked and rejected along the way: function-scope shared node/branch (always 9, any position);
`value += *pred` (80); chained assignment for the predictor works (68) but the two-statement form reads
better. maxLength/value/mask/leafIndex/run/i can sit anywhere in the top declaration list.
Final: huffmanDecoder 0/306, ctxdiff diffs 0, pool identical, unit 28/28, code 14684/14684, data 6360/6360.
## Link
Flipped system/odh.cpp to Matching. ODHEncodeRGBA8/ODHEncodeY8U8V8/ODHDecodeY8U8V8 are in the source but
not in the split target (unreferenced, dead-stripped); the link output is unchanged.
Full build: main.dol SHA1 26116613f624061ba99c8d1a299aaa6efa85670d, "system/odh.cpp: linked True".
Gate (`gate.py src/system/odh --quick`): GATE PASS, 28/28 instruction-exact, linked code 14684,
0 regressions, 0 forbidden patterns, 0 readability warnings. Global matched code 98.14728 -> 98.20765.

View File

@@ -0,0 +1,53 @@
# opus-sdmem attempts: SDMemory::drawTransferTitles
Unit `src/scene/sdChannelMemory/iplSDMemory`, branch `agent/w1009/o-sdmem` from `72e9c8d6`.
Start: 363/451 differing, 447/451 instructions, 97.4102%. combosweep: no setting beats 363.
## Header loops: MSL's C++ `wcsstr` overload
The target's two guarded loops (`cmpwi; beq` / `addic.; ble`, then a preheader with
`li rX, "\n"@sda21`, then `b test`) come from MWCC's `IRO_PullOutInvariantAssignments`
(string `IRO_CopyLoopTestToLoopPreheaderAndBranchToSuccNode` in mwcceppc.exe). The pass
needs a loop-invariant *assignment* inside the loop. A plain `wcsstr(p, L"\n")` has none,
so no loop form, pragma, IRO level or `-O4,p` reproduces it in isolated tests.
Real MSL (`MSL_C/wstring.h`, see RushRE/SonicRushAdventure-Decomp tools/cw/include) declares,
for non-embedded C++, `const wchar_t* wcsstr(const wchar_t*, const wchar_t*)` plus
`inline wchar_t* wcsstr(wchar_t* s1, const wchar_t* s2)` calling the const one. Calling it
with a `wchar_t*` inlines the wrapper; its parameter assignment `s2 = L"\n"` is the
invariant assignment the IRO pass pulls into a guarded preheader. Isolated test reproduces
the target sequence instruction for instruction.
`message::Message::getMessage` already returns `wchar_t*`; the `Manager`/`System` wrappers
now return `wchar_t*` too, so message pointers in this function are non-const and use the
overload. The scoped `ppc_iro_level 1` is removed (it suppresses the pass) and the newline
counter is a plain `while` loop.
Result: 88/451 differing, 451/451 instructions, 99.28603%.
Side effect: `LetterWriter::makeHeaderCaption` passed a call result straight to `wcsstr`;
with the overload the literal is evaluated before the virtual call (100 -> 94%). A named
`caption` local restores the target order (three spellings tested, all exact). Full report
otherwise unchanged vs `72e9c8d6`, DOL SHA1 unchanged.
## Title colors: real NW4R `TextBox::SetTextColor(ut::Color top, ut::Color bottom)`
The two helpers after drawTransferTitles were invented names (`iplSDMemory_813EF6C4/6D8`
before #254). Their bodies and placement fit weak header inlines that this large function
did not inline: `nw4r::ut::Color::Color(int, int, int, int)` (four `stb`) and NW4R's
`TextBox::SetTextColor(ut::Color top, ut::Color bottom)` (by-value colors, two calls to the
weak `Color::operator=`; same inline in hotlandsoftware/wii-news-channel, declared in Petari).
By-value arguments explain the retail stack: the named color sits with the other named
locals, the two argument copies are temporaries in source order, the snapshot comes last.
`textBox.h` now has that overload instead of the `IPL_SDMEMORY_SET_TEXT_COLORS` hack, the
source is `nw4r::ut::Color color(...); titleText->SetTextColor(color, color);`, and
symbols.txt names the two functions `__ct__Q34nw4r2ut5ColorFiiii` and
`SetTextColor__Q34nw4r3lyt7TextBoxFQ34nw4r2ut5ColorQ34nw4r2ut5Color` (both 100%).
The N_Body alpha loop is written in place like the header/footer loops: through the
`setChildrenAlpha` inline its iterator temporaries were allocated after the footer's
(inline expansion runs after parsing), retail has them in source order.
`titleOffset -= visibleRows * rowHeight` fixes the `fmuls` operand order.
Result: 50/451 differing, register-blind identical apart from the renamed call targets,
99.39024%. Pool and .data/.sdata/.sdata2 identical; full report unchanged otherwise; DOL OK.

View File

@@ -0,0 +1,93 @@
## drawTransferTitles (w1011/fossils) — three-Color-copy structure fully decoded
Orig emits THREE nw4r::ut::Color copies per setTitleRowColors call site, not two:
active branch: read GXColor@0x3c once (lbz x4 into r8/r7/r6/r0), byte-memberwise
stb x4 to THREE dests: 0xc (DEAD - never read again), 0x24 (arg1), 0x20 (arg2).
inactive branch: source 0x38 -> dests 0x8 (dead), 0x1c (arg1), 0x18 (arg2).
So orig keeps one dead Color copy per call; MWCC always eliminates ours.
Byte-memberwise copies = implicit Color copy ctor (u8 fields), source read
through reinterpret_cast<const Color*> (opaque alias -> lbz not lwz).
Forms tried to keep the third copy alive - ALL eliminated or word-folded:
- named `Color active0 = *re` (leaf-start form): dead-eliminated -> 2 copies.
- `Color(active0)` temps: active0 stored (copy source) but temps word-fold
(lwz+stw) -> wrong shape AND fewer byte ops.
- `setTitleRowColors(tb, active0, active0)` by-value params: callee ABI adds
caller-side copies but they word-fold (Color is 4B -> memcpy fold).
- `const Color& r = Color(*re)` ref-bound temp: still eliminated.
- `const` decl: no effect.
Unresolved: what makes orig's third copy non-eliminable. Suspects: a ctor
form MWCC treats as non-trivial-init, an address escape we haven't tried, or
the copy being emitted through a different expression class entirely.
## create (w1011) — reconfirmed 1064v1064 pure tie
3-web callee-pin rotation (litbase->r31, singleton-base->r26, obj->r30 vs
r30/r31/r26) - allocator-internal, matches prior documentation.
## iplMemoryCardManager _create_icon (w1011) — remat-vs-pin reconfirmed
100v100, 37 diffs, all association/coloring: m19-24 address reassociation
(`add r0,r31,r3; add r29,r30,r0; add r3,r29,r28` vs orig
`add r0,r3,r29; add r31,r0,r30; add r3,r31,r28`) and callee-web pin rotation
r29/r30/r31 + r24-r28. Rematerialization order of the *0x1fc0 / *6 / *0x15c
products is allocator-internal - no source lever found in prior or this wave.
## drawTransferTitles (w1011b) — ppc_iro_level 0 + discarded temp => 451/451
`#pragma push` + `#pragma ppc_iro_level 0` around drawTransferTitles, with a
bare discarded statement `nw4r::ut::Color(*reinterpret_cast<const Color*>(&gx));`
before each setTitleRowColors call => insn-equal 451/451 (was 438/451).
Mechanism: the discarded prvalue's construction is side-effectful enough to
survive at IRO-0 (dies at default IRO — verified: removing pragma => 438/451).
This IS the mechanism that kept orig's third copy: a discarded temp.
Remaining 90 diffs = packing/coloring: frame 0x150 vs 0x140 (+0x10), my
dead temps at 0x1c/0x10 vs orig 0xc/0x8 (orig's claim the two LOWEST slots —
probably created earliest in the fn, not branch-local), arg addrs via mr from
pinned regs vs orig's fresh `addi r4,r1,0x1c` (orig's temp addrs remat per-use),
and reg-home permutation r17-r28 <-> r22-r31. Fn-top decls fix the frame to
0x140 but turn copies into `bl` ctor calls (assignment not copy-init). Union
overlay: rejected (Color non-trivial; GXColor union assign folds to lwz+stw).
## _create_icon (w1011b) — pragma REJECTED
ppc_iro_level 0 AND 1 both worsen 100v100 -> 124v100 (remat is desirable here —
orig compiled at a level where remat happens). Committed form stands; the
association+pin diff is allocator-internal, not an IRO artifact.
## Wave w1011c — scheduling/opt-level pragmas + slot-pool analysis (no movement)
All pragma levers on drawTransferTitles (451/451 insn-equal baseline, 90 diff ops):
- `scheduling 604` → 96d (worse); `scheduling 750`/`7400`/`schedule_twice on` → 90d (inert)
- `optimization_level 0` → 699 insns (disaster); `level 2` → 447 (kills copies); `level 4` → 90d
- TU `-ipa function`/`-ipa off` → 439 insns (LOSES dead copies — ipa phase also eats the discarded-temp construction)
- TU `-O4,p` → 430 insns (peephole kills copies even at IRO-0); `-O4` → same
- shared fn-scope GXColor → 88d (slightly fewer, same walls)
Named dead objects (`Color deadActive = *re` fn-top, in-branch assign): emits `bl` operator= calls
NOT inlined at IRO-0 → +1 insn (452v451). Copy-assign does not inline; only the discarded-prvalue
construction inlines.
Slot-pool decode: orig's dead temps at 0x8/0xc live in a shared low pool also used by other objects
(o393 `stw r3,0x10`, o395 `addi r4,r1,0x10` — sret/arg objects overlay). Mine allocates its pool
starting at 0x10. The dead temps' lifetimes end before the call in both; orig overlays them onto
the lowest pool slots, mine doesn't — pure allocator slot-assignment, no source lever found.
Other residual diffs (unchanged): `mr rN,rM` arg-copy pins vs orig `addi rN,r1,slot` remat,
whole-fn reg permutation (prologue saves), frame 0x150 v 0x140.
## w1011d — structural decode wave (fn-local-static dispatch → decoded to control-form + temp-pool)
Dispatch hinted fn-local statics (BS2Update #1299). Assessed all 3 fossils: statics emit stw/.bss insns — wrong direction for fn needing insn-equal or zero-insn arms. Instead structural decode on dTT landed insn-equal:
**drawTransferTitles 447v451/38d → 451v451/36d** (upstream's GXColor-copy form + decode):
- Newline-counting loop: orig uses redundant `if (newline != NULL) { while (newline != NULL) {...} }` — `beq` guard + `b`-to-test while-entry. Plain `if+do{}while` emits body-first (no `b`); `while` alone loses the guard.
- Needle arg: TWO separate webs — `li r4,0` for first wcsstr (literal), hoisted callee-reg `mr r4,r21` for loop calls → sep declared INSIDE the if-block, first call uses literal/different-named var.
- lineIndex loop: `totalLines = lineCount + 1` + `if (totalLines > 0) { while (lineIndex < totalLines) {...++lineIndex;} }` → MWCC fuses the +1 into `addic.` + `ble` zero-trip + `b`-to-cond. `for(;i<N;i++)` or `if(i<N)` guard gives `addi`/`cmpw`-`bge` (no fusion).
- `fmuls` operand order fixed by `static_cast<f32>(visibleRows) * rowHeight` (was `rowHeight * ...`).
**Remaining 36d (allocator-internal)**: frame slot assignment — orig packs the 3 per-branch GXColor copies into the LOWEST pool (dead@8/0xc, args@0x18-0x24) interleaved with iterator objects; ours groups them higher (0x20-0x3c). Also r30↔r31 rodata-base swap, callee-web renames. Arms failed on slots: decl-order perms, fn-top decls (regresses to word-copies), nw4r::ut::Color-typed copies (+4 insns), discarded `Color(*re)` temp (+4, wrong pool class).
_create_icon 100v100/20d: callee-web rotation + remat-vs-pin (orig recomputes `base+off` for the call arg AND pins it — CSE prevention needs two syntactically-different exprs, none found).
## w1011e — post-#1305 residual analysis (upstream's form)
dTT now upstream's version: 451v451/38d, fuzzy 99.39. All 38 diffs = wholesale
callee-reg rotation (orig r30=rodata-base, r31=byte-flag lbz 0xcd, r22/23=line counter;
mine r31/rodata, r29/flag, r19/counter) — the "+1 callee web" family again: orig pins
one more callee web (a member byte live across calls). Decl-order swaps tried:
lineIndex/totalLines, titleIndex/nandTitleIndex, footerPane/titleText,
lineCount/messageForCount -> 38/44/38/38. Allocator-internal wall confirmed.

View File

@@ -0,0 +1,144 @@
# sol-m12 CHANSVm big functions, MAX
Worktree data-d2, branch agent/w1009/chansvm-big, initial HEAD bbd98e1e. Requested full Ninja build passed before edits, required DOL SHA1 verified by the build. Source initially clean. Read sol-common, brief-v2, all levers, AGENTS.md, unslop, writing-for-agents, graphify query instructions, 11b01025:sol-m8, 50eb9be2:sol-c1, ef500621:sol-y4, archived and repository histories, and every CHANSVm effort-policy entry. History inventory and prior trial labels are /tmp/sol-m12-history.json and /tmp/sol-m12-prior-rows.json. Graph query resolved its ambiguous name to src/channelScript/CHANSVm.c::VmBlobPackCommon.
## Excluded repetitions
- No unchanged-graph declaration permutations. Prior 218-node Pack models prove the array/counter swap needs a changed interference graph.
- No whole Pack measure/write wrappers, complete packing helper, element-size/format-specific writers, typed argument-selection wrappers, named remaining-count/format-length/blob-length getters, sequential generic argument reuse, or shared pass counters/format positions already tried.
- No Step scratch carrier, out-parameters hoisting locals, dead locals, duplicated control flags, redundant conditions, raw offset casts, table-identity getters, previously tested late-table getters, readonly-view cleanup helpers, named immediate getters, instruction-union variants, or countdown normalization variants.
- No compiler-version/unit-flag sweep or standalone scoped-setting repeat. No small-function work outside Pack and Step.
## Acceptance and method
Replay the saved Pack-only best, remove any unused local, and check equivalent behavior and all existing exact functions before retaining it. The task explicitly authorizes committing clean improvements below exactness; record them as partial results. Align opcode plus resolved-relocation streams with difflib, locate count differences first, then scheduling and allocation. For Step, map the switch table and inspect the least-different cases first. Preserve the pool, all data sections and existing exact functions. Run the requested final quick gate once. Keep all source experiments in this worktree and temporary files under /tmp/sol-m12-. No push, PR, merge, rebase, subagent or Matching flip without a fully exact unit.
## Measurements
- {"label": "pack-clean-replay", "counts": {"VmBlobPackCommon": {"diff": 151, "insns": [666, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "c18451afb381"} Removed unused hexadecimal length local and pure getter from historical best. All separated locals carry genuine pass-specific values.
- {"label": "pack-clean-unused-result-call", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "705ffdaec24d"} Target instruction 604 prepares writeHexStrObj and 605 calls VmGetIntFromObjHdr. Return is unused in the remaining hex block. Preserve that original call without a dead local.
Pack clean replay is 47/668 versus 230/668 at HEAD. All 47 aligned differences are the r18/r23 array-counter exchange. Target hex block explicitly calls VmGetIntFromObjHdr and discards its result, so the required source call is retained without declaring a dead local. The rest of the function keeps identical call order, branches, instruction count, all allocated data, and every other function. Unit report after replay: {"fuzzy_match_percent": 99.66164, "total_code": "53564", "matched_code": "44588", "matched_code_percent": 83.24248, "total_data": "6904", "matched_data": "6904", "matched_data_percent": 100.0, "total_functions": 233, "matched_functions": 227, "matched_functions_percent": 97.4249, "total_units": 1}. Task authorizes this partial checkpoint. No exact match claimed.
- {"label": "pack-integer-store-words", "counts": {"VmBlobPackCommon": {"diff": 325, "insns": [677, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "34b5f067b570"} Actual integer serialization or byte-swap helper writes the real packing buffer; no scratch carrier or hoisted local out-parameter.
- {"label": "pack-integer-store-integer", "counts": {"VmBlobPackCommon": {"diff": 325, "insns": [677, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "c75536b1e87b"} Actual integer serialization or byte-swap helper writes the real packing buffer; no scratch carrier or hoisted local out-parameter.
- {"label": "pack-integer-store-integer-case-scope", "build": "FAIL"} Same new serialization boundary, with integer-loop values declared in their owning case.
- {"label": "pack-integer-store-object", "counts": {"VmBlobPackCommon": {"diff": 321, "insns": [677, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "b0afd352444d"} Actual integer serialization or byte-swap helper writes the real packing buffer; no scratch carrier or hoisted local out-parameter.
- {"label": "pack-integer-store-object-case-scope", "build": "FAIL"} Same new serialization boundary, with integer-loop values declared in their owning case.
- {"label": "pack-integer-swap-words", "counts": {"VmBlobPackCommon": {"diff": 56, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "434ff2985dbf"} Actual integer serialization or byte-swap helper writes the real packing buffer; no scratch carrier or hoisted local out-parameter.
- {"label": "pack-integer-encode-words", "counts": {"VmBlobPackCommon": {"diff": 333, "insns": [675, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "46cb1062b4df"} Actual integer serialization or byte-swap helper writes the real packing buffer; no scratch carrier or hoisted local out-parameter.
- {"label": "pack-integer-encode-integer", "counts": {"VmBlobPackCommon": {"diff": 333, "insns": [675, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "37020ec61736"} Actual integer serialization or byte-swap helper writes the real packing buffer; no scratch carrier or hoisted local out-parameter.
- {"label": "pack-integer-encode-integer-case-scope", "counts": {"VmBlobPackCommon": {"diff": 334, "insns": [675, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "1e8a9605e258"} Same new serialization boundary, with integer-loop values declared in their owning case.
- {"label": "pack-integer-encode-object", "counts": {"VmBlobPackCommon": {"diff": 329, "insns": [675, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "389b97208b09"} Actual integer serialization or byte-swap helper writes the real packing buffer; no scratch carrier or hoisted local out-parameter.
- {"label": "pack-integer-encode-object-case-scope", "counts": {"VmBlobPackCommon": {"diff": 330, "insns": [675, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "73d7c8ffa5e6"} Same new serialization boundary, with integer-loop values declared in their owning case.
- {"label": "pack-restore-after-integer-helpers", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "705ffdaec24d"} Restore the best reviewed packing shape after serialized helper trials.
- {"label": "step-case-float-local", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 266, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "5a5c1246d7a2"} Move only this case actual operand/index/literal into its owning scope, following the least-different case ordering. Independent objects, unchanged calls and operand sizes.
- {"label": "step-case-string-index-local", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "19ecec628150"} Move only this case actual operand/index/literal into its owning scope, following the least-different case ordering. Independent objects, unchanged calls and operand sizes.
- {"label": "step-case-new-array-index-local", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "c16b93768a1c"} Move only this case actual operand/index/literal into its owning scope, following the least-different case ordering. Independent objects, unchanged calls and operand sizes.
- {"label": "step-case-call-operand-local", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "52188babcf52"} Move only this case actual operand/index/literal into its owning scope, following the least-different case ordering. Independent objects, unchanged calls and operand sizes.
- {"label": "step-single-function-scope-opSize", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "0bcda653f75c"} One real cross-case interpreter local lives at function scope. Carrier-free baseline; this is not a declaration permutation of the previous carrier graph.
- {"label": "step-single-function-scope-operandBuf", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "70349864ce40"} One real cross-case interpreter local lives at function scope. Carrier-free baseline; this is not a declaration permutation of the previous carrier graph.
- {"label": "step-single-function-scope-copyResult", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "e302683194b4"} One real cross-case interpreter local lives at function scope. Carrier-free baseline; this is not a declaration permutation of the previous carrier graph.
- {"label": "step-single-function-scope-foundObj", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "c0c7872f13d2"} One real cross-case interpreter local lives at function scope. Carrier-free baseline; this is not a declaration permutation of the previous carrier graph.
- {"label": "step-single-function-scope-result", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "621e11cb0158"} One real cross-case interpreter local lives at function scope. Carrier-free baseline; this is not a declaration permutation of the previous carrier graph.
- {"label": "step-single-function-scope-newPos", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "72977265684a"} One real cross-case interpreter local lives at function scope. Carrier-free baseline; this is not a declaration permutation of the previous carrier graph.
- {"label": "step-case-helper-VmLoadIndirect", "build": "FAIL"} Real opcode operation helper preserves its complete copy/delete/store or boolean operation and error propagation. Buffer parameter is the actual operation storage, not an allocator carrier.
- {"label": "step-case-helper-VmDeleteIndirect", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "a78209fb7d99"} Real opcode operation helper preserves its complete copy/delete/store or boolean operation and error propagation. Buffer parameter is the actual operation storage, not an allocator carrier.
- {"label": "step-case-helper-VmLogicalNot", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "78a1e07de24a"} Real opcode operation helper preserves its complete copy/delete/store or boolean operation and error propagation. Buffer parameter is the actual operation storage, not an allocator carrier.
- {"label": "step-internal-readonly-VmResultTypeTbl", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "d7acb65b18d2"} Diagnostic internal linkage on real TU-private readonly globals. Target shares the rodata base; retain only if every symbol user and relocation remain valid.
- {"label": "step-internal-readonly-CHANSVmConstStringObjectUndefined_", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "29f94ee37b0f"} Diagnostic internal linkage on real TU-private readonly globals. Target shares the rodata base; retain only if every symbol user and relocation remain valid.
- {"label": "step-internal-readonly-both", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "9ffa6e38abd1"} Diagnostic internal linkage on real TU-private readonly globals. Target shares the rodata base; retain only if every symbol user and relocation remain valid.
- {"label": "step-restore-after-case-trials", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "705ffdaec24d"} Restore best reviewed source after opcode and scope trials.
- {"label": "pack-real-serialization-buffer-signed-words", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "953ba41006c9"} Actual eight-byte serialization buffer has its natural byte, signed-word or integer representation; typed accesses preserve exactly the stored byte ranges and order.
- {"label": "pack-real-serialization-buffer-bytes", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "68bdeb48da60"} Actual eight-byte serialization buffer has its natural byte, signed-word or integer representation; typed accesses preserve exactly the stored byte ranges and order.
- {"label": "pack-real-serialization-buffer-integer", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "c817b37a562e"} Actual eight-byte serialization buffer has its natural byte, signed-word or integer representation; typed accesses preserve exactly the stored byte ranges and order.
- {"label": "pack-hex-real-phase-indexed-vmBoolInt", "counts": {"VmBlobPackCommon": {"diff": 125, "insns": [669, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "8037667d9caf"} Named consumed high/low nibble phase and a real index, remaining-count or input cursor. Ghidra shows alternating phase and two-byte source traversal; no artificial lifetime or extra VM call.
- {"label": "pack-hex-real-phase-indexed-vmBool", "counts": {"VmBlobPackCommon": {"diff": 125, "insns": [669, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "d10098e4f2c2"} Named consumed high/low nibble phase and a real index, remaining-count or input cursor. Ghidra shows alternating phase and two-byte source traversal; no artificial lifetime or extra VM call.
- {"label": "pack-hex-real-phase-remaining-vmBoolInt", "counts": {"VmBlobPackCommon": {"diff": 235, "insns": [669, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "51a8b18b0da5"} Named consumed high/low nibble phase and a real index, remaining-count or input cursor. Ghidra shows alternating phase and two-byte source traversal; no artificial lifetime or extra VM call.
- {"label": "pack-hex-real-phase-remaining-vmBool", "counts": {"VmBlobPackCommon": {"diff": 235, "insns": [669, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "25983a62b93c"} Named consumed high/low nibble phase and a real index, remaining-count or input cursor. Ghidra shows alternating phase and two-byte source traversal; no artificial lifetime or extra VM call.
- {"label": "pack-hex-real-phase-pointer-end-vmBoolInt", "counts": {"VmBlobPackCommon": {"diff": 255, "insns": [673, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "73d1cf266113"} Named consumed high/low nibble phase and a real index, remaining-count or input cursor. Ghidra shows alternating phase and two-byte source traversal; no artificial lifetime or extra VM call.
- {"label": "pack-hex-real-phase-pointer-end-vmBool", "counts": {"VmBlobPackCommon": {"diff": 255, "insns": [673, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "d1915f38ce30"} Named consumed high/low nibble phase and a real index, remaining-count or input cursor. Ghidra shows alternating phase and two-byte source traversal; no artificial lifetime or extra VM call.
- {"label": "pack-restore-after-buffer-and-phase", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "705ffdaec24d"} Restore best reviewed source after actual buffer and nibble traversal shapes.
- {"label": "step-property-found-init-before-lookup", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 1105, "insns": [1249, 1253]}}, "drops": [], "others": [], "data_changes": [".rela.data"], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "554f8359dc13"} Initialize the real found flag on entry and remove unused arrayIdx assignments and the redundant non-array flag store. Same success, failure and branch conditions.
- {"label": "step-property-found-init-after-lookup", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 1105, "insns": [1249, 1253]}}, "drops": [], "others": [], "data_changes": [".rela.data"], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "1f0ce1b9b7c3"} Initialize the real found flag on entry and remove unused arrayIdx assignments and the redundant non-array flag store. Same success, failure and branch conditions.
- {"label": "step-property-found-init-guard", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 649, "insns": [1250, 1253]}}, "drops": [], "others": [], "data_changes": [".rela.data"], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "48ba164a012a"} Initialize the real found flag on entry and remove unused arrayIdx assignments and the redundant non-array flag store. Same success, failure and branch conditions.
- {"label": "step-property-operation-output-last", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 640, "insns": [1249, 1253]}}, "drops": [], "others": [], "data_changes": [".rela.data"], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "49695948b8e6"} Real property lookup operation returns CHANSVmErr and an actual found result, like CHANSVmGetBoolean. The output controls the bytecode branch and does not hoist helper temporaries.
- {"label": "step-property-operation-output-last-format-scope", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 640, "insns": [1249, 1253]}}, "drops": [], "others": [], "data_changes": [".rela.data"], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "b23ec141e9bc"} Same property operation, with formatting temporaries in their actual owning scope. Original 64-bit snprintf argument is preserved.
- {"label": "step-property-operation-output-first", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 640, "insns": [1249, 1253]}}, "drops": [], "others": [], "data_changes": [".rela.data"], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "0d4424248f8e"} Real property lookup operation returns CHANSVmErr and an actual found result, like CHANSVmGetBoolean. The output controls the bytecode branch and does not hoist helper temporaries.
- {"label": "step-property-operation-output-first-format-scope", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 640, "insns": [1249, 1253]}}, "drops": [], "others": [], "data_changes": [".rela.data"], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "b94e4670e35e"} Same property operation, with formatting temporaries in their actual owning scope. Original 64-bit snprintf argument is preserved.
- {"label": "step-operation-helper-VmLoadStringConstant", "build": "FAIL"} Complete actual opcode operation behind a normal helper. Operand buffers are genuine input and storage used for VM object operations; no scratch carrier or artificial dependency.
- {"label": "step-operation-helper-VmCreateArrayOpcode", "build": "FAIL"} Complete actual opcode operation behind a normal helper. Operand buffers are genuine input and storage used for VM object operations; no scratch carrier or artificial dependency.
- {"label": "step-operation-helper-VmStoreIndirect", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "1eb11d802892"} Complete actual opcode operation behind a normal helper. Operand buffers are genuine input and storage used for VM object operations; no scratch carrier or artificial dependency.
- {"label": "step-operation-helper-VmLoadIndirect", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "bd99a82f2c25"} Complete actual opcode operation behind a normal helper. Operand buffers are genuine input and storage used for VM object operations; no scratch carrier or artificial dependency.
- {"label": "step-restore-after-property-operation", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "705ffdaec24d"} Restore best source after new property and object-operation boundaries.
- {"label": "pack-consume-argument-advance-call-Blob", "counts": {"VmBlobPackCommon": {"diff": 450, "insns": [670, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "b559537f4f93"} A real next-argument expression advances the cursor at its lookup. Argument indexes and call order stay unchanged, and no counter address escapes. Nested conversion keeps the same two calls.
- {"label": "pack-consume-argument-advance-call-Integer", "counts": {"VmBlobPackCommon": {"diff": 354, "insns": [670, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "f660f73ecb6a"} A real next-argument expression advances the cursor at its lookup. Argument indexes and call order stay unchanged, and no counter address escapes. Nested conversion keeps the same two calls.
- {"label": "pack-consume-argument-advance-call-String", "counts": {"VmBlobPackCommon": {"diff": 253, "insns": [670, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "08ba492b44e7"} A real next-argument expression advances the cursor at its lookup. Argument indexes and call order stay unchanged, and no counter address escapes. Nested conversion keeps the same two calls.
- {"label": "pack-consume-argument-advance-call-Hex", "counts": {"VmBlobPackCommon": {"diff": 187, "insns": [670, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "390460abe825"} A real next-argument expression advances the cursor at its lookup. Argument indexes and call order stay unchanged, and no counter address escapes. Nested conversion keeps the same two calls.
- {"label": "pack-consume-argument-advance-call-Integer-String", "counts": {"VmBlobPackCommon": {"diff": 350, "insns": [672, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "ca6636c2679e"} A real next-argument expression advances the cursor at its lookup. Argument indexes and call order stay unchanged, and no counter address escapes. Nested conversion keeps the same two calls.
- {"label": "pack-consume-argument-advance-call-String-Hex", "counts": {"VmBlobPackCommon": {"diff": 253, "insns": [672, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "83e444dc541f"} A real next-argument expression advances the cursor at its lookup. Argument indexes and call order stay unchanged, and no counter address escapes. Nested conversion keeps the same two calls.
- {"label": "pack-consume-argument-advance-call-Blob-Integer-String-Hex", "counts": {"VmBlobPackCommon": {"diff": 450, "insns": [676, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "365e81430a1d"} A real next-argument expression advances the cursor at its lookup. Argument indexes and call order stay unchanged, and no counter address escapes. Nested conversion keeps the same two calls.
- {"label": "pack-consume-argument-nested-conversion-Blob", "counts": {"VmBlobPackCommon": {"diff": 450, "insns": [670, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "b559537f4f93"} A real next-argument expression advances the cursor at its lookup. Argument indexes and call order stay unchanged, and no counter address escapes. Nested conversion keeps the same two calls.
- {"label": "pack-consume-argument-nested-conversion-Integer", "counts": {"VmBlobPackCommon": {"diff": 354, "insns": [670, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "75618b2bc41c"} A real next-argument expression advances the cursor at its lookup. Argument indexes and call order stay unchanged, and no counter address escapes. Nested conversion keeps the same two calls.
- {"label": "pack-consume-argument-nested-conversion-String", "counts": {"VmBlobPackCommon": {"diff": 251, "insns": [669, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "49deaae31879"} A real next-argument expression advances the cursor at its lookup. Argument indexes and call order stay unchanged, and no counter address escapes. Nested conversion keeps the same two calls.
- {"label": "pack-consume-argument-nested-conversion-Hex", "counts": {"VmBlobPackCommon": {"diff": 250, "insns": [669, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "04cbe5619579"} A real next-argument expression advances the cursor at its lookup. Argument indexes and call order stay unchanged, and no counter address escapes. Nested conversion keeps the same two calls.
- {"label": "pack-consume-argument-nested-conversion-Integer-String", "counts": {"VmBlobPackCommon": {"diff": 350, "insns": [671, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "67e5b3e35451"} A real next-argument expression advances the cursor at its lookup. Argument indexes and call order stay unchanged, and no counter address escapes. Nested conversion keeps the same two calls.
- {"label": "pack-consume-argument-nested-conversion-String-Hex", "counts": {"VmBlobPackCommon": {"diff": 303, "insns": [670, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "f4f5cef096fa"} A real next-argument expression advances the cursor at its lookup. Argument indexes and call order stay unchanged, and no counter address escapes. Nested conversion keeps the same two calls.
- {"label": "pack-consume-argument-nested-conversion-Blob-Integer-String-Hex", "counts": {"VmBlobPackCommon": {"diff": 463, "insns": [674, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "3cce13c8aeff"} A real next-argument expression advances the cursor at its lookup. Argument indexes and call order stay unchanged, and no counter address escapes. Nested conversion keeps the same two calls.
- {"label": "pack-measure-count-after-size-Integer", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "c92bdc893fbe"} Accumulate the format element byte size before advancing its argument cursor. These local updates commute and retain all overflow/conversion rules.
- {"label": "pack-measure-count-after-size-String", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "0055b2fe1791"} Accumulate the format element byte size before advancing its argument cursor. These local updates commute and retain all overflow/conversion rules.
- {"label": "pack-measure-count-after-size-Hex", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "a7e4638108c1"} Accumulate the format element byte size before advancing its argument cursor. These local updates commute and retain all overflow/conversion rules.
- {"label": "pack-measure-count-after-size-all", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "30d118739d6f"} Accumulate the format element byte size before advancing its argument cursor. These local updates commute and retain all overflow/conversion rules.
- {"label": "pack-restore-after-argument-shapes", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "705ffdaec24d"} Restore best source after actual cursor lifetime changes.
## Fresh backend evidence
Pack capture /tmp/sol-m12-pack-capture has executable bytes, resolved text relocations and every allocated data section identical to the ordinary Ninja object. Simulator reproduces 218/218, and the manually checked array/counter want-list reaches only 2/3. All 47 baseline differences are the r18/r23 exchange. Step capture /tmp/sol-m12-step-capture likewise equals normal compilation in all allocated sections and resolved relocations and reproduces 491/491. The 10-name diagnostic reaches 8/10, but the stock search can reorder compiler @ aliases and parameters, so it is not a writable source order and no proposed ordering is applied. Maps are /tmp/sol-m12-pack-vmap.txt and /tmp/sol-m12-step-vmap.txt.
Opcode/relocation alignment includes HA/LO relocations stored at instruction offset +2. It identifies Step target shared rodata base 0, source separate bases 352 and 96; early count normalization and pretest branch; stack object locations; enum indexing; property flag/output stack stores; and later branch cleanup. The source jump tables currently match all 121 relocation destinations. Case priority is /tmp/sol-m12-step-case-priority.json. POP, IS_CLASS, DELETE_INDIRECT, LOG_NOT and BIT_NOT bodies already match; the first positive-difference cases differ by the shared instruction-size register. Property lookup has 92 differing positions in its 134-instruction block. Internal linkage on the real readonly globals changes no instructions. No fake common-base aggregate or cross-object pointer arithmetic is introduced.
- {"label": "step-operation-helper-VmLoadStringConstant-fixed", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "6282fff9aa19"} Corrected helper generator retains original case declarations. Same opcode operation boundary and original call order, without hoisted local outputs.
- {"label": "step-operation-helper-VmLoadStringConstant-decoded-input", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 695, "insns": [1252, 1253]}}, "drops": [], "others": [], "data_changes": [".rela.data"], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "550e55657ba8"} Actual decoded string index or array extent is the operation input; keep decoding at the caller and object creation inside the helper.
- {"label": "step-operation-helper-VmCreateArrayOpcode-fixed", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "f3e3f9a42c40"} Corrected helper generator retains original case declarations. Same opcode operation boundary and original call order, without hoisted local outputs.
- {"label": "step-operation-helper-VmCreateArrayOpcode-decoded-input", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "6b1fff6c9d84"} Actual decoded string index or array extent is the operation input; keep decoding at the caller and object creation inside the helper.
- {"label": "step-property-output-last-pretest", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 1227, "insns": [1251, 1253]}}, "drops": [], "others": [], "data_changes": [".rela.data"], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "7d34bf2d9d62"} Combine new real property operation with assembly-proven pretest countdown or indexed operand-type output. Old standalone controls are not counted as new ideas.
- {"label": "step-property-output-last-indexed-types", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 1099, "insns": [1250, 1253]}}, "drops": [], "others": [], "data_changes": [".rela.data"], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "2cb470409b7e"} Combine new real property operation with assembly-proven pretest countdown or indexed operand-type output. Old standalone controls are not counted as new ideas.
- {"label": "step-property-output-last-pretest-indexed-types", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 1222, "insns": [1252, 1253]}}, "drops": [], "others": [], "data_changes": [".rela.data"], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "59a1cb761b4e"} Combine new real property operation with assembly-proven pretest countdown or indexed operand-type output. Old standalone controls are not counted as new ideas.
- {"label": "step-property-output-first-pretest", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 1227, "insns": [1251, 1253]}}, "drops": [], "others": [], "data_changes": [".rela.data"], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "23cf3deee40e"} Combine new real property operation with assembly-proven pretest countdown or indexed operand-type output. Old standalone controls are not counted as new ideas.
- {"label": "step-property-output-first-indexed-types", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 1099, "insns": [1250, 1253]}}, "drops": [], "others": [], "data_changes": [".rela.data"], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "bff9685e9c39"} Combine new real property operation with assembly-proven pretest countdown or indexed operand-type output. Old standalone controls are not counted as new ideas.
- {"label": "step-property-output-first-pretest-indexed-types", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 1222, "insns": [1252, 1253]}}, "drops": [], "others": [], "data_changes": [".rela.data"], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "11b5acc54f47"} Combine new real property operation with assembly-proven pretest countdown or indexed operand-type output. Old standalone controls are not counted as new ideas.
- {"label": "step-case-property-object-values", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "06ad45705671"} The large opcode case owns its actual object handles or decoded operands. Separate per-case values remove cross-case source reuse without a carrier or any added operation.
- {"label": "step-case-property-operand-values", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 614, "insns": [1251, 1253]}}, "drops": [], "others": [], "data_changes": [".rela.data"], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "17f609f5347f"} The large opcode case owns its actual object handles or decoded operands. Separate per-case values remove cross-case source reuse without a carrier or any added operation.
- {"label": "step-case-index-object-values", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "d5a261278a30"} The large opcode case owns its actual object handles or decoded operands. Separate per-case values remove cross-case source reuse without a carrier or any added operation.
- {"label": "step-case-index-operand-values", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 703, "insns": [1251, 1253]}}, "drops": [], "others": [], "data_changes": [".rela.data"], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "bdd38f3134bd"} The large opcode case owns its actual object handles or decoded operands. Separate per-case values remove cross-case source reuse without a carrier or any added operation.
- {"label": "step-restore-final-best", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "705ffdaec24d"} Restore best source after combined operation and indexed-operand shapes.
- {"label": "pack-integer-store-integer-case-scope-fixed", "counts": {"VmBlobPackCommon": {"diff": 326, "insns": [677, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "0b8f526b806a"} Corrected generator identifies the outer format case with an anchored pattern. Real loop index and converted argument are owned by that case.
- {"label": "pack-integer-store-object-case-scope-fixed", "counts": {"VmBlobPackCommon": {"diff": 322, "insns": [677, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "4278fbf87ee4"} Corrected generator identifies the outer format case with an anchored pattern. Real loop index and converted argument are owned by that case.
- {"label": "step-case-property-real-operands", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 614, "insns": [1251, 1253]}}, "drops": [], "others": [], "data_changes": [".rela.data"], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "9bdcba724a96"} Remove the generated unused per-case array-index local. Keep only real operand buffer and decoded index values; reject if target count or table offsets differ.
- {"label": "final-retained-checkpoint", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "705ffdaec24d"} Retain only the committed clean Pack replay; all new non-exact experiments are rejected.
- {"label": "pack-typed-buffer-index", "counts": {"VmBlobPackCommon": {"diff": 47, "insns": [668, 668]}, "CHANSVmStep": {"diff": 262, "insns": [1253, 1253]}}, "drops": [], "others": [], "data_changes": [], "pool": "POOL IDENTICAL up to 125 (mine=125 base=125)", "sha": "a0f7d087c354"} The source scan flags cast-plus-offset spelling in the replay. Use actual typed array indexing for the known eight-byte serialization buffer; store width and order remain identical. The measurement completed successfully; an unquoted separator in its trailing shell note then attempted an unrelated command and returned 127. The later independent final checks below pass.
## Final result and handoff
The log contains 92 measurement rows: 87 successful compilations/checkpoints and five generator failures. After the cleaned replay, there are 38 compiled Pack variants (37 distinct source hashes) and 39 Step variants. These are measured variations, not 77 independent ideas: parameter orders, unchanged-code controls and the composed pretest/indexing controls are labeled above. The failed generators were corrected. The generated property-operand trial with an unused array-index local was rejected and corrected to use only real operands. Every follow-up source experiment was restored.
Retain the inherited Pack replay from sol-c1, with the unused hexadecimal length local removed and the signed word store written as typed array indexing. The target's explicit unused-result getter call remains. Pack improves from 230 to 47 differences, 668/668 instructions, fuzzy 98.0988 to 99.588326. There is no new exact function. The remaining 47 differences exchange the argument-array and argument-counter registers r18/r23; their opcode and resolved-relocation streams align without insertions or deletions. Fresh backend evidence reproduces the allocator, but does not supply an honest source change that fixes the exchange.
Step remains 262 differences, 1253/1253 instructions, fuzzy 97.23225. Its function text equals the initial bbd98e1e function exactly. The smallest differing opcode bodies mostly inherit the shared opSize register. Full property-operation boundaries, genuine case-owned inputs and object handles, readonly linkage, and operand-type/pretest compositions either preserve the original differences or change instruction counts and jump-table relocations. The target common readonly base, operand storage, property flag and loop control remain unresolved; none justifies a scratch carrier or fabricated object layout. All 121 data-table relocation destinations and every previously exact sibling are preserved in the retained object.
Final source SHA256: a0f7d087c354b113fcdbc456fa90f651a739af74353db4673aadac3cfc9f395c. Changed repository paths are src/channelScript/CHANSVm.c and this log. Source checkpoint ae3810af contains the clean replay; the final checkpoint also contains the typed-index spelling and this audit. The focused source diff is saved as /mnt/drive2/projects/wii-ipl-workers/_luna-runs/best/sol-m12.CHANSVm.diff.
Ran the requested final gate exactly once:
```
python3 /mnt/drive2/projects/wii-ipl-workers/_restore0928-tools/gate.py src/channelScript/CHANSVm --quick
full build: ok
main.dol sha1: 26116613f624061ba99c8d1a299aaa6efa85670d
pool: IDENTICAL
objdiff: code 44588/53564 data 6904/6904 functions 227/233 fuzzy 99.66164 linked code 0
instruction-exact functions: 227/233
all five allocated data sections: 100.0
regressions vs baseline: 0
forbidden patterns added: 0
readability warnings: 0
GATE PASS
```
The gate baseline is bbd98e1e, unit fuzzy 99.58733. Final live report was regenerated with Ninja progress and build/43U/report.json. Independent final ctxdiff reports Pack 47 and Step 262; pool_diff reports 125/125 identical; git diff --check passes. Direct executable-byte and resolved-relocation comparison against the initial object finds no changed sibling, exact-function drop or allocated-data change. Final evidence is /tmp/sol-m12-gate.txt, /tmp/sol-m12-final-VmBlobPackCommon.ctxdiff.txt, /tmp/sol-m12-final-CHANSVmStep.ctxdiff.txt and /tmp/sol-m12-final-pool.txt. This is a validated partial replay, with the unit still NonMatching and unlinked.

View File

@@ -28,3 +28,92 @@ call result, or a non-foldable form). Dead `cmplwi r4,0xa` matches the documente
dead-compare-fossil family (both-branch merge). Also: count lands in r29 via
clrlwi (u16) — count is i.
Unresolved: what source produces symbolic-index stores + dead compare.
## inputChar (w1011/fossils wave) — symbolic-index DECODED, dead-compare wall remains
Best: 135/136 (was 125/136). The winning source form:
```cpp
u32 inputIndex = 0;
input[inputIndex] = 0;
if (ch == 10) { inputIndex = 0; }
input[inputIndex] = ch;
++inputIndex;
input[inputIndex] = 0;
count = inputIndex; // u16 count: emits clrlwi r29,r6,0x10
mKanaStream.mOutput[0] = 0;
```
The `if(ch==10) inputIndex=0` creates an SSA phi on inputIndex -> MWCC keeps the
index SYMBOLIC -> reproduces orig's `slwi/sthx/addi/slwi/clrlwi/sthx` sequence
and the clrlwi count-narrow between the two sthx (u16 count, not int).
REMAINING GAP = dead `cmplwi r4,0xa`: orig emits the compare with NO consuming
branch and NO arm insns. Every arm-body variant fails both ways:
- arm with any real op (`inputIndex=0`, `mOutput[0]=0`, `count=inputIndex`,
`input[0]=0`): MWCC keeps `bne` + arm insns (mine 135 = +bne+li vs orig).
- empty arm `if(ch==10){}`, self-assign `inputIndex=inputIndex`, dead-on-arrival
`count=inputIndex` (overwritten unconditionally after), identical-arms
if/else, ternary `(ch==10)?0:inputIndex`: MWCC merges arms BEFORE emitting the
compare -> compare dies too (125).
A compare-without-branch fossil is not producible by any tested source form on
MWCC 3.0a5.2. Open question: whether orig's compare came from a non-if codegen
path (peeled loop head, && short-circuit whose second test folds, or an
MWCC-version difference).
## inputChar (w1011b) — ppc_iro_level pragma + insn-equal 136/136
`#pragma push` + `#pragma ppc_iro_level 4` around inputChar + `wchar_t* inputBuf
= input` second-pointer for the last store + `if(ch==10) inputIndex=0` phi-arm
=> insn-equal 136/136 (was 125/136). Orig's symbolic index IS a phi.
Remaining 7 diffs: orig's `if(ch==10)` emits ONLY the cmplwi (no bne, no arm
insns — a true compare fossil), orig's second-store base is `mr r4,r5` copy vs
my addi rematerialization, plus r5<->r6 zero-web color and tail clrlwi position.
Fossil-arm variants that ALL fail (arm must produce phi + zero insns): empty
arm (folds everything), inputIndex=inputIndex (phi collapses), (ch==10)?0:i /
?i:0 ternaries (diamond or full fold), input[0]=0 arm (emits sth),
input[inputIndex]=0 arm (emits sthx), opt_dead_code/opt_dead_assignments/
opt_common_subexpressions pragmas at IRO-0 (all still bne+li), iro 0-4.
Compare-without-branch remains non-producible; likely needs the arm's value to
materialize in the SAME register as the init (a CSE level mine never reaches).
## Wave w1011c — scheduling pragmas on inputChar (no movement)
On the 136/136 insn-equal form (IRO-4 + inputBuf + phi arm, 7 diff ops):
- `scheduling 604` → 18d (worse); `scheduling 750`/`schedule_twice on` → 7d (inert)
- `optimization_level 0` → 151 insns; `level 2` → 139 insns (+3)
- TU `-ipa function`/`-ipa off` → 7d (inert)
- TU `-O4,s` or NO extra_cflags → 132 insns — the committed `extra_cflags=["-O4,p"]` is
LOAD-BEARING: removing it drops 4 insns (kills the symbolic-index sequence)
- bool-assign arm `u32 v=(ch==10); inputIndex=v-v` → cntlzw materialization (135,11d) — rejected
## Wave w1011d — structural decode pass on inputChar compare fossil (~10 more variants)
Decoded orig emission (o64-79): `cmpwi r6,3; bne; li r6,0; sth r6,0x10; cmplwi r4,0xa(dead);
slwi r0,r6,1; addi r5,r1,0x10; sthx r4; addi r6,r6,1; mr r4,r5; li r5,0; slwi; clrlwi r29;
sthx; sth 0x42; b` — index stays symbolic via a phi whose arm emits ZERO insns.
New arms tried (all fold or add insns):
- dead-store arms: `input[0]=0`, `mKanaStream.mOutput[0]=0` → 130v136 (arm folds, kills sequence)
- control forms: `if(ch==10);` empty → 125; `while(ch==10){}` → 129
- `inputIndex=inputIndex+0` → 125; `input[inputIndex]=0`/`inputBuf[0]=0` arms → 130
- `u16/s32 inputIndex` → 137(+1)/136(same); `count` as index → 137 insns, 5 diff ops but
rlwinm-masked index (u16) + bne/li arm remains
- `u32 inputIndex;` UNINIT + arm `=0` → 128v136 (whole block folds to direct stores — MWCC
collapses uninit index to 0-folded direct offsets, losing the symbolic-index sequence)
Wall (final): a phi whose arm-side definition emits zero insns — only realizable if MWCC
elides BOTH the arm's li and the guard branch; no source form does it while keeping the
index web symbolic. Compare fossil likely requires an MWCC phase-ordering quirk
(compare emitted, then its branch consumer folded by a later pass that doesn't re-dce).
## w1011e — MSL-overload/dead-arm batch on the compare fossil
inputChar committed at 136/136/7d (IRO-4 + u32 inputIndex + inputBuf + `if(ch==10) inputIndex=0`).
Orig idx-68 `cmplwi r4,0xa` is a TRUE dead compare — no branch consumer, flows straight into
the symbolic-index stores. Fossil = a folded `if` whose compare outlived its branch.
Variants (all -> 125 full-fold or live-arm real insns):
- dead-arm no-ops: `i += 0`, `i |= 0`, `i *= 1`, `i = i|0`, `i = 1; i = 0`, `count = 0`, `i = i` -> 125
- folded calls: `wmemset(input, 0, 0)` arm -> 125
- expr-form: `input[i] = (ch==10) ? ch : ch`, `if (ch==10) goto L; L:` -> 125
- always-true guard: `if (ch == 10 || inputIndex == 0)` -> 125
- count type: `u32`/`s32`/`int` count (+static_cast<u16> at uses) all collapse index to 125.
`u16 count` is LOAD-BEARING for the symbolic index; orig re-narrows per use
(`clrlwi r0,r29,0x10` at both mCursorStart adds) — its count web is wider-typed
but the u16 decl is what keeps OUR index symbolic. Unsolved contradiction.