rpg_source.zig, rpg_source_shared.zig, rpg_source_render_emit.zig, rpg_source_decl_emit.zig: the based structures of one length share one qualified template and are one likeds line each #799
Loading…
Reference in a new issue
No description provided.
Delete branch "lkds"
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.zig, rpg_source_shared.zig, rpg_source_render_emit.zig, rpg_source_decl_emit.zig: the based structures of one length share one
qualified templateand are onelikedsline eachThe object does not show the template, so the battery
requests/lkds/tmpl(24 compiles, captured 2026-11-14 incaptures/lkds-tmpl, 23 of 24:lkds-nest-wwas refused with RNF3222 RNF7031) decided what text is safe. Read against itsREADME (readout at the end of it):
likedsof a template is the structure written out (b1: a based structure; inzl: a staticone with
inz(*likeds): the same symbols and instructions), the name of the template numbers no symbol (name-first,name-last), and a structure symbol has word 28
0x80100000and flags0xe0000000with a pointer subfield and0x80010000and
0x60000000without one, in a based, an automatic and a static structure. My predictions failed in one way: every numberin a declaration is a constant of the object, so a template whose fillers have other widths than the structures written
out (b2-wp against b2-l, fill-typed against b2-l) changes the constant pool and the numbering of the symbols behind it, and
the opcodes stay the same. Because of that the rule shares a group only where the object proves the written-out text wrong
(below); any other group may match today and keeps its text.
The Async programs declare
dcl-ds t likeds(task_t) based(p);in every procedure. The emitter wrote each structure out, thesubfields a statement names and a filler for each gap. In asyncage 18 local structures took 100 emitted lines where the source
spends 18, so the declarations did not fit before the first statement (
declarations do not fit before source line 568).Now the based structures of one length that do not conflict are one template that holds the union of their proved subfields,
and each structure is one line:
The rule (
core/rpg_source_shared.zig, pure): a candidate is a structure with a pointer (based), qualified, with no initialvalue, no array, no decimal subfield, not
static, 16 bytes or longer, and at least one proved subfield. Candidates of onelength and one word 28 are put in groups in order of symbol; a candidate joins the first group whose union it does not conflict
with (the same byte has the same type and width; no two subfields overlap) and opens another group otherwise. A group of two or
more is kept when (1) its word 28 is
0x80100000(the object says a pointer subfield), (2) at least one member's provedsubfields hold no pointer (its written-out text is another symbol than the object's, so the program cannot match as it is), and
(3) the template and one line for each member are fewer lines than the members written out. A group in which every member holds
the pointer, or whose symbols say none, stays written out: it may match today, and the template changes its filler widths,
which are constants of the object. A member lacks the pointer that the object has, so the template gives it the pointer that
another member names; when none names one the template is no more wrong than the text it replaces. The name is
DSTMPL<length>, thenDSTMPL<length>_<n>: the parameter templateTMPL<length>(paramTemplates) keeps its name and layout.Everything else is as before: automatic and static structures, parameters, structures with an initial value, the fixed and the
mixed forms. The statements are unchanged:
NAME.F<offset>is a subfield of the template by construction. The plan is made atthe first call after
failUndeclared(fitGlobals), when the declarations are final.What the object shows (2026-11-13, v0.1.513, the six Async captures)
flags and words) are equal in all six programs (asyncage 1898 symbols and 54 procedures; asyncdemo 1998; asyncbg 1993;
asynccncl 1972; asyncprom 1972; asynctime 2030). A template has no symbol: asyncage has 32 symbols of 2182 bytes, one is a
constant, and the 31 data symbols are the 21 based structures (23 class 0 symbols with the 2 parameters) and the 8
automatic structures of the source, so none is left for
task_t.TASK_T,PTHREAD_T, ...)are found as cp037 strings in the image of the observable object (11 of 11 for asyncprom), none in the stripped one. They
are in the string pool, followed by their subfield names (
HANDLE,KIND, ...ERRTEXT), and alikedsstructure is abare name there. No reader of that data exists in
src/coreand the emitter reads the stripped object, so no emit canname
task_t; the synthetic nameDSTMPL2182is the answer where the object has no name.structure symbol is
0x80100000when the structure has a pointer subfield and0x80010000when it has none (a basedstructure of 20 bytes with
buf pointer, lext-based-ptr-c, against the structures of 8, 15 and 23 bytes with char,int(10) and packed of lv-based-read-int, lpar-lk-set-local and lv-sf-packed50). Host-measured on our own emit: the rebuilt
object of the v0.1.512 emit of asyncage (
runs/pub-l10-async-asyncage-173618/cases/1/capture, 13 based structures writtenout, 12 of them without a pointer subfield) has 14 symbols of 2182 bytes at
0x80010000and 1 at0x80100000, where theobject of the source has all 31 at
0x80100000(checked in the six Async programs). So the written-out text of a structurethat names no pointer cannot give the symbol of the object, in a program that cannot match for other reasons too, and the
shared template, which holds the
pointer(*proc)that one structure names, gives the word to every member (battery b2,a2, s2, b2t, twolen: the structure written out without the pointer has
0x80010000and flags0x60000000,0x70008000or
0x7000c000; thelikedsstructure and the one written with the pointer have0x80100000and0xe0000000,0xf0008000,0xf000c000). Only structures of one word 28 share a template. No object fact gives the subfields that nostatement names.
44 8, b2-w has 0 1 10 12 2 20 2081 2126 2182 3 4 92, fill-typed 0 1 10 1024 2 20 2182 3 4 7 8), and the symbols are
numbered behind them. The pool of asyncage holds 1024, 7, 20 and 2182 among 35 decimal constants and none of the filler
widths of the v0.1.513 emit (2178, 2170, 2080, ...): each is a constant that the object lacks, and the field widths of
task_t(1024, 7, 20) are in the pool and could be recovered from it, a next change.Measure (2026-11-14, emits of the stripped twins with v0.1.513 and with this branch)
(The four lengths of the 18 structures of asyncage: 2182 for the 13 based ones, and 272, 8, 8, 4, 4 bytes for the 5
automatic ones, which are alone or shorter than 16 bytes and stay written out. The 13 bodies are 13 partial views of one
2182-byte layout, 12 of them without the pointer. "Lines missing" is the
count of the lane ldfit (
Layout.missing,83a64769, not in the base of this branch), computed here from the receipt rows with the same rule:the count of the six programs before, 50, 50, 50, 50, 56, 50, is the one of the lane's table, so the same script gives the
"after" column. The six Async programs are one library: one sample, not six.) The statements, the emitted statements and the
failure lines of every program are equal (asyncage 584 / 309 / 278). The 5 or 11 lines that remain are the automatic
structures and the interfaces of procedures whose source has no structure there (
NEWTASK_00388 qualified; F0 int(10)),the next change; the battery pairs
lkds-a2andlkds-s2read like the based ones, so an automatic or a static structurewith a pointer in its symbol can take the same rule.
The distinct
char(n)widths of the emit that no integer constant of the original object has (each is a constant that theobject lacks, see above): asyncage 16 -> 7, asyncdemo 15 -> 7, asyncbg 15 -> 6, asynccncl 16 -> 7, asyncprom 17 -> 10,
asynctime 15 -> 7. The template has fewer distinct filler widths than the 13 structures written out had.
The coordinator's fact of 2026-11-13 (ldfit/place,
ldfit-m-s-mid): the compiler refuses a declaration after a statement ofthe cycle main (RNF0724), so for the main procedure a short emit is the only route; this change is that route for the
structures of a procedure. Whether a local procedure takes a declaration between statements is still being measured there.
Proof
src/rpg_shared_template_test.zig(registered insrc/root.zig): the planner (union with fillers, a conflict of type orof bytes keeps the structures written out, another word 28, a group is shared only where a member lacks the pointer of its
symbol (the object says none, or every member holds it: written out), a length under 16, a lone structure, a second layout
of one length is
DSTMPL<n>_2);ldsv-asyncprom(committed twin of the Async program asyncprom): exactly onedcl-ds DSTMPL2182 qualified template;, at least 13 lineslikeds(DSTMPL2182) based(, the template text, and everyNAME.F<n>of a shared structure is a subfield of the template. It is red on the base (expected 1, found 0, run againstthe unchanged core files) and green on the branch.
lv-qpair-int3(matches on the host): a lone based structure iswritten as before. The counts of statements, emitted statements and failures are not asserted: the
emit-allrows belowprove them and other lanes move them.
emit-all.shwith v0.1.513 and with this branch, 854 programs: one emit differs (ldsv-asyncprom,differentin thematrix); no matching twin changes; the summary line is equal (
failures928,emitted8422,clean593) and so arestatements,emittedandfailuresof every row.capture-emit-diff.shover the six Async captures and the 19 scout2captures: 6 changed (the Async programs), the 19 others
same, statements, emitted and failures equal in all 25, and nochanged head emit without a failure line. The five public development captures
captures/dev5/p1top5: 0 changed(the emits are byte-identical with both binaries;
dev-hash.shitself was not run, and the sealed ids and L10-test werenot read, so the L10-test direction is unknown here).
agree.shon the 25 (base and head):suspect82 and 82,same1463 and 1463,equivalent23 and 23; the declaration counters move as read:ds_emit122 -> 128,ds_sub_extra300 -> 76 (fewerfillers than the source has subfields),
ds_sub_missing220 -> 242 (the multiset of emitted subfield types is smallerwhere 13 structures became one template). WATCH, read: a count of subfield types, not a statement.
gate.shandpub-roundtrip.sh(no host; the coordinator runs them). The change adds no reader ofan operation number (
docs/OPERATIONS.mdis not touched) andrpg_statements.zigis not touched.Gate
9b9523979e43ab0ba17e