A by-reference parameter that a subfield store proves a structure is written as one; one template name per layout (touches rpg_source.zig) #785

Manually merged
binjovi-bot merged 9 commits from lparm into trunk 2026-11-11 07:16:51 +00:00
Owner

Lane Lparm. Three shapes of parameter text were written wrong with no failure line. Measured on the stripped objects of lsel-for-arr-if-*, the six public Async captures and the battery captures/lparm-param-shapes (24 cases, all compiled; six are adopted as probes: lpar-ar-const-varsize, lpar-ar-plain, lpar-lk-set-static, lpar-lk-set-both, lpar-pv-val-int, lpar-pv-ref-int).

  • Shape 3, a store to a subfield of a likeds parameter (snap.handle = task;). The store is 29 P 0 T; 29 V 0 T; 75 8; 75 4; 75 4; 42 F 0 T': F is the 15-byte character field at the pointer P of the parameter, T' the 4-byte integer type. A store of 4 bytes at byte 0 of a 15-byte field is a subfield, not the field. narrowPlaces (29 P 0 T directly before 32|42 F 0 T') misses it because 75 conversions stand between, so the assignment was written to the whole parameter, declared char(15) (X = V;, RNF7416). The rule reads the store itself (parts_mod.narrowStoreAtZero: the one typed 42 F 0 T' of the statement on the character field F, not a padded store, narrower than F) and takes the lv-pds-likeds-set route: byte 0 is a part typed by the store, the parameter is likeds(TMPL15) and the template F0 int(10); G4 char(11) is written before the first procedure. A byte 0 with two types is a failure line. A packed or zoned parameter is not read this way (its symbol length is in digits). Battery: lk-set-static, lk-set-local and lk-set-expr now emit free of failure lines except compiler statement 2100000001 is partial.
  • The guard of the final pass: a statement that names a subfield which the template of a parameter does not list, or of a parameter that other accesses routed to a caller's structure, is a failure line (declare, site s07). Proof: lk-set-both (snap.handle = task; snap.state = 1;, the caller's structure static) was written V00258 = V00259; V00258.F4 = 1; before, the first store to the whole parameter; it now has two failure lines and no wrong text. The template is named by the length of its parameter, and the six Async captures wrote five dcl-ds TMPL2182 qualified template with five layouts (the same name five times, no failure line). Two parameters of one length with one layout now share one declaration, another layout is named TMPLn_symbol (paramTemplateName); the Async emits have the same failure counts and statements. No committed object has two such parameters, so no test pins it; lk-two-same takes the existing structure route for its second parameter.
  • Shape 2, an array parameter. The element access of a parameter in the procedure that indexes it is 29 P 0 T; ...; 27 K; 138; 78 4; 65 W; [loads and conversions of the other operand]; 32|42 F 0 TE: operation 138 holds the largest zero-based index and operation 65 the element width, as for an array of the module (rpg_array_element.zig). One K, W and TE on every access, TE W bytes wide and (K + 1) * W the length of F prove TE dim(K + 1) for the parameter. The first ship of this branch wrote that text; on the host lpar-ar-plain and lpar-ar-const-varsize went from different to failed (RNF7535 at the call: the argument field of the caller keeps its own declaration, here a qualified structure with a store at byte 0, beside a parameter of the array type). A half-applied type is worse than the consistent character field, so the array rule is taken out: the parameter stays char(40), the same as before this branch, and the test pins that both sides keep one declaration. Writing the array needs the argument field declared as the array too, with its statements as element accesses (ids(1) = 1), proved from the call; that is the next change. Does const or options(*varsize) leave a trace? options(*varsize): none. lpar-ar-const-varsize and lpar-ar-const have the same operations, operands (symbol numbers aside) and entry symbols in both procedures, caller and callee. const: the callee is the same as plain int(10) dim(10); the caller of the const case has five more operations (6 1; 27 C; 35 T; 15 L 2; 6 2) before the statement that calls it, a temporary that I did not tie to the parameter, so it is not used. A parameter that the procedure only passes on (ar-pass outer, Async_WaitAny and the like) keeps its character field, and one read at a constant index (ar-first) its structure route; the character array (ar-char) is not a field-typed access.
  • Shape 1, a pointer parameter passed by value. The entry symbol of arg pointer value is the same 32 bytes as that of a by-reference likeds, varchar const or dim() const options(*varsize) parameter: kind 9, class 5, length 16, word 28 80100000, word 24 f0008000 when the body uses it and e0008000 when it does not. Pairs of the battery, stripped objects, statement numbers and symbol numbers aside: pv-ref-int/pv-val-int, pv-copy-ref/pv-copy-val and pv-nop-ref/pv-nop-val have the same operations in the callee (take), the same entry symbols and the same symbol table apart from the length of the module procedure symbol and one unused field symbol; pv-ref-based/pv-val-var likewise (the callee is the same, the caller differs in the same one operation). So the callee object does not hold the form, and the emitter writes for both sources the by-reference text (x int(10), x int(10) options(*nopass)), which recompiles to the callee of the by-reference source, the same object as that of the by-value source. The callers differ in one operation in all four pairs (a based variable passed by reference included): the address that is passed by reference is followed by 113 T 2 (take(n), take(bx)), the pointer value of take(%addr(n)) and take(q) has none. The emitter writes the by-reference call (TAKE(A_00254)) for both, so the caller of a by-value source recompiles with the extra operation: that is one byte-level difference, and it is not used, because the condition "an address argument without 113" is not general: written as a failure line of the call (also with calls to imported procedures left out) it made 39 committed twins worse in the emit gate, among them d7-params, where the structure r is passed with a bare 33 R and no 113: the tag is on the scalar arguments of the battery, not on every by-reference argument. A rule needs the exact condition of the tag (the argument kinds that carry it) first; that is the open question for the next lane, with this battery as its evidence.

Tests: rpg_param_shape_test.zig (six). Counter (parm-count.sh, 54 public captures: 24 lparm, 24 lsel, six Async; 535 parameter declarations): see the ship report; the array rule no longer changes any count.

Release gate (coordinator, build of c5a18c35 against v0.1.501)

  • Ship row c5a18c35 (the head adds only the corrected heading of this fragment): all gates passed (census 645/0, twins regressions none, emit worse none).
  • Development emits: byte-identical. L10-test direction: unchanged.
  • Committed twins at v0.1.501 (emit-bytes-diff.sh): only lsel-for-arr-if-if changes.
  • 87 public captures (capture-emit-diff.sh): 13 change. lpar-lk-set-both goes from 8 to 6 emitted statements: the two lines it loses were a store to the whole parameter where the source stores to a subfield, now failure lines. The six public Async captures change only in template names (the same name was written for five layouts).
  • Host round trips, v0.1.501 then this build: lpar-lk-set-static, lpar-lk-set-local, lpar-lk-set-expr failed (compile), now different; lpar-ar-plain, lpar-ar-const-varsize different in both.
  • An earlier build of this branch also wrote an indexed array parameter as T dim(N). The host refused it (RNF7535: the caller's argument field kept its old declaration), so that rule is not in this change; both sides of the call have to change together.
Lane Lparm. Three shapes of parameter text were written wrong with no failure line. Measured on the stripped objects of `lsel-for-arr-if-*`, the six public Async captures and the battery `captures/lparm-param-shapes` (24 cases, all compiled; six are adopted as probes: `lpar-ar-const-varsize`, `lpar-ar-plain`, `lpar-lk-set-static`, `lpar-lk-set-both`, `lpar-pv-val-int`, `lpar-pv-ref-int`). - Shape 3, a store to a subfield of a `likeds` parameter (`snap.handle = task;`). The store is `29 P 0 T; 29 V 0 T; 75 8; 75 4; 75 4; 42 F 0 T'`: F is the 15-byte character field at the pointer P of the parameter, T' the 4-byte integer type. A store of 4 bytes at byte 0 of a 15-byte field is a subfield, not the field. `narrowPlaces` (`29 P 0 T` directly before `32|42 F 0 T'`) misses it because `75` conversions stand between, so the assignment was written to the whole parameter, declared `char(15)` (`X = V;`, RNF7416). The rule reads the store itself (`parts_mod.narrowStoreAtZero`: the one typed `42 F 0 T'` of the statement on the character field F, not a padded store, narrower than F) and takes the lv-pds-likeds-set route: byte 0 is a part typed by the store, the parameter is `likeds(TMPL15)` and the template `F0 int(10); G4 char(11)` is written before the first procedure. A byte 0 with two types is a failure line. A packed or zoned parameter is not read this way (its symbol length is in digits). Battery: lk-set-static, lk-set-local and lk-set-expr now emit free of failure lines except `compiler statement 2100000001 is partial`. - The guard of the final pass: a statement that names a subfield which the template of a parameter does not list, or of a parameter that other accesses routed to a caller's structure, is a failure line (`declare`, site s07). Proof: lk-set-both (`snap.handle = task; snap.state = 1;`, the caller's structure static) was written `V00258 = V00259; V00258.F4 = 1;` before, the first store to the whole parameter; it now has two failure lines and no wrong text. The template is named by the length of its parameter, and the six Async captures wrote five `dcl-ds TMPL2182 qualified template` with five layouts (the same name five times, no failure line). Two parameters of one length with one layout now share one declaration, another layout is named `TMPLn_symbol` (`paramTemplateName`); the Async emits have the same failure counts and statements. No committed object has two such parameters, so no test pins it; lk-two-same takes the existing structure route for its second parameter. - Shape 2, an array parameter. The element access of a parameter in the procedure that indexes it is `29 P 0 T; ...; 27 K; 138; 78 4; 65 W; [loads and conversions of the other operand]; 32|42 F 0 TE`: operation 138 holds the largest zero-based index and operation 65 the element width, as for an array of the module (`rpg_array_element.zig`). One K, W and TE on every access, TE W bytes wide and (K + 1) * W the length of F prove `TE dim(K + 1)` for the parameter. The first ship of this branch wrote that text; on the host `lpar-ar-plain` and `lpar-ar-const-varsize` went from `different` to `failed` (RNF7535 at the call: the argument field of the caller keeps its own declaration, here a qualified structure with a store at byte 0, beside a parameter of the array type). A half-applied type is worse than the consistent character field, so the array rule is taken out: the parameter stays `char(40)`, the same as before this branch, and the test pins that both sides keep one declaration. Writing the array needs the argument field declared as the array too, with its statements as element accesses (`ids(1) = 1`), proved from the call; that is the next change. Does `const` or `options(*varsize)` leave a trace? `options(*varsize)`: none. lpar-ar-const-varsize and lpar-ar-const have the same operations, operands (symbol numbers aside) and entry symbols in both procedures, caller and callee. `const`: the callee is the same as plain `int(10) dim(10)`; the caller of the const case has five more operations (`6 1; 27 C; 35 T; 15 L 2; 6 2`) before the statement that calls it, a temporary that I did not tie to the parameter, so it is not used. A parameter that the procedure only passes on (`ar-pass` outer, Async_WaitAny and the like) keeps its character field, and one read at a constant index (`ar-first`) its structure route; the character array (`ar-char`) is not a field-typed access. - Shape 1, a pointer parameter passed by value. The entry symbol of `arg pointer value` is the same 32 bytes as that of a by-reference `likeds`, `varchar const` or `dim() const options(*varsize)` parameter: kind 9, class 5, length 16, word 28 `80100000`, word 24 `f0008000` when the body uses it and `e0008000` when it does not. Pairs of the battery, stripped objects, statement numbers and symbol numbers aside: pv-ref-int/pv-val-int, pv-copy-ref/pv-copy-val and pv-nop-ref/pv-nop-val have the same operations in the callee (`take`), the same entry symbols and the same symbol table apart from the length of the module procedure symbol and one unused field symbol; pv-ref-based/pv-val-var likewise (the callee is the same, the caller differs in the same one operation). So the callee object does not hold the form, and the emitter writes for both sources the by-reference text (`x int(10)`, `x int(10) options(*nopass)`), which recompiles to the callee of the by-reference source, the same object as that of the by-value source. The callers differ in one operation in all four pairs (a based variable passed by reference included): the address that is passed by reference is followed by `113 T 2` (`take(n)`, `take(bx)`), the pointer value of `take(%addr(n))` and `take(q)` has none. The emitter writes the by-reference call (`TAKE(A_00254)`) for both, so the caller of a by-value source recompiles with the extra operation: that is one byte-level difference, and it is not used, because the condition "an address argument without `113`" is not general: written as a failure line of the call (also with calls to imported procedures left out) it made 39 committed twins worse in the emit gate, among them d7-params, where the structure `r` is passed with a bare `33 R` and no `113`: the tag is on the scalar arguments of the battery, not on every by-reference argument. A rule needs the exact condition of the tag (the argument kinds that carry it) first; that is the open question for the next lane, with this battery as its evidence. Tests: `rpg_param_shape_test.zig` (six). Counter (`parm-count.sh`, 54 public captures: 24 lparm, 24 lsel, six Async; 535 parameter declarations): see the ship report; the array rule no longer changes any count. ## Release gate (coordinator, build of c5a18c35 against v0.1.501) - Ship row c5a18c35 (the head adds only the corrected heading of this fragment): all gates passed (census 645/0, twins regressions none, emit worse none). - Development emits: byte-identical. L10-test direction: unchanged. - Committed twins at v0.1.501 (`emit-bytes-diff.sh`): only `lsel-for-arr-if-if` changes. - 87 public captures (`capture-emit-diff.sh`): 13 change. `lpar-lk-set-both` goes from 8 to 6 emitted statements: the two lines it loses were a store to the whole parameter where the source stores to a subfield, now failure lines. The six public Async captures change only in template names (the same name was written for five layouts). - Host round trips, v0.1.501 then this build: `lpar-lk-set-static`, `lpar-lk-set-local`, `lpar-lk-set-expr` failed (compile), now different; `lpar-ar-plain`, `lpar-ar-const-varsize` different in both. - An earlier build of this branch also wrote an indexed array parameter as `T dim(N)`. The host refused it (RNF7535: the caller's argument field kept its old declaration), so that rule is not in this change; both sides of the call have to change together.
A typed store narrower than a by-reference character parameter at byte 0 is a
subfield of a likeds template, not an assignment to the whole parameter. An
indexed element access (operations 138 and 65) of a by-reference parameter
proves its element type and dimension. A pointer parameter passed by value has
no object fact; the fragment records the measurement.
Regenerate the operations legend
Some checks reported errors
binjovi/ci A newer source or plan superseded this Build
c5a18c357a
sean force-pushed lparm from c5a18c357a
Some checks reported errors
binjovi/ci A newer source or plan superseded this Build
to 01f0fd77fc
Some checks reported errors
binjovi/ci A newer source or plan superseded this Build
2026-11-11 07:06:38 +00:00
Compare
sean changed title from A by-reference parameter that a store or an index proves a structure or an array is written as one (touches rpg_source.zig) to A by-reference parameter that a subfield store proves a structure is written as one; one template name per layout (touches rpg_source.zig) 2026-11-11 07:06:54 +00:00
Correct the heading of the change fragment: the array rule is not in this change
All checks were successful
binjovi/ci Binjovi completed the frozen plan
5ccbf96bc2
binjovi-bot manually merged commit 5ccbf96bc2 into trunk 2026-11-11 07:16:51 +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!785
No description provided.