A procedure keeps its constant-area binding through reloads and exit paths #660

Manually merged
binjovi-bot merged 1 commit from rpg-9-ay-binding-reload-20261029 into trunk 2026-10-29 04:57:57 +00:00
Owner

A procedure keeps its constant-area binding through reloads and exit paths

constant_references.bindingLoad proves that r28 holds the constant area in
a procedure: loaded from the activation's slot in the prologue, and written
again only by the final stack restore near the end. A procedure that writes r28
anywhere else proved no pointer at all, and the constant area of its twin
differed in every relocated code pointer.

Three writes now keep the binding:

  • the same binding load again (ld r28, slot(r2));
  • a write on an exit path: straight-line code that no branch enters up to a
    blr or blrl, with the fixed LIC calls of an epilogue allowed
    (multi-exit-full: a return in the middle of a procedure has an epilogue of
    its own that restores r28; the register may also be reused after its last
    use on the way out);
  • words after an unconditional transfer that nothing enters, which may be data
    that decode as any instruction (the end of a procedure).

The pointer matchers skip an exit path up to the next instruction that a
branch or a constant-area pointer enters. A unit test of bindingLoad pins the
four shapes (an exit-path reuse, a write followed by a branch back into the
body, refused, an epilogue in the middle, dead words after a branch);
multi-exit-full shows the middle epilogue, but its linear main is outside the
comparison (creation-data procedures differ from the procedure table).

Diagnostics in sourcerer --json compare counts, per side:
constant_area_unbound_procedures (procedures that load the constant area but
whose binding is refused), constant_area_unbound_reason (the refusal of the
first: 1 entry, 2 late, 3 prologue_flow, 4 early_write, 5 overwritten,
6 tail_branch, 7 entered, 8 no_load) and constant_area_unbound_detail (its
instruction's primary and extended opcode and distance from the procedure end).
The held-out exam had two refused procedures (5, an lwa r28 28 bytes before
the end); with this change its constant area is equal and the verdict is
match_except_file_identity (local build).

Gates

{"checks":{"net_statements":0},"census":{"statuses":{"recovered":645,"partial":0,"unresolved":0},"regressions":0,"newly_recovered":0},"golden":"golden 173/5/0 == dump 173/5/0","emit":{"worse":[],"better":47,"newly_clean":47,"clean_delta":47,"base":215,"new":262},"twins":{"groups":457,"recovered":449,"regressions":[],"newly":34},"allgroups":{"regressions":[],"newly":["rpg-corpus-captures/files-chain/stripped/object.savf 2","rpg-corpus-captures/files-display-write/stripped/object.savf 2","rpg-corpus-captures/files-logical/stripped/object.savf 2","savf/SC-CONSTRUCT/POINTER/rpg-pointer-procedure-auto/stripped/archive.savf 1","savf/SC-ILE/DSPLY/error-observable/archive.savf 2","savf/SC-ILE/DSPLY/error-stripped/archive.savf 2","savf/SC-ILE/DSPLY/stripped/archive.savf 2","savf/SC-ILE/EXPERIMENTS/d4-edit/stripped/object.savf 3","savf/SC-ILE/EXPERIMENTS/d4-editc-codes/stripped/object.savf 16","savf/SC-ILE/EXPERIMENTS/d4-out-const/stripped/object.savf 1","savf/SC-ILE/EXPERIMENTS/d4-out-input/stripped/object.savf 1","savf/SC-ILE/EXPERIMENTS/d4-srcstmt-dspf/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/d7-args/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/d7c-copy/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/decimal-fault-report/stripped/archive.savf 1","savf/SC-ILE/EXPERIMENTS/decimal-sign-report/stripped/archive.savf 1","savf/SC-ILE/EXPERIMENTS/fmtind-j1/stripped/object.savf 1","savf/SC-ILE/EXPERIMENTS/fmtind-j2/stripped/object.savf 1","savf/SC-ILE/EXPERIMENTS/fmtind-j3/stripped/object.savf 1","savf/SC-ILE/EXPERIMENTS/format-base/stripped/archive.savf 2","savf/SC-ILE/EXPERIMENTS/format-rename/stripped/archive.savf 2","savf/SC-ILE/EXPERIMENTS/gotos-static/stripped/archive.savf 2","savf/SC-ILE/EXPERIMENTS/h-editc/stripped/object.savf 17","savf/SC-ILE/EXPERIMENTS/h-editc3/stripped/object.savf 24","savf/SC-ILE/EXPERIMENTS/h-editc5/stripped/object.savf 1","savf/SC-ILE/EXPERIMENTS/h-editc6/stripped/object.savf 1","savf/SC-ILE/EXPERIMENTS/h-fmix/stripped/object.savf 11","savf/SC-ILE/EXPERIMENTS/h-subind/stripped/object.savf 1","savf/SC-ILE/EXPERIMENTS/packed-add-report/stripped/archive.savf 1","savf/SC-ILE/EXPERIMENTS/packed-compose-report/stripped/archive.savf 2","savf/SC-ILE/EXPERIMENTS/packed-compose-sign-report/stripped/archive.savf 2","savf/SC-ILE/EXPERIMENTS/program-literal/stripped/archive.savf 1","savf/SC-ILE/EXPERIMENTS/r5b-onexit-for/stripped/archive.savf 2","savf/SC-ILE/EXPERIMENTS/r5e-date-field/stripped/archive.savf 1","savf/SC-ILE/EXPERIMENTS/r5e-editc-held/stripped/archive.savf 1","savf/SC-ILE/EXPERIMENTS/r5i-figurative/stripped/archive.savf 1","savf/SC-ILE/EXPERIMENTS/r6a-float-inz/stripped/object.savf 1","savf/SC-ILE/EXPERIMENTS/r6a-reset-ds/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6a-reset-fixed/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6a-reset-two/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/shared-io-full/stripped/archive.savf 2","savf/SC-ILE/EXPERIMENTS/shared-io-none/stripped/archive.savf 2","savf/SC-ILE/MONITOR/limits-observable/archive.savf 1","savf/SC-ILE/MONITOR/limits-stripped/archive.savf 1","savf/SC-ILE/MONITOR/stripped/archive.savf 2","savf/SC-ILE/TSTRIP-STRIPPED/archive.savf 2","savf/SC-ILE/TSTRIP/archive.savf 2"],"worse":[]},"full_check":{"exit":0,"seconds":775}}
# A procedure keeps its constant-area binding through reloads and exit paths `constant_references.bindingLoad` proves that r28 holds the constant area in a procedure: loaded from the activation's slot in the prologue, and written again only by the final stack restore near the end. A procedure that writes r28 anywhere else proved no pointer at all, and the constant area of its twin differed in every relocated code pointer. Three writes now keep the binding: - the same binding load again (`ld r28, slot(r2)`); - a write on an exit path: straight-line code that no branch enters up to a `blr` or `blrl`, with the fixed LIC calls of an epilogue allowed (multi-exit-full: a `return` in the middle of a procedure has an epilogue of its own that restores r28; the register may also be reused after its last use on the way out); - words after an unconditional transfer that nothing enters, which may be data that decode as any instruction (the end of a procedure). The pointer matchers skip an exit path up to the next instruction that a branch or a constant-area pointer enters. A unit test of `bindingLoad` pins the four shapes (an exit-path reuse, a write followed by a branch back into the body, refused, an epilogue in the middle, dead words after a branch); multi-exit-full shows the middle epilogue, but its linear main is outside the comparison (creation-data procedures differ from the procedure table). Diagnostics in `sourcerer --json compare` counts, per side: `constant_area_unbound_procedures` (procedures that load the constant area but whose binding is refused), `constant_area_unbound_reason` (the refusal of the first: 1 entry, 2 late, 3 prologue_flow, 4 early_write, 5 overwritten, 6 tail_branch, 7 entered, 8 no_load) and `constant_area_unbound_detail` (its instruction's primary and extended opcode and distance from the procedure end). The held-out exam had two refused procedures (5, an `lwa r28` 28 bytes before the end); with this change its constant area is equal and the verdict is `match_except_file_identity` (local build). ## Gates ``` {"checks":{"net_statements":0},"census":{"statuses":{"recovered":645,"partial":0,"unresolved":0},"regressions":0,"newly_recovered":0},"golden":"golden 173/5/0 == dump 173/5/0","emit":{"worse":[],"better":47,"newly_clean":47,"clean_delta":47,"base":215,"new":262},"twins":{"groups":457,"recovered":449,"regressions":[],"newly":34},"allgroups":{"regressions":[],"newly":["rpg-corpus-captures/files-chain/stripped/object.savf 2","rpg-corpus-captures/files-display-write/stripped/object.savf 2","rpg-corpus-captures/files-logical/stripped/object.savf 2","savf/SC-CONSTRUCT/POINTER/rpg-pointer-procedure-auto/stripped/archive.savf 1","savf/SC-ILE/DSPLY/error-observable/archive.savf 2","savf/SC-ILE/DSPLY/error-stripped/archive.savf 2","savf/SC-ILE/DSPLY/stripped/archive.savf 2","savf/SC-ILE/EXPERIMENTS/d4-edit/stripped/object.savf 3","savf/SC-ILE/EXPERIMENTS/d4-editc-codes/stripped/object.savf 16","savf/SC-ILE/EXPERIMENTS/d4-out-const/stripped/object.savf 1","savf/SC-ILE/EXPERIMENTS/d4-out-input/stripped/object.savf 1","savf/SC-ILE/EXPERIMENTS/d4-srcstmt-dspf/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/d7-args/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/d7c-copy/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/decimal-fault-report/stripped/archive.savf 1","savf/SC-ILE/EXPERIMENTS/decimal-sign-report/stripped/archive.savf 1","savf/SC-ILE/EXPERIMENTS/fmtind-j1/stripped/object.savf 1","savf/SC-ILE/EXPERIMENTS/fmtind-j2/stripped/object.savf 1","savf/SC-ILE/EXPERIMENTS/fmtind-j3/stripped/object.savf 1","savf/SC-ILE/EXPERIMENTS/format-base/stripped/archive.savf 2","savf/SC-ILE/EXPERIMENTS/format-rename/stripped/archive.savf 2","savf/SC-ILE/EXPERIMENTS/gotos-static/stripped/archive.savf 2","savf/SC-ILE/EXPERIMENTS/h-editc/stripped/object.savf 17","savf/SC-ILE/EXPERIMENTS/h-editc3/stripped/object.savf 24","savf/SC-ILE/EXPERIMENTS/h-editc5/stripped/object.savf 1","savf/SC-ILE/EXPERIMENTS/h-editc6/stripped/object.savf 1","savf/SC-ILE/EXPERIMENTS/h-fmix/stripped/object.savf 11","savf/SC-ILE/EXPERIMENTS/h-subind/stripped/object.savf 1","savf/SC-ILE/EXPERIMENTS/packed-add-report/stripped/archive.savf 1","savf/SC-ILE/EXPERIMENTS/packed-compose-report/stripped/archive.savf 2","savf/SC-ILE/EXPERIMENTS/packed-compose-sign-report/stripped/archive.savf 2","savf/SC-ILE/EXPERIMENTS/program-literal/stripped/archive.savf 1","savf/SC-ILE/EXPERIMENTS/r5b-onexit-for/stripped/archive.savf 2","savf/SC-ILE/EXPERIMENTS/r5e-date-field/stripped/archive.savf 1","savf/SC-ILE/EXPERIMENTS/r5e-editc-held/stripped/archive.savf 1","savf/SC-ILE/EXPERIMENTS/r5i-figurative/stripped/archive.savf 1","savf/SC-ILE/EXPERIMENTS/r6a-float-inz/stripped/object.savf 1","savf/SC-ILE/EXPERIMENTS/r6a-reset-ds/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6a-reset-fixed/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6a-reset-two/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/shared-io-full/stripped/archive.savf 2","savf/SC-ILE/EXPERIMENTS/shared-io-none/stripped/archive.savf 2","savf/SC-ILE/MONITOR/limits-observable/archive.savf 1","savf/SC-ILE/MONITOR/limits-stripped/archive.savf 1","savf/SC-ILE/MONITOR/stripped/archive.savf 2","savf/SC-ILE/TSTRIP-STRIPPED/archive.savf 2","savf/SC-ILE/TSTRIP/archive.savf 2"],"worse":[]},"full_check":{"exit":0,"seconds":775}} ```
A procedure keeps its constant-area binding through reloads and exit paths
All checks were successful
binjovi/ci Binjovi completed the frozen plan
ee5b4ef971
bindingLoad refused a procedure that wrote r28 anywhere but the final stack
restore, so its code proved no pointer and a relocated twin differed in its
constant area. A reload of the binding, a write on an exit path (straight
line to blr/blrl, epilogue LIC calls allowed) and words after an
unconditional transfer that nothing enters now keep it; the matchers skip
exit paths. compare reports the refused procedures, the first refusal and its
instruction form. A unit test pins the four shapes; the held-out exam's
constant area becomes equal (local build).
binjovi-bot manually merged commit ee5b4ef971 into trunk 2026-10-29 04:57:57 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
sean/sourcerer!660
No description provided.