sourcerer compare reads the two static frames of a thread(*concurrent) module with static(*allthread) fields #795
Loading…
Reference in a new issue
No description provided.
Delete branch "lcmp2"
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?
sourcerer comparereads the two static frames of a thread(*concurrent) module with static(*allthread) fieldsLane Lcmp, change 2, stacked on
lcmp(86666a07, the sites of anunsupported_layoutrefusal). The changetouches none of
rpg_source.zig,rpg_eval.zig,rpg_statements.zigor the golden test. It accepts one newlayout, a module of two static frames, and nothing else: the three refused
lexttwins and the six publicAsync programs now compare. A layout that is not in a public object is still refused, with a site.
What changes
The comparer assumed one static frame in four places. All four read the frame count at activation +56 and the
frame headers (80 bytes each, one after the other) from the pointer at +48.
compare_ile.staticDatareads every frame (staticFrame). At most two frames (max_static_frames): thethread-local frame (header +4 = 0x20000), then the plain frame (0x10000). The size of every frame is read
first, because a construction row names the frame of its target.
zero tail (the Async programs: the plain frame of 82064 to 82112 bytes, the record
0, 0x14000, 0xb0 or 0x80, 0); the first frame has none. The record is hashed instead of the pointer, which differs between anobservable and a stripped twin. The second frame has no construction and no pointer initializer in any public
object: it has none here (
static_second_frame_rows).0x81000001 (the second): the thread-local frame of the Async programs points into the plain one. The target
is bounded by the size of the frame that the word names; the place of the pointer by its own frame.
compare_ile.relocationData: with two frames, the row of type 0x0c names frame 1 and the row of type 0names frame 2, once each, and the header counts +60 and +68 are 1 each. The offset of a row is bounded by
the frame it names.
constant_references.initialPointersreads the pointer initializers of every frame, andconstant_references.tablesproves the table atstatics + 24(16-byte rows: the records of the frames witha zero tail), at most as many rows as frames. Without it one 8-byte address in the constant area stayed exact
and an observable twin differed from its stripped twin in
constant_areaonly.Fail-closed: more than two frames (
static_frame_count), two frames that are not thread-local then plain(
static_frame_flags), a header +8 and +16 that disagree or a record on the first frame(
static_frame_record), pointer constructions or initializers in the second frame(
static_second_frame_rows), a construction row word other than the two (static_construction_word), atarget beyond its frame (
static_construction_target), a frame size outside 1 byte to 16 MiB(
static_frame_size, as before) refuse with their site;a relocation row, count or ordinal that does not fit the frames is
InvalidRelocation(
unsupported_relocation), and a table at +24 with more rows than frames isUnsupportedRelocation. A moduleof one frame is read as before: its row words, header bytes (+8 and +16 are hashed raw) and relocation rows
are not newly checked, so that no verdict of a single-frame object moves. The five new sites are in
docs/COMPARISON.md, which also carries the refusal line and the JSON key of change 1 and a section"Static frames".
Tests
Red first, in
compare_site_test.zig(no decompiler, run byship-unit.sh): with the sites added andstaticDataas it was, 6 of 11 failed (the three refused twins still refused, the third frame, the frameflags, the record and the construction rows named no site). Green after the change. In the Build image, with
compare_ile.zigandconstant_references.zigof change 1 under the tests of this change, 10 tests fail: thefour of
compare_frames_test.zigand six ofcompare_site_test.zig.lexttwo-frame twins: no refusal, and the hash of the stripped object equals the hash of theobservable one (the addresses differ); another program is another hash;
+8 = 2, +8 = 0 with a record, +8 = 1 without a record, +8 = 1 or a record on the first frame:
static_frame_record; a module of one frame with +8 = 2 and a +16 pointer is not refused (its header ishashed raw, as before);
static_second_frame_rows;(target 3087 / 63 accepted, 3088 / 64 refused with the target), and five other words are refused with the
word.
compare_frames_test.zigcollects whole objects, so it needs the decompiler.build.zigruns it as a root ofits own (
ship-unit.shleaves a file thatbuild.zignames to the full check, asdump_test.zig):the observable and the stripped twin of each of the three programs match, each matches itself, and they differ
from each other and from a one-frame program; a third frame (
static_frame_count), one frame where the rowsand counts say two, a thread-local row naming frame 2 or a plain row naming frame 1 or 3, +60 = 0, +68 = 2,
two rows of one type, and a row at the end of frame 2 are refused; a table at +24 that copies the frame index
table (two rows) is proved, and the twins still match, while one that copies the table of initial byte ranges
(seven rows) is
UnsupportedRelocation.Sweep of the committed twins (base = the change-1 binary)
The same 2418 comparisons as in change 1 (1718 committed
*.savf, 1669 programs; each program with itself andeach observable twin with its stripped twin; dumps made with the base binary) with the change-1 binary
(
runs/sourcerer-lcmp/out/bin/sourcerer) and the change-2 binary. Moved rows: 9, none other.lext-static-all-c,lext-allthread-local-c,lext-allthread-local-noinz-c: the stripped and the observable object against itself (6), and the observable against the stripped twin (3)The other 2409 rows have the same exit code, result, reason, different components, counts and hashes
(the whole JSON). No row moved from
matchto another verdict.The six Async programs
Against itself and the observable against the stripped twin (captures
l10-pgm-a1/*,l10-pgm-a2/*):match,no different component,
constant_area_unproved_pointers0, all six (asyncprom included). Each originalagainst its rebuilt object (
runs/pub-l10-async-<id>-11*/cases/1/ref/dump/<NAME>.PGMagainstcases/1/capture/stripped):differentfor the five that compile, ininstructions,control_flow,creation_instructions,symbols,types,literals,constant_area,initialization,imports,exportsandrelocations(asyncage also inattributes), and incompilation, which is reported and neverdecides. Before this change they were
refused. asyncprom does not compile: no rebuilt object.What the tests do not cover
No committed object has a table at +24, a record behind header +16, or a construction row in a module of two
frames: the accept path of these three is tested on crafted copies of committed twins (a copy of the frame
index table as the table at +24, a record written over chunk data, a row written over chunk data) and, as the
real thing, by the CLI on the six Async captures (public, in the data tree, not committed).
Not done
The request
requests/lcmp/frames-twois not run (no host job). Which source shapes give the second frameits record, the table at +24 and the cross-frame row word is still read from six programs: a shape of a module
of two frames that no public object has is refused, not guessed.
Gate
464c6c94e8a0c6ac6f71