PR11.23h auto-snapshot shared call arguments#326
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 11a045cfca
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Pull request overview
Extends the Ada emitter’s shared-read snapshotting so volatile shared getter calls are automatically hoisted into per-statement snapshot locals not only in conditions, but also in assignment RHS and call-argument contexts (including nested calls and print), addressing #287.
Changes:
- Generalize the shared-condition snapshot replacement pipeline to work from pre-rendered statement images (call/print/assignment RHS).
- Apply shared snapshot wrapping to standalone calls,
print, and multiple assignment RHS emission paths. - Add a new build fixture covering compound conditions plus flat/nested shared getter call arguments; update proof/docs inventories and emitted Ada snapshots.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
compiler_impl/src/safe_frontend-ada_emit-statements.adb |
Generalizes snapshot replacement to operate on pre-rendered images and wraps call/print/assignment RHS statements with snapshot declare blocks as needed. |
tests/build/pr1123h_shared_call_argument_snapshot_build.safe |
New regression fixture for #287 covering compound conditions, flat call args, nested call args, and print. |
scripts/_lib/proof_inventory.py |
Adds the new PR11.23h fixture to the proof-expansion fixture manifest. |
docs/roadmap.md |
Documents PR11.23h scope and constraints (statement-context insertion point, per-root snapshot discipline). |
docs/emitted_output_verification_matrix.md |
Adds verification-matrix entry for the new shared call-argument snapshot surface. |
tests/emitted_ada_snapshot.json |
Updates emitted Ada snapshot hashes and adds snapshot entries for the new fixture. |
README.md |
Updates proved fixture/test corpus counts to reflect the new fixture. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
PR11.23h reviewOverall the implementation is correct and consistent with the existing snapshot-replacement discipline. All claimed validation passes. A few items worth flagging: Snapshot churn in pre-existing shared fixtures
Float narrowing: snapshot collection root vs. base image rootIn
|
|
Addressed in 609dc87. The roadmap now explicitly notes the adjacent shared-wrapper fixtures whose emitted hashes are refreshed by the generalized assignment/call snapshot pass, and the follow-up fixes cover the float-narrowing source/root alignment plus the explicit rendered-image flag. Local pre-push hook passed: 1044 tests passed, 19 samples passed, and 265 proofs passed. |
PR11.23h ReviewOverall: correct approach, no logic bugs found. One implementation detail worth verifying. What was checked
Item to verifySee inline comment on |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
PR11.23h Review The core design is sound: reusing Collect_Shared_Condition_Snapshots / Apply_Shared_Condition_Replacements as a pre-rendering filter across assignment RHS, call arguments, and print is correct, and the one-snapshot-per-shared-root-per-statement discipline is preserved. Three issues:
|
Review: PR11.23h shared call-argument snapshotOverall the refactor is structurally correct and the split of the old Emitted Ada churn on |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Review: PR11.23h shared call-argument snapshotOverall: the generalization of the snapshot replacement pass into assignment RHS and standalone call-argument contexts is structurally sound. The collector/replacer split, the pruning pass in Emitted Ada hash churn — intentional and correctly documented. Five existing fixtures ( Two items to address:
No other correctness issues found. |
Review: PR11.23h shared call-argument snapshotThe overall approach is sound — reusing Two issues flagged inline: 1. Print path: post-render validation order ( 2. No correctness defects in the snapshot pruning logic, |
Review: PR11.23h shared call argument snapshotThe generalization of the shared-condition snapshot pass into assignment RHS and call-argument contexts is structurally sound, and the pruning logic in CorrectnessDead guard in Impure image functions (lines 3242, 3264). Minor / efficiencyDouble snapshot collection for print (lines 3885–3900). Ada/SPARK stdlib
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Review: PR11.23h shared call-argument snapshot The structural approach is sound — reusing the existing shared-condition snapshot collector in call-argument and assignment-RHS contexts is the right abstraction, and the copy-back index-temp split correctly avoids snapshotting the mutable write-back prefix. Two correctness concerns: [1] Type coercion dropped in copy-back init The old copy-back path initialized the temp with Render_Expr_For_Target_Type (..., Formal.Type_Info, State), which applies Ada type conversions based on the formal parameter declared type. The replacement Growable_Indexed_Element_Image calls .Element (...) directly without consulting Formal.Type_Info. The new fixture exercises small_value -> small_value (same type), so this gap does not surface there, but if any copy-back formal has a different type than the array element type, the emitted initialization will be missing the explicit Ada conversion and may not prove at level 2. [2] Missing Require_Shared_Value_Replacements in wide-integer and explicit-float-narrowing assignment branches The stable float interpolation branch calls Require_Shared_Value_Replacements before rendering, turning image/collector mismatches into immediate internal errors. The wide-integer (Is_Wide_Name) and explicit-float-narrowing (Is_Explicit_Float_Narrowing) branches call Render_Shared_Value_From_Image directly — silently pruning replacements not found in the rendered image via Apply_Shared_Condition_Replacements. If Render_Wide_Expr produces a different string for a getter call than what Collect_Shared_Condition_Snapshots records as Call_Image, the volatile read survives into the emitted Ada and the error defers to GNATprove instead of failing at emit time. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Review: PR11.23h auto-snapshot shared call argumentsThe generalization of the shared-condition snapshot pass into assignment RHS and call argument contexts is structurally sound. Snapshot collection, pruning via Three issues worth addressing before merge: 1.
2.
3. The call at line 3597 uses |
PR11.23h reviewOverall the implementation is correct. The snapshot-collect/validate/apply pipeline is consistent across all five new sites (assignment wide, assignment narrowing, stable-float interpolation, standalone call, print). The copy-back path correctly restricts snapshot collection to the index expression only and guards against shared-rooted copy-back prefixes. Three things worth attention:
|
Summary
printpr1123h_shared_call_argument_snapshot_build.safecovering the original Auto-snapshot all shared field reads in compound expressions to eliminate interfering-context rejections #287 compound-condition shape plus flat and nested shared getter call argumentsPre-change failure evidence
Before the emitter change, the new fixture shape failed at level 2 with GNATprove volatile-call diagnostics:
Validation
alr buildpython3 scripts/safe_cli.py prove --level 2 tests/build/pr1123h_shared_call_argument_snapshot_build.safepython3 scripts/snapshot_emitted_ada.py --checkafter regenerating snapshotspython3 scripts/run_tests.py(1044 passed, 1 skipped, 0 failed)python3 scripts/run_samples.py(19 passed, 0 failed)python3 scripts/run_proofs.py(265 proved, 0 failed)Closes #287