A character expression of literals and %CHAR of whole numbers recovers into a character field and into a varying-length field, and a static int(20) and int(3) keep their INZ #806
Loading…
Reference in a new issue
No description provided.
Delete branch "lcat"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
A character expression of literals and
%CHARof whole numbers recovers into a character field and into a varying-length field, and a staticint(20)andint(3)keep their INZs = 'Total ' + %char(n)recovered (lc2-cat-char-int). Anything more stopped at control_flow /operation_semantics on the first label of the
%CHARstrip, with%SUBST(A.1: 1: 10) = Sas the partialtext: a literal after the
%CHAR, a second%CHAR, a one-byte literal, and a varying-length target.rpg_char_chain.zig(new, PURE) reads the whole expression as one unit;rpg_trim.charAssigncalls itwhere it called
charConcat, which is gone.The unit
The compiler builds the expression in one temporary buffer CB behind one running length T1, then one tail
reads (CB, T1). After the strip of the digits of the first
%CHAR(rpg_trim.charStrip, 59 operations):27 P; 33 LIT; 5; 113; 5; 33 CB; 113; 5; 27 L; 35 T1; 27 L; 1; 35 T2; 76 4; 97; 27 L; 62; 113; 5; 27 N2; 1; 27 T2; 47; 35 T1; 76 4; 97; 333 CB; 113; 33 LIT; 5; 27 T1; 1; 35 O; 62; 113; 5; 27 L; 1; 27 O; 47; 35 T1; 76 4; 97; 327 P2; 33 CB; 113; 5; 113; 5; 27 T1; 1; 35 O; 62; 113; 5; 27 N2; 1; 27 O; 47; 35 T1; 76 4; 97; 3rpg_trim.copyTail, modejoined:34 S 0; 113; 1; 35 Q; 33 CB; 113; ...the copy of min(T1, W) bytes and the blank fill34 V 0; 113; 1; 35 Q; 27 2; 62; 113; 33 CB; 113; 27 MAX; 27 T1; 35 A; 35 C; 27 A; 27 C; 11; 17 L; 27 C; 35 A; 15 L 1; 27 A; 35 A; 27 A; 76 4; 97; 3; 27 Q; 27 A; 76 2; 42 V 0 U2The unit becomes the saved digits (
37 T),op_char_integerwith the first literal, then for each piecea
27 LITand47, or the numeric load, its37 T,op_char_integerand47, and at last35 target.No evaluator rule changed:
op_char_integerwith one operand,27of a constant and47existed.Facts decided
The request is
requests/lcat/concat(21 cases, one statement each on one template, captures incaptures/lcat-concat); the probes arelcat-cat-*in SC-ILE/EXPERIMENTS.CB is the sum, exactly, in every probe. The size of CB is the bytes of the literals plus D + 1 for each
%CHAR, where D + 1 is the size of the strip's buffer:cat-base6 + 11 = 17;cat-trail(+' ok') 20;cat-trail-long(+ 12 bytes) 29;cat-one-byte18;cat-first-one1 + 11 + 3 = 15;cat-int56 + 6 + 3 = 15;cat-int206 + 21 + 3 = 30;cat-two-char6 + 11 + 3 + 11 = 31;cat-two-packed6 + 11 + 3 + 6 = 26;cat-two-char-lit35;cat-two-lits24;cat-vary-lf19. But the committedlc2-cat-char-inthas the sameexpression with CB of 20 where the sum is 17: the buffer is one compiler temporary of the procedure, and the
largest use of it (
a + bin the same module, 20 bytes) sets its size. So the rule is a lower bound: the readerrefuses a CB smaller than the sum, and never demands the sum.
MAX is the declared length of the target.
cat-vary-tgt(vvarchar(40): the symbol has 42 bytes, thetail loads the constant 40) against
cat-vary-max20(varchar(20): 22 bytes, 20), which differ in thetarget only;
cat-vary-short(varchar(8): 10 bytes, 8) holds a chain of up to 20 bytes in a target of 8, andthe object is the same unit: the compiler does not fold min(T1, MAX) for a chain whose length it knows only at
run time. The reader requires MAX = symbol length - 2.
A one-byte literal is the same unit with L = 1.
cat-trail(' ok': a text constant, L the integer 3)against
cat-one-byte('.'),cat-lf(LF= X'25') andcat-first-one('#'as the first literal):the literal symbol is an integer constant of one byte (75, 37, 123;
word(4) == 1) and L is the integer 1.The same 18 operations (APPLIT) and the same 27 (FIRSTLIT).
rpg_literals.constantTextwrites it as'.'or
X'25'; the compiler gave the one-byte constant forLFand for the quoted'.'alike.The scratch is not distinct, so the reader is positional.
cat-two-char: the scratch O of the APPLIT isthe symbol that the strip before it used for N2 (294); the second strip stores the same value, buffer, counter
and N2 (293, 295, 297, 294) and a new pointer (301); the scratch of the APPDIG is the T2 of the FIRSTLIT
(299).
charConcatrequired all temporaries pairwise distinct and refused this. Now each piece is read inorder, and the rule is what the piece needs: O is not CB, not T1 (the state that lives on), and not the
pointer or the digits length that the same piece reads after it stores O; the strip of a later digits piece
does not write CB or T1 (value, buffer, pointer, counter, length).
The second source. The numeric load before the strip of a later
%CHARis one of three sequences, eachmeasured in the place of the second
%CHAR(cat-two-char: int(10),cat-two-int20: int(20),cat-two-int5:int(5),
cat-int3-second: int(3),cat-two-packed: packed(5:0)), D the digits of the strip:29 N 0 T; 86 D; 61 D 0 0; 85 D 129 N 0 T; 75 4; 86 D; 61 D 0 0; 85 D 1, D = 5 and 329 N 0 T; 61 D 0 0; 85 D 1The reader takes these three and no other run of the operations, and requires the D of the
86, the61andthe
85to be the digits of the strip, the decimal positions of the61to be 0, and the widening to be75 4.uns(10) loads with
88 Dwhere the int has86 D(cat-two-uns10) and zoned(5:0) with84 5 1(
cat-two-zoned): measured, and refused. The earlier reader took any run of29,61,75,85and86with operands unchecked, which the captures did not prove. The order of the digits is the order of the source
(
nthenm).The bound is 8 pieces.
cat-eight-pieces('Total ' + %char(n)and eight literals) is read with all eight;cat-nine-piecesstops the reader at the eighth, where the ninth is not the tail, and the statement keeps itsfailure line (
read s14).A one-byte text constant is not a one-byte literal. The compiler wrote an integer constant of one byte in
every probe. A text constant of one byte (a test's changed object) is refused at the first literal (
read s02) andat a literal piece (
literalPiece s02).Consecutive literals are two pieces (
cat-two-lits): the compiler does not join them.A target shorter than the chain (
cat-short-tgt, char(8)):copyTailkeeps its minimum block.What recovers
Eighteen of the 21 probes recover in line 16 that did not before;
cat-basewas recoveredbefore, and the two
cat-vary-piece*stay open (below). Counts of emitted and failure lines of the 21 strippedtwins, base 0.1.521 against this change:
The second failure of the base is statement 17,
unresolved suffix after a proved *INLR write. The earlier text ofthis document called it the template's (
*inlr = *on;and no procedure). It is not: it is the unread staticinitialization of
dcl-s q int(20) inz(5), the one declaration that the template shares, and it goes with the readerbelow.
cat-int20was counted recovered withqdeclaredint(20)and no INZ, so the recompiled program printedTotal 0 okwhere the original printsTotal 5 ok; now the emit declaresinz(5).The varying target is declared
varchar(MAX)by the existing proof of a varying assignment (the pair of the copyand the 2-byte length store), not by this reader; the tests check the declaration (
varchar(40),(20),(8))beside the assignment.
lc2-cat-varchar-tgtv = a + bof twochar(10)fields into avarchar(40): the same buffer and the same store of V, but thetwo fields are copied to CB with no strip, and the length is the constant K = 20 that the compiler folded
(
27 K; 35 A, no minimum, no label).rpg_char_chain.pairreads it (S267 = S255 + S256). The one datapoint is K = LA + LB <= MAX, so the reader requires exactly that, the fields to be character fields that are
not the target, CB at least K, and refuses the rest: a K that is not the sum, a sum above MAX (the folded
minimum is not measured), a literal or a third piece.
The static
int(20)andint(3)dcl-s q int(20) inz(5)is27 K; 37 q 0 Tin the static initialization: K a constant of the signed class and size8 (the value in the 8 bytes at byte 12 of its symbol), T the type
1 0 0 0 0 0 0 8, q a static field of kind 1 andlength 8. No reader took it (
init.storetakes the 4-byte signed form and the unsigned forms of 1, 2, 4 and 8 bytes,halfwordthe 2-byte one), so the declaration lost its INZ and the failure of the unread store became thestatement-17 failure above.
rpg_static_init.quadwordreads it, as an integer of an 8-byte static field.Measured with 5, 42 (
lcat-q20-two), -5 (lcat-q20-neg), 4294967296 (lcat-q20-big) and 9223372036854775807(
lcat-q20-max); with no INZ (lcat-q20-none) the compiler stores 0, which is the default, so the declarationhas none.
uns(20)(lcat-q20-uns) was read before and is the control.int(3), the 1-byte signed field, was the same gap (lc2-arg-uns5hasint(3) inz(7)in the source, and the emitdeclared
int(3)), and this lane's reader takes an int(3) as the first and as the second%CHAR(
lcat-cat-int3-first,-second,-neg: the load is29; 75 4; 86 3; 61 3 0 0; 85 3 1, the widening of an int(5)with D = 3), so it is read as well:
rpg_static_init.singlebyte, with a 1-byte signed constant and a 1-byte signedaccess type. The symbol decoder gives a 1-byte constant as an unsigned byte (-7 is 249); the reader makes it the signed
byte, and the probe of
inz(-7)(lcat-cat-int3-neg) is the test that it does. The program of these three probesdeclares
int(3) inz(7)andint(3) inz(-7)and the emit now writes both.The reader reaches beyond the probes of this lane, because every program with such a field had the unread store
as a failure: the emit gate (
emit-all.shof the committed twins against the 0.1.521 baseline) has worse 0, better 21and 70 twins newly clean, and
twins.sh72 groups newly recovered with no regression. Five tests ofrpg_lr3b_test.zig(lr3-diff-ts-*) had written the gap down ("the 8-byteint(20)start value of the target has norule", the target named
V00255); they now expectA_00255 int(20)and an emit with no failure line, which is whatthe source of the probe says (
dcl-s r int(20); r = %diff(a : b : *days)).Measured: the 33 public scout programs
capture-emit-diff.sh(stripped twins ofcaptures/l10-scout2andl10-scout2b), base 0.1.521 against thischange. 31 programs are the same; two change:
msgText = 'lit' + %CHAR(i) + 'lit' + %CHAR(v) + 'lit'into char(200), packed(5:0) as the second sourcemessage = 'lit' + %CHAR(n) + '.' + X'25'into varchar(100) (the source saysLF)agree.shover the 33: same 159 to 160, refused 149 to 148, suspect 13 to 13, wrong parameters 0 to 0,declarations the same as the source 35 to 36 (advent-2 is not aligned to its source and is not scored; its three
statements were read against the lines 431, 494 and 503 of the source by hand).
emit-lint.sh: 0 findings. Theother 31 emit byte for byte the same text as the base, so the reader of the static
int(20)changes no public programbeyond these.
Not done, and why
cat-vary-piece,cat-vary-piece-lit; advent-2 424, advent-3 412 and advent-4 412 hold itbeside the call result
%CHAR(errno()), which is the other lane's):the piece is
33 CB; 113; 34 V2 0; 1; 32 V2 0 U2; 76 8; 1; 76 4; 35 TA; 27 TA; 27 MAX; 12; 17 L; 27 115; 35 ST; 99 3 0 0 0; 15 L 1; ..., the direct form of the length check, which signals error 115 by a store and a99 3 0 0 0.rpg_varying_data.headreads the pointer form (29 P 0 PTR, a call of an importedprocedure). It does not fall out of this reader, so it refuses and the statement keeps its failure line.
%CHAR(errno())), the+=consumer and the DSPLY tail: other lanes.61with decimal positions (a packed or zoned source with decimals) as a source: not measured, refused.reads the load. The three sequences are measured in the first place for int(10), int(5), int(3) and int(20) only;
uns(10), zoned and packed as the first source are not measured.
v = a + bwith a sum above MAX, with a literal, or with three fields: one data point only.Probes
lcat-cat-base,-trail,-trail-long,-one-byte,-lf,-first-one,-two-char,-two-packed,-two-char-lit,-two-lits,-int5,-int20,-short-tgt,-vary-tgt,-vary-max20,-vary-short,-vary-base,-vary-lf,-vary-two-char,-vary-piece,-vary-piece-lit; the committedlc2-cat-varchar-tgtis now read. Three more batteries, one per question of the review:requests/lcat/int20(
lcat-q20-neg,-big,-max,-none,-two,-uns),requests/lcat/second(lcat-cat-two-int5,-two-int20,-two-uns10,-two-zoned),requests/lcat/int3(lcat-cat-int3-first,-second,-neg) andrequests/lcat/pieces(
lcat-cat-eight-pieces,-nine-pieces).New tests:
src/rpg_lcat_concat_test.zig(the emitted text of each case, the declaration of the varyingtarget and of the
int(20), and one changed-object test per rule of the readers: the first literal, a literalpiece, a digits piece, the numeric load, the varying tail, the pair and the static store). A changed-object test
asserts the site of the refusal (
rpg_char_chain.read s05, through the trace seam), not only that the statement isno longer recovered: a refusal at another site, or none, fails it, and so does a rule that is removed from the reader.
Trace sites moved
charConcatis gone. The statements of this family that are still refused now stop inrpg_char_chain.read(
s01the first literal is not the unit,s10a piece that is none of the two,s14a tail that is neitherof the two,
s15a numeric load whose digits are not those of its strip), not inrpg_trim.charConcat s13; a triage token keyed on the old name is stale.pair s01is anew trace line on every statement that starts with two field loads (
34 A; 113; 34 B).rpg_static_init.quadwordandsinglebyteadd the tokenss01tos09each. A program whose static initializationstores an 8-byte or a 1-byte signed field no longer has the
remaining_effectsfailure of that store, so itsunresolved suffix after a proved *INLR writeline goes (the 21lcat-cat-*probes). The 33 public scout programs do not change for this reason.Gate
3995db0da63116bf8893