An array element at a variable index #638

Manually merged
binjovi-bot merged 1 commit from rpg-9-ac-array-element-20261025 into trunk 2026-10-25 10:40:00 +00:00
Owner

An array element at a variable index

samples(item) compiles to a unit of thirty-one operations: the index widened
to eight bytes in a temporary, a test against the dimension and against zero,
the dimension plus one as the out-of-range value, and the load of the element
at (index - 1) * width bytes from the array. No rule read it, so a statement
with an indexed element stayed unresolved, and the array itself, with its
elements stored at constant offsets, was declared as a data structure of
subfields. The value unit rpg_array_element.zig reads the shape (measured on
decimal-fault-report, decimal-sign-report and cond-not), the statement
reader shows S264(S258), and the fact array_element_v1 tells the source
emitter the dimension and the element width: dcl-s samples char(9) dim(9),
samples(1) = x'...' for a store at a constant offset, samples(item) for
the variable index. A store into an element at a variable index is another
shape and is still open; cond-not stays open on its NOT conditions.

Gates

{"checks":{"net_statements":0},"census":{"statuses":{"recovered":645,"partial":0,"unresolved":0},"regressions":0,"newly_recovered":0},"golden":"golden 173/5/0 == dump 173/5/0","emit":{"worse":[],"better":30,"newly_clean":21,"clean_delta":21,"base":215,"new":236},"twins":{"groups":439,"recovered":431,"regressions":[],"newly":16},"allgroups":{"regressions":[],"newly":["rpg-corpus-captures/files-chain/stripped/object.savf 2","rpg-corpus-captures/files-display-write/stripped/object.savf 2","rpg-corpus-captures/files-logical/stripped/object.savf 2","savf/SC-ILE/DSPLY/error-observable/archive.savf 2","savf/SC-ILE/DSPLY/error-stripped/archive.savf 2","savf/SC-ILE/DSPLY/stripped/archive.savf 2","savf/SC-ILE/EXPERIMENTS/d4-out-const/stripped/object.savf 1","savf/SC-ILE/EXPERIMENTS/d4-out-input/stripped/object.savf 1","savf/SC-ILE/EXPERIMENTS/d4-srcstmt-dspf/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/d7c-copy/stripped/object.savf 1","savf/SC-ILE/EXPERIMENTS/decimal-fault-report/stripped/archive.savf 1","savf/SC-ILE/EXPERIMENTS/decimal-sign-report/stripped/archive.savf 1","savf/SC-ILE/EXPERIMENTS/fmtind-j1/stripped/object.savf 1","savf/SC-ILE/EXPERIMENTS/fmtind-j2/stripped/object.savf 1","savf/SC-ILE/EXPERIMENTS/fmtind-j3/stripped/object.savf 1","savf/SC-ILE/EXPERIMENTS/format-base/stripped/archive.savf 2","savf/SC-ILE/EXPERIMENTS/format-rename/stripped/archive.savf 2","savf/SC-ILE/EXPERIMENTS/gotos-static/stripped/archive.savf 2","savf/SC-ILE/EXPERIMENTS/h-subind/stripped/object.savf 1","savf/SC-ILE/EXPERIMENTS/packed-add-report/stripped/archive.savf 1","savf/SC-ILE/EXPERIMENTS/packed-compose-report/stripped/archive.savf 2","savf/SC-ILE/EXPERIMENTS/packed-compose-sign-report/stripped/archive.savf 2","savf/SC-ILE/EXPERIMENTS/r6a-reset-ds/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6a-reset-fixed/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6a-reset-two/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/shared-io-full/stripped/archive.savf 2","savf/SC-ILE/EXPERIMENTS/shared-io-none/stripped/archive.savf 2","savf/SC-ILE/MONITOR/limits-observable/archive.savf 1","savf/SC-ILE/MONITOR/limits-stripped/archive.savf 1","savf/SC-ILE/MONITOR/stripped/archive.savf 2","savf/SC-ILE/TSTRIP-STRIPPED/archive.savf 2","savf/SC-ILE/TSTRIP/archive.savf 2"],"worse":[]},"full_check":{"exit":0,"seconds":816}}
# An array element at a variable index `samples(item)` compiles to a unit of thirty-one operations: the index widened to eight bytes in a temporary, a test against the dimension and against zero, the dimension plus one as the out-of-range value, and the load of the element at `(index - 1) * width` bytes from the array. No rule read it, so a statement with an indexed element stayed unresolved, and the array itself, with its elements stored at constant offsets, was declared as a data structure of subfields. The value unit `rpg_array_element.zig` reads the shape (measured on `decimal-fault-report`, `decimal-sign-report` and `cond-not`), the statement reader shows `S264(S258)`, and the fact `array_element_v1` tells the source emitter the dimension and the element width: `dcl-s samples char(9) dim(9)`, `samples(1) = x'...'` for a store at a constant offset, `samples(item)` for the variable index. A store into an element at a variable index is another shape and is still open; `cond-not` stays open on its `NOT` conditions. ## Gates ``` {"checks":{"net_statements":0},"census":{"statuses":{"recovered":645,"partial":0,"unresolved":0},"regressions":0,"newly_recovered":0},"golden":"golden 173/5/0 == dump 173/5/0","emit":{"worse":[],"better":30,"newly_clean":21,"clean_delta":21,"base":215,"new":236},"twins":{"groups":439,"recovered":431,"regressions":[],"newly":16},"allgroups":{"regressions":[],"newly":["rpg-corpus-captures/files-chain/stripped/object.savf 2","rpg-corpus-captures/files-display-write/stripped/object.savf 2","rpg-corpus-captures/files-logical/stripped/object.savf 2","savf/SC-ILE/DSPLY/error-observable/archive.savf 2","savf/SC-ILE/DSPLY/error-stripped/archive.savf 2","savf/SC-ILE/DSPLY/stripped/archive.savf 2","savf/SC-ILE/EXPERIMENTS/d4-out-const/stripped/object.savf 1","savf/SC-ILE/EXPERIMENTS/d4-out-input/stripped/object.savf 1","savf/SC-ILE/EXPERIMENTS/d4-srcstmt-dspf/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/d7c-copy/stripped/object.savf 1","savf/SC-ILE/EXPERIMENTS/decimal-fault-report/stripped/archive.savf 1","savf/SC-ILE/EXPERIMENTS/decimal-sign-report/stripped/archive.savf 1","savf/SC-ILE/EXPERIMENTS/fmtind-j1/stripped/object.savf 1","savf/SC-ILE/EXPERIMENTS/fmtind-j2/stripped/object.savf 1","savf/SC-ILE/EXPERIMENTS/fmtind-j3/stripped/object.savf 1","savf/SC-ILE/EXPERIMENTS/format-base/stripped/archive.savf 2","savf/SC-ILE/EXPERIMENTS/format-rename/stripped/archive.savf 2","savf/SC-ILE/EXPERIMENTS/gotos-static/stripped/archive.savf 2","savf/SC-ILE/EXPERIMENTS/h-subind/stripped/object.savf 1","savf/SC-ILE/EXPERIMENTS/packed-add-report/stripped/archive.savf 1","savf/SC-ILE/EXPERIMENTS/packed-compose-report/stripped/archive.savf 2","savf/SC-ILE/EXPERIMENTS/packed-compose-sign-report/stripped/archive.savf 2","savf/SC-ILE/EXPERIMENTS/r6a-reset-ds/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6a-reset-fixed/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6a-reset-two/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/shared-io-full/stripped/archive.savf 2","savf/SC-ILE/EXPERIMENTS/shared-io-none/stripped/archive.savf 2","savf/SC-ILE/MONITOR/limits-observable/archive.savf 1","savf/SC-ILE/MONITOR/limits-stripped/archive.savf 1","savf/SC-ILE/MONITOR/stripped/archive.savf 2","savf/SC-ILE/TSTRIP-STRIPPED/archive.savf 2","savf/SC-ILE/TSTRIP/archive.savf 2"],"worse":[]},"full_check":{"exit":0,"seconds":816}} ```
sean force-pushed rpg-9-ac-array-element-20261025 from a1ed0085a7
All checks were successful
binjovi/ci Binjovi completed the frozen plan
to de1e2f4b58
Some checks reported errors
binjovi/ci A newer source or plan superseded this Build
2026-10-25 10:27:48 +00:00
Compare
sean force-pushed rpg-9-ac-array-element-20261025 from de1e2f4b58
Some checks reported errors
binjovi/ci A newer source or plan superseded this Build
to e5d17241a0
All checks were successful
binjovi/ci Binjovi completed the frozen plan
2026-10-25 10:28:47 +00:00
Compare
binjovi-bot manually merged commit e5d17241a0 into trunk 2026-10-25 10:40:00 +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!638
No description provided.