rpg_source_stmt.zig, rpg_source.zig, rpg_source_decl_emit.zig: a conversion as a procedure argument, and refusal trace sites in the emitter #771
Loading…
Reference in a new issue
No description provided.
Delete branch "lgd"
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?
rpg_source_stmt.zig: the held-out _QRNX_GET_DECIMAL_NUM family is a runtimeSummary refusal, not a declaration refusal (lane Lgd)
What the two labels prove (code reading, trunk
5be4b586)translated:
rpg_source_decl_emit.zig(the loop aftercharNow, andfailUndeclared)turns a
.codeentry into(no declaration of symbol N: <why>). Both loops skip anentry that is already
.fail.emit-families.awktests/no declaration of symbol/before the runtime rule andunconditionally, and
withReasoncuts the statement text so that the reason stays. A%DECstatement blocked by its declaration is therefore classed "statement names a fieldwithout a declaration / line longer than 100 bytes" (the public battery
lr1-long-declshows it:
statement 13: S... (no declaration of symbol 253: a line is longer than 100 bytes)).that starts with the raw
CALL _QRNX_GET_DECIMAL_NUM(segment, has nopartial:and noreason. The only producer is
rpg_source.zig statement:stmt.hasSegments(text)andstmt.runtimeSummaryreturned null, then.fail = text. The fail line is clipped at 100bytes, so only the first segment (the call) is visible; whatever made the summary refuse is
after it.
So the two statements fail inside
runtimeSummary, before the declaration is looked at. Thelong declaration of their source is a second, independent refusal of the same symbol. The three
earlier attempts (Lr1 subfield conversions, the twelve-line INZ,
*allximage fields,*HIVAL/*LOVAL, Lo15%DEC(%CHAR(I))) changed the declaration side or the proof side only;none of them can move a statement that
runtimeSummaryrefuses, which is why the family stayedunchanged. Both gates must open for the statements to emit.
The gates of runtimeSummary for a recovered decimal statement, ranked
The proof text of a recovered
_QRNX_GET_DECIMAL_NUMstatement isCALL _QRNX_GET_DECIMAL_NUM(...); IF RETURN <> 0: ...; Lnn AT I..I..; <other lines>; <final>,the lines of
rpg_evaljoined by;(rpg_statements.zig). Conditions (IF,DOW,WHEN)drop the call lines (
rpg_evalkeepsdecimal_linesout of a condition), so a condition is nocandidate: h-numtrim statement 13
if %int(%trim(parm)) > 3emits.indexOf(final, " = ") == null). A procedurecalled as a statement with the conversion as an argument:
rpg_eval.callappendsCALLP name(args)to the lines when the result is dropped, so the final isCALLP SHOWI(%INT(...)). No public twin hascallp p(%dec(char))orp(%int(char))(the public
invoke(%dec(i10: 9: 2): text)is a numeric%DEC, no call). Ranked first:it is a certain refusal in the code and a common form (a long input buffer whose fields
are passed to subprocedures).
elseof the segment loop). A CONSTpacked or zoned parameter takes the conversion through a checked copy
(
programs.op_checked_copy: aCOPY_REF...line); a character target takes%CHAR(%DEC(...))through copy lines (%SUBST(T: 1: n) = ...); an element target canwrite
%SUBST(elem: ...). Each is after the call, so the label stays GET_DECIMAL_NUM.%DEC(nor%INT((line 240).%UNS,%UNSH,%INTH(and%DECHon trunk, which lr1g extended) fail this test if the proof recovers them; on trunkrecoverFromrequires the half-adjust constant 0 (s12), so%INTH/%DECHare partial,not recovered, and rank below;
%UNSkeeps the call shape and may be recovered.quotedat the end): an apostrophe in a source literal; low.The declaration side, ranked (the second gate, same symbol)
declLine(scalar) andstructureLines(data structure) refuse "longer than 100 bytes" whena line still passes 100 bytes after
wrapLong, which allows at most two INZ continuation lines(about 176 characters of text, 88 bytes as hexadecimal). The name and the type are short, so
the length is the INZ:
characters): a record or message buffer whose numeric fields the program converts. Lr1g's
twelve-line rule would open it, but only together with a statement-side rule.
characterLiteralwrites the wholevalue as hexadecimal, twice its length): more than 88 bytes.
bytes or less), more than 88 bytes.
dim+ctdata(orperrcd) table: the whole image of an array is refused.varcharwith a long start value.Battery lgd/decnum (requests/lgd/decnum)
Consumers × long declarations, each case one conversion statement of the long-declared symbol;
two plain-field controls separate the statement gate from the declaration gate.
p = %dec(%subst(line: 4: 5): 7: 0)callp showi(%int(%subst(...))),showi(...)callp showp(%dec(...: 7: 0))(CONST packed)c = %char(%dec(...)),c = %editc(%dec(...): 'Z')arr(2) = %dec(...)u = %uns(...),n = %inth(...)dsply %char(%int(...))n = %int(line)(all 200 bytes)char(5) dim(40) ctdata(200-byte image)callp showi(%int(s10)),u = %uns(s10)A case reproduces the held-out pair when its emit has both a fail line that starts with
CALL _QRNX_GET_DECIMAL_NUM((nopartial:) anddeclaration of symbol N: ... longer than 100 bytesfor the symbol the call reads.Trace sites in runtimeSummary (instrumentation, no behaviour change)
rpg_source_stmt.runtimeSummaryreturned null silently, so the refusal tracer could notname the gate. Each null return is now
rpg_trace.ret(null, "rpg_source_stmt", "runtimeSummary", "sNN"), s01 to s22 in the order of the returns (s03: the final is noassignment and no RETURN; s13: a segment without a rule; s15: no
%DEC(/%INT(in thefinal; s14, s18, s20: the edit, date and conversion mismatches; s22: a padded store with no
call that
plainStorerefuses). The file is in the site list ofrpg_trace_test.zig. Thetokens fire under
savf rpgle(the emitter), not underdump. On the committed twins(Debug build, every stripped save of
src/testdata) only s10 (h-now2), s13 (dict-calls3,h-blk1, h-subfill, r5x-cycle-print), s20 (h-now1) and s22 (lc2-concat-arr, lc2-concat-ds)
fire; s03 and s15 fire on none. The emitted source of every twin is byte-identical to the
trunk Debug build. Tests:
src/rpg_lgd_test.zig(s03 for aCALLPfinal, s15 for%UNS,no token for the assignment).
Oracle round 1 and the second set of trace sites
The coordinator's oracle on the first build: no
runtimeSummarysite fires on the two programswith the family, and the declaration line did not move under any lr1g build. So the fail text
that carries
CALL _QRNX_GET_DECIMAL_NUMcomes from another branch that keeps the proof text.Candidates: a fail that
withReasonwrites as the proof text plus a short reason thatemit-families.awkhas no rule for. The awk classes it by: CALL _QRNXbefore its later rules,and a reason of about 35 bytes or fewer leaves
CALL _QRNX_GET_DECIMAL_NUM(visible. The firstcandidate is
checkNames"the name X is not declared" (or "names no symbol"). The emitted textnames a field whose declaration lines declare no name, because the declaration failed, through a
piece that the
.symbol/.partloop ofdeclaredoes not see.New sites (output unchanged; every twin's emit is byte-identical to trunk):
rpg_source.statements01 checkedCall, s02 decimalCall, s03 packedFact, s04 fileStatement:each returned a fail; s05:
runtimeSummarysucceeded and the statement of the final failed.rpg_source.translates01 status (partial/unresolved), s02 field at byte 0 narrower, s03part_why, s04 pointer reason, s05 token reason, s06 any fail at the end.rpg_source_decl_emit.declares01 date start value, s02 byte of a non-structure, s03 nodeclaration, s04 file field, s05 temporal subfield, s06 interface not emitted;
balances01 block not whole;failUndeclareds01;checkNamess01 without DIM, s02 elementoutside the dimension, s03 names no symbol, s04 is not declared.
On the committed twins, these never fire:
rpg_source.statement s01,rpg_source.translate s02,declare s01,declare s05,checkNames s02,checkNames s03.checkNames s04fires only onlr1-af-z50-200-blank.
Oracle round 2: checkNames s04, and why lr1g did not move it
The coordinator's oracle on lgd-debug2: on the two programs only
checkNames s04("the name X isnot declared") fires. The mechanism: a declaration refused by
declLine(the scalar path, whichincludes an array,
isStructureis false fore.arrays) as "longer than 100 bytes" is a failline written while the lines are written.
d.failureis never set, so neitherdeclarenorfailUndeclared(structures only) marks the statements.checkNamesthen finds the generatedname in the emitted text with no declaring line and writes the proof text, which starts with
CALL _QRNX_GET_DECIMAL_NUM(, plus a reason of about 31 bytes. The awk has no rule for the reason,so the label is the runtime family.
The one public twin with
checkNames s04, lr1-af-z50-200-blank (a structure ofzoned(5:0) dim(200) inz(1)andchar(10), declared on trunk as a whole-symbol array), already emits clean onlr1g (origin/lr1g
0daba11a, Debug build:dcl-ds A_00253; A_00253_F0 zoned(5:0) dim(200) inz(1); A_00253_G1000 char(10); end-ds;, statements 5, emitted 5, failures 0). lr1g did not move theheld-out declaration, so the held-out symbol is a scalar-path declaration that lr1g still
refuses. Candidates ranked:
ctdata, or elements that differ):lr1g keeps "the image of a whole array" refused. Battery cases
lgd-t-*.byte that is not invariant (hexadecimal at twice its length). Battery cases
lgd-a-*coverthe trunk limit only.
proved at a byte other than 0) and that lr1g's array subfield rule does not reach.
Loop-side note (not in this PR)
emit-families.awkhas no rule for thecheckNamesreasons "the name X is not declared" and"the name X names no symbol". A statement that
checkNamesfails keeps its proof text, so aruntime-call statement is classed "runtime or packed template statement / " and hides
that its cause is a declaration. The coordinator gives these reasons their own label in the loop.
lgd is rebased onto trunk
0daba11a(v0.1.487, lr1g merged); the%DECH(test of lr1g inruntimeSummarykeeps its site s15.Battery lgd/decnum on v0.1.487: negative for the held-out pair
The 24 captures (
captures/lgd-decnum, the t-* table renamedcodes: a name that starts with TABis a table, RNF0752) emitted with a v0.1.487 Debug build. No case fires
checkNames s04, and nodeclaration is refused:
CALL _QRNX_GET_DECIMAL_NUM(runtimeSummary s03checkNames s01S254.4 = ...(S254.4: no type): the targetarr(2)statement s05%UNSis written%DEC(F);%DECof a char subfield at byte 0 of a structure with more subfieldsRuled out as the held-out declaration (each emits its declaration on v0.1.487):
ctdataarray: declaredchar(200)with the image, not refused (it failsthe statements with
checkNames s01, another reason).What the oracle still requires: the symbol is refused by
declLineorstructureLinesas longerthan 100 bytes on v0.1.487, it is not a structure that
failUndeclaredreaches, and a statementnames it in its emitted text.
Second battery (proposal, not written)
At most 12 cases, each one
%DEC/%INTread of the symbol in an assignment (the form that emitsclean above):
characterLiteralwrites all of it inhexadecimal), 50, 90 and 150 bytes:
char(N) inz('... $ ...')orinz(x'..25..').char(1200) inz(...).%DECof the whole structureds(dcl-ds ds; a char(5) inz('00012'); b packed(9:2) inz(1); ...), with a mixed image over88 bytes, the
%dec(ds: 15: 0)form.ctdata(dim(40)with aposoverlaystart value, or
inzper element through a structuredim).varcharwith a long start value read by%INT, and abasedfield.Rule in this PR: a conversion as the argument of a procedure called as a statement
rpg_source_stmt.runtimeSummarytook an assignment or a RETURN as the final effect only. Aprocedure called as a statement (
callp showi(%int(...)),showi(...),callp showp(%dec(...: 7: 0))with a CONST packed parameter) ends inCALLP P(...), and the summary refused it (s03). Itnow takes
CALLPtoo; the other gates are unchanged. The five public captures (lgd-a-callp-int,-call-int, -callp-pk, lgd-t-callp, lgd-x-callp-plain) then emit, for example,
SHOWP(%DEC(%SUBST(A_00258: 4: 5): 7: 0));(lgd-t-callp still failscheckNames s01on itstable). Test:
src/rpg_lgd_test.zig(the CALLP summary, ands03still for a DSPLY final). Theround trip of these captures is the coordinator's.
Gates (Debug, base trunk
0daba11a, new lgd):twins-diff811 groups, 789 recovered, noregression, none newly recovered (an emitter-only change);
emit-diffno worse, no better, 571clean of 773 on both (no committed twin has the form; the gain is on the lgd-decnum captures).