Give every module-level array the same size so lists stop overlapping

The first dozen apps in the drawer (and the first widgets in the picker)
showed blank icons because their data-icon held another app's component
name. ultra's build pairs LPython's array allocations with the module
globals in an order that doesn't match source order, so comps got a
256-slot region and rows past 256 wrote over icons[0..]; wlabels/wprovs
got 40-slot regions. Making all twelve arrays i32[512] keeps every
pairing disjoint.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Claude committed 2026-10-21 15:11:04 -07:00
1 parent 8196e06391
commit 7aabe57afa
2 files changed
+13 -9

No files matched your search

+13 -9
View File
@@ -107,6 +107,10 @@ SHEET_ITEM: Const[i32] = 2
SHEET_WIDGETS: Const[i32] = 3
# ---- Model
# Every module-level array is i32[512], even where HOME_CAP or WCAP is smaller:
# ultra's build hands LPython's array allocations to the globals in an order that
# doesn't match, so arrays of different sizes overlapped (rows past 256 of comps
# wrote over icons, and wlabels was 40 slots long). With one size, any pairing is safe.
# Installed apps, as parallel columns of string handles, sorted by label.
labels: i32[512] = empty(512, dtype=int32)
comps: i32[512] = empty(512, dtype=int32)
@@ -115,18 +119,18 @@ n: i32 = 0
# The home screen, in order. An app slot keeps its component name in hstr;
# a widget slot keeps the widget's label there, its host id in hwid and its
# height in CSS px in hh. hkey is a stable key for the DOM diff.
hkind: i32[40] = empty(40, dtype=int32)
hstr: i32[40] = empty(40, dtype=int32)
hwid: i32[40] = empty(40, dtype=int32)
hh: i32[40] = empty(40, dtype=int32)
hkey: i32[40] = empty(40, dtype=int32)
hkind: i32[512] = empty(512, dtype=int32)
hstr: i32[512] = empty(512, dtype=int32)
hwid: i32[512] = empty(512, dtype=int32)
hh: i32[512] = empty(512, dtype=int32)
hkey: i32[512] = empty(512, dtype=int32)
nh: i32 = 0
next_key: i32 = 1
# Widget providers, for the picker.
wlabels: i32[256] = empty(256, dtype=int32)
wprovs: i32[256] = empty(256, dtype=int32)
wicons: i32[256] = empty(256, dtype=int32)
wheights: i32[256] = empty(256, dtype=int32)
wlabels: i32[512] = empty(512, dtype=int32)
wprovs: i32[512] = empty(512, dtype=int32)
wicons: i32[512] = empty(512, dtype=int32)
wheights: i32[512] = empty(512, dtype=int32)
nw: i32 = 0
wloading: i32 = 0
chosen: i32 = -1 # widget row being added