rpg_array_element.zig, rpg_eval.zig: parts of an element, arrays inside a data structure, stores at a variable index #743

Manually merged
binjovi-bot merged 6 commits from lc2c into trunk 2026-11-07 09:02:02 +00:00
Owner

rpg_array_element.zig, rpg_eval.zig: parts of an element, arrays inside a data structure, stores at a variable index

The bounds check of a variable array index defines two labels (operation 15).
The element unit owned them only for a whole element, a character part read,
and the whole-element store. Now it also owns them in these cases:

  • An index of any integer width. integerField takes a signed or unsigned
    binary index of 1, 2, 4 or 8 bytes. Only int(5) (dict arrays-b-b 19) is
    measured; the other widths follow the same 29 N 0 T; 75 8 pattern, which
    the unit still requires in full.
  • An integer part of an element (rec(i).code = 7, total = rec(i).code,
    l3b-ds-var 10 and 11), shown as the bytes %SUBST(A(i): 1: 4).
  • A character part store with its blank fill (rec(i).name = 'ITEM',
    l3b-ds-var 12): the store and the fill of the rest of the field are one
    %SUBST(A(i): 5: 9) = 'ITEM'.
  • A copy into a substring of an element (%subst(names(i): 4: 3) = 'xyz',
    l3b-subst-var 8).
  • An array that is a subfield of a data structure (rec.a(i) - rec.b(j),
    lr1-num-in-ds, lr1-num-pk-ds, lr1-num-zd-ds statements 21, 23, 25): the
    array address is 34 A K or 33 A; 27 K; 62; the array does not fill its
    symbol, so the bounds, not the symbol length, give the dimension. The text
    is S255.20(S254). Such an array declares nothing (array_element_v1 is
    not recorded for it), so the declaration emitter is unchanged.

An element address whose element type is unknown (the copy of a substring)
records no array_element_v1 fact, because the emitter reads the element
type from it.

Parked: S = %CHAR(I) of an integer (branch lc2b, commit 9f771bcd)

rpg_trim.charAssign recognizes the zoned convert, the leading-zero and
sign strip loop and the copy tail of S = %CHAR(I) (h-editc 44, h-now1 53).
Both statements recover, no dev emit gets worse, and the held-out line is
unchanged, so it is a public-only gain. It is stacked on lc2 and not
shipped; a later slot can ship it. d4-edit 14 (%trim(%char(i))) stays open:
its trim loops use a variant that halves does not read.

Next operation 15 candidate: %SCAN(%TRIM(H) : C)

Eleven dict batteries (sv4 to sv14) stop at statement 21, I = %scan(%trim(h) : c), on the first label of the trim loop. The loops are the ones that
rpg_trim.argumentUnit reads, but the call passes the trimmed pointer first
and the length of the trimmed value later (27 P; 113 q 1; 34 C 0; 113 q 1; ...; 27 N; ...; 99 SCAN 7), and argumentUnit requires 27 P; 113 q 1; 27 N
in a row. The change is to read the two loads apart.

Still at operation 15, by construct (no change here)

%INT of %TRIM of a varchar, %TRIML, %TRIMR (dict numtrim 31, 35, 43);
two trims concatenated (d4-lemon-battery 24); %SUBST with a variable start,
%REPLACE, %LEFT, %RIGHT, %CHECK, %CHECKR (h-bifs-char); %LOOKUP
(dict arrays-a-a); %SQRT (dict bifs-num-b 19).

Gates

{"checks":{"net_statements":0},"census":{"statuses":{"recovered":645,"partial":0,"unresolved":0},"regressions":0,"newly_recovered":0},"golden":"golden floor 173 ceiling 0 <= dump 173/5/0","legend":"current","emit":{"worse":[],"better":9,"newly_clean":21,"clean_delta":21,"base":394,"new":415},"twins":{"groups":586,"recovered":578,"regressions":[],"newly":16},"allgroups":{"regressions":[],"newly":["savf/SC-ILE/EXPERIMENTS/h-numtrim/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/l3b-ds-var/stripped/object.savf 3","savf/SC-ILE/EXPERIMENTS/l3b-subst-var/stripped/object.savf 1","savf/SC-ILE/EXPERIMENTS/lr1-di-pk3/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/lr1-di-pk5-sub/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/lr1-di-pk5/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/lr1-di-zd4/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/lr1-num-in-ds/stripped/object.savf 3","savf/SC-ILE/EXPERIMENTS/lr1-num-pk-ds/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/lr1-num-zd-ds/stripped/object.savf 3"],"worse":[]},"full_check":{"exit":0,"seconds":705}}
## rpg_array_element.zig, rpg_eval.zig: parts of an element, arrays inside a data structure, stores at a variable index The bounds check of a variable array index defines two labels (operation 15). The element unit owned them only for a whole element, a character part read, and the whole-element store. Now it also owns them in these cases: - **An index of any integer width.** `integerField` takes a signed or unsigned binary index of 1, 2, 4 or 8 bytes. Only `int(5)` (dict arrays-b-b 19) is measured; the other widths follow the same `29 N 0 T; 75 8` pattern, which the unit still requires in full. - **An integer part of an element** (`rec(i).code = 7`, `total = rec(i).code`, l3b-ds-var 10 and 11), shown as the bytes `%SUBST(A(i): 1: 4)`. - **A character part store with its blank fill** (`rec(i).name = 'ITEM'`, l3b-ds-var 12): the store and the fill of the rest of the field are one `%SUBST(A(i): 5: 9) = 'ITEM'`. - **A copy into a substring of an element** (`%subst(names(i): 4: 3) = 'xyz'`, l3b-subst-var 8). - **An array that is a subfield of a data structure** (`rec.a(i) - rec.b(j)`, lr1-num-in-ds, lr1-num-pk-ds, lr1-num-zd-ds statements 21, 23, 25): the array address is `34 A K` or `33 A; 27 K; 62`; the array does not fill its symbol, so the bounds, not the symbol length, give the dimension. The text is `S255.20(S254)`. Such an array declares nothing (`array_element_v1` is not recorded for it), so the declaration emitter is unchanged. An element address whose element type is unknown (the copy of a substring) records no `array_element_v1` fact, because the emitter reads the element type from it. ## Parked: `S = %CHAR(I)` of an integer (branch `lc2b`, commit 9f771bcd) `rpg_trim.charAssign` recognizes the zoned convert, the leading-zero and sign strip loop and the copy tail of `S = %CHAR(I)` (h-editc 44, h-now1 53). Both statements recover, no dev emit gets worse, and the held-out line is unchanged, so it is a public-only gain. It is stacked on `lc2` and not shipped; a later slot can ship it. d4-edit 14 (`%trim(%char(i))`) stays open: its trim loops use a variant that `halves` does not read. ## Next operation 15 candidate: `%SCAN(%TRIM(H) : C)` Eleven dict batteries (sv4 to sv14) stop at statement 21, `I = %scan(%trim(h) : c)`, on the first label of the trim loop. The loops are the ones that `rpg_trim.argumentUnit` reads, but the call passes the trimmed pointer first and the length of the trimmed value later (`27 P; 113 q 1; 34 C 0; 113 q 1; ...; 27 N; ...; 99 SCAN 7`), and `argumentUnit` requires `27 P; 113 q 1; 27 N` in a row. The change is to read the two loads apart. ## Still at operation 15, by construct (no change here) `%INT` of `%TRIM` of a varchar, `%TRIML`, `%TRIMR` (dict numtrim 31, 35, 43); two trims concatenated (d4-lemon-battery 24); `%SUBST` with a variable start, `%REPLACE`, `%LEFT`, `%RIGHT`, `%CHECK`, `%CHECKR` (h-bifs-char); `%LOOKUP` (dict arrays-a-a); `%SQRT` (dict bifs-num-b 19). ## Gates ``` {"checks":{"net_statements":0},"census":{"statuses":{"recovered":645,"partial":0,"unresolved":0},"regressions":0,"newly_recovered":0},"golden":"golden floor 173 ceiling 0 <= dump 173/5/0","legend":"current","emit":{"worse":[],"better":9,"newly_clean":21,"clean_delta":21,"base":394,"new":415},"twins":{"groups":586,"recovered":578,"regressions":[],"newly":16},"allgroups":{"regressions":[],"newly":["savf/SC-ILE/EXPERIMENTS/h-numtrim/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/l3b-ds-var/stripped/object.savf 3","savf/SC-ILE/EXPERIMENTS/l3b-subst-var/stripped/object.savf 1","savf/SC-ILE/EXPERIMENTS/lr1-di-pk3/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/lr1-di-pk5-sub/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/lr1-di-pk5/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/lr1-di-zd4/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/lr1-num-in-ds/stripped/object.savf 3","savf/SC-ILE/EXPERIMENTS/lr1-num-pk-ds/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/lr1-num-zd-ds/stripped/object.savf 3"],"worse":[]},"full_check":{"exit":0,"seconds":705}} ```
binjovi-bot manually merged commit e992730d4a into trunk 2026-11-07 09:02:02 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
sean/sourcerer!743
No description provided.