The statement readers accept thread-local static storage (touches rpg_eval.zig and rpg_source.zig) #778
Loading…
Reference in a new issue
No description provided.
Delete branch "lext"
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?
The statement readers accept thread-local static storage (touches rpg_eval.zig and rpg_source.zig)
Lane Lext. The first measure on code written by others (the L10 development
programs: one MIT-licensed code base,
l10-async-*, flattened into sixprograms, counted as one) showed that recovery generalises badly. Every static
data symbol of those programs has bit 0x100 set in its flag word (byte 24 of
the symbol):
0x7000c000is0x7000c100, the 288-byte frame area0xf800c000is0xf800c100. The sources sayctl-opt ... thread(*concurrent);the compiler keeps the static storage of such a module in thread-local
storage. The bit is on the static data symbols of the six programs, the compiler's own
areas included, except about a dozen of each program (asyncage: 12 data symbols;
its source has nine
static(*allthread)declarations; that the two are the samesymbols is an inference, the battery case
static-all-ctests it). It is on nostatic data symbol of the 781 public twins.
The families that stop recovery on the L10 development data
Counted on the six programs together (3,600 source statements; 1,227 recovered
before this change, 34 percent), by the stage of the first stop of each
statement that did not recover:
if/endif(condition_boundary,closing_destination),dow,end-proc(block_owner)mutexLock();,p = findTask(task);,settle(p: ...))returnof a value,pthread_create,CEE4RAGE;remaining_effectsafterend-procreturn *null(104),if t.resultBuf <> *null(8),dealloc(7)t.errMsgf = 'QCPFMSG *LIBL'944 of the 2,373 statements that did not recover carry the 30-operation call
frame (
27 29 5 75 42 27 37 ...) thatrpg_frames.frameproves. The frame isrefused because its areas are read by their flag word (
metadata,callInformation), and so is every other reader that names a static symbol byits flag word (
rpg_display,rpg_numeric,rpg_specs,rpg_monitor,rpg_reset,rpg_array_element,rpg_file_ops, the file readers). Thecontrol_flow stops follow: a block that holds an unresolved statement stays
open. One family, one rule: thread-local static storage.
The rule
crt.Symbol.flags()is the flag word without bit 0x100 of a static symbol(
thread_local_flag). The statement readers that comparedword(24)of astatic symbol with a constant use it:
rpg_frames(metadata,callInformation, the header and the name),rpg_calls,rpg_numeric,rpg_display(symbol, whichrpg_display_numericcalls),rpg_specs,rpg_spec_entry,rpg_monitor,rpg_reset,rpg_array_element,rpg_file_ops,rpg_file_defs,rpg_file_recon, andrpg_source_unused.sourceEnd.rpg_eval.spelledByDeclarationasks the newrpg_source_decl.sourceField: a field in thread-local storage is a field ofthe source (before, a
*1became*1.0and a group was added, measured with thebit set on
EXPERIMENTS/ftwin14-x1). The bit does not change what a readerproves about the bytes of a symbol: a thread-local static is a static.
Class 4 and 5 symbols (automatic, parameters) have no such bit and read as before.
The emitter does not follow.
rpg_source_decl.declaredkeeps the raw word, soa thread-local field still has no declaration, and
ctlOptaddsSOURCERER-FAIL THREAD(*CONCURRENT): the thread-local static storage has no emit rulewhen
rpg_source_decl.threadLocalStoragefinds the bit (the text has nothread(*concurrent)and nostatic(*allthread)yet). The readers now provethe statements; the text of such a module stays a refusal until the emitter
writes the two options.
rpg_eval.zigandrpg_source.zigare touched for thesetwo lines only.
Evidence and counter
Two existing tests flip each bit of the flag word of a symbol and expect a refusal
(
rpg_display.zig"display descriptors refuse ...",rpg_display_numeric_test.zig"numeric display refuses ..."). Bit 0x100 of a static symbol is no longer a
change, so on byte 26 of a static symbol they flip bit 0x200 instead.
No public twin is compiled with THREAD(*CONCURRENT), so the red test sets the
bit on the static data symbols of 25 public twins that recover without it and
asks for the same statements, text and status (
src/rpg_lext_test.zig). Beforethe rule, 457 of the 781 stripped twins (all the ones with a call, display,
monitor, file or loop statement) changed under the same mutation; after it, none
of the 25 does (a scan of all 781 gave 2 differences before the
sourceFieldchange, 0 after). The gates: twins 826 groups, 804 recovered, 0 regressions, 0
newly recovered; emit 816 rows, 0 worse, 0 better.
Counter, source statements recovered on the L10 development data (six programs,
Debug build,
sourcerer dump): 1,227 of 3,600 before; 1,490 of 3,449 after(34.1 percent, 43.2 percent). Joined per statement: 428 unresolved and 208
partial statements recover, 82 unresolved move to partial; 222 statements that
were
recoveredget worse, and 151 rows leave the source statements. All 373are statements whose operations are the store of the statement status
(
27 0; 35 R, shown asS677 = 0):DCL-PROClines,ENDIFandELSElines (and 6 copies of
tCancelThrown = *on;, whose text is as before but whose enclosing block now stays open: partial). Before,rpg_resetdid not find R in a thread-local module and thestore read as an assignment, so the baseline counted them as recovered
statements with a wrong text. Now R is known and the store is bookkeeping, as in
every other module: the
DCL-PROCline of a procedure that is not exportedis a declaration (151 rows left the source count; the twin
FLOW/lx-subprocshowsDCL-PROC BUMPthe same way), anENDIFand anELSEfollow the block they close (87 rows wait for the call statements insidethat stop on the status unit below), and the
DCL-PROCline of an exportedprocedure is refused (126 rows, see the next section). Like for like, the
baseline recovered 1,005 statements and the count is 1,490. The text of 103
newly recovered statements of asyncage was read against
source.rpgle(conditions on pointers and based fields, assignments,
leave,enddo,return): the operands are the ones of the source. Statements with a stop bystage: control_flow 1,434 to 753, type_inference 703 to 794, classification
47 to 217 (the status stores above), value_flow 155 and call 34 to 40. The
dev emit of the six programs (
savf rpgle): failures 535..576 to 421..450,emitted 55..62 to 170..187, one
THREAD(*CONCURRENT)failure line in each, noclean output. The family removed: the flag word of a static symbol. The public
twins turned: none (the mutation twins above only keep it from regressing).
What stops next, and the battery
517 of the statements that still do not recover end their call with a
different status unit:
99 P N 0 1; 6 1; 29 A 10 7; 37 A 15 7; 27 0; 35 R; 27 T; 37 A 10 7; 6 2, where the plain module has29 F 96 Q; 32 B 0 I2; 27 1; 7; 16 L; ...; 15 E(rpg_frames.status). It is in no public twin, so thereis no rule yet: the area A is the 429-byte static area, the field at 10 holds
a five-byte text that is copied to 15 and reset, and R (the call status) is set
to 0 without a test. Whether that holds for a call that can fail (
callp(e),monitor) is the question of the batteryrequests/lext/thread-call(24 cases, with plain controls,static(*allthread),thread(*serialize), the pointer comparison,return *null,%allocanddealloc). The next rule waits for its capture.Also next: a procedure with
exporthas symbol class 1, the class thatrpg_statements.recovertakes for the cycle main procedure (is_main). 26 ofthe 50 procedures of asyncage are exported. Their entry (
DCL-PROC) and theend are read as the main's, and stop with
statement_role. No public twinexports a procedure;
export-*of the battery are the three cases.Gates (ship.sh):
291c16b45cf37ef72974