Skip to content

fix(codegen): keep emitted rodata symbols module-unique - #8054

Merged
proggeramlug merged 2 commits into
mainfrom
fix/8048-typed-parse-rodata
Aug 13, 2026
Merged

fix(codegen): keep emitted rodata symbols module-unique#8054
proggeramlug merged 2 commits into
mainfrom
fix/8048-typed-parse-rodata

Conversation

@proggeramlug

@proggeramlug proggeramlug commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • allocate typed-parse, V8-interop, and node-submodule rodata names from the existing module-wide lowering-site counter
  • cover the exact full-body $spec_i32 plus boxed-body collision that redefined @perry_typed_parse_keys_0
  • keep specialised ABI and schema-directed parsing enabled

Evidence

Scheduled failure: gc-parse-churn run 31737943472 / job 94574017539, head 3381e1b89048592cfc91f3d4a43349c6e7c16015.

Before this change, both emitted bodies restarted FnCtx::typed_parse_counter at zero and appended the same private global to one LLVM module. The regression now emits both bodies, requires two parse-schema globals, and asserts their symbol names are distinct.

Local verification (isolated target /Users/amlug/cargo-targets/red-gc-gates-sub):

  • exact PR-code unit regression: cargo test --profile perry-dev -p perry-codegen --test native_proof_regressions typed_parse_rodata_names_are_unique_across_spec_and_boxed_bodies -- --exact — 1 passed
  • raw product oracle from the exact fix(codegen): keep emitted rodata symbols module-unique #8054 change: the parse-churn subject compiled and ran with BLOB_BYTES 245781, PARSED_LENGTH 4000, CHURN_TOUCH 240000, MISMATCHES 0, exit 0, and a current-format non-in-place minor with copied_objects=183
  • cargo fmt --all -- --check
  • git diff --check

Scope note: the shipped #8054 wrapper alone still cannot print PARSE_CHURN_LAYOUT_GATE_OK, because its liveness parser only recognizes the obsolete copy-minor log format. The end-to-end wrapper success I observed used the separate #8049 parser fix in the committed audit tree. That parser change is intentionally excluded from this PR; the raw compile/output/exit and nonzero current-format collector evidence above validate this product fix without claiming the independent wrapper bug is fixed here.

The release archives and compiler were built together and their mtimes were verified before the end-to-end run.

Closes #8048.
Refs #7966.

@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: bfb74159-0585-4136-8609-7406a72c7d91

📥 Commits

Reviewing files that changed from the base of the PR and between a9a99d8 and 4a5712b.

📒 Files selected for processing (10)
  • changelog.d/8054-typed-parse-rodata-symbols.md
  • crates/perry-codegen/src/codegen/closure.rs
  • crates/perry-codegen/src/codegen/entry.rs
  • crates/perry-codegen/src/codegen/function.rs
  • crates/perry-codegen/src/codegen/method.rs
  • crates/perry-codegen/src/expr/instance_misc1.rs
  • crates/perry-codegen/src/expr/mod.rs
  • crates/perry-codegen/src/expr/strings.rs
  • crates/perry-codegen/src/expr/v8_interop.rs
  • crates/perry-codegen/tests/native_proof_regressions.rs
💤 Files with no reviewable changes (4)
  • crates/perry-codegen/src/codegen/function.rs
  • crates/perry-codegen/src/codegen/closure.rs
  • crates/perry-codegen/src/codegen/method.rs
  • crates/perry-codegen/src/codegen/entry.rs

📝 Walkthrough

Walkthrough

The change replaces the per-function typed-parse counter with the module-wide ic_site_counter for rodata symbol generation. It removes obsolete context initialization and adds regression coverage for specialized and boxed typed-parse bodies.

Changes

Typed-parse rodata symbol uniqueness

Layer / File(s) Summary
Replace per-function counter
crates/perry-codegen/src/expr/mod.rs, crates/perry-codegen/src/codegen/*.rs
FnCtx no longer stores typed_parse_counter, and function, method, closure, and entry-module contexts no longer initialize it.
Use module-wide rodata identities
crates/perry-codegen/src/expr/instance_misc1.rs, crates/perry-codegen/src/expr/strings.rs, crates/perry-codegen/src/expr/v8_interop.rs
Typed JSON parsing, string literals, and V8 interop call emitters use ic_site_counter for generated identifiers.
Validate specialized and boxed emission
crates/perry-codegen/tests/native_proof_regressions.rs, changelog.d/8054-typed-parse-rodata-symbols.md
A regression fixture and test verify unique typed-parse LLVM globals across specialized and boxed bodies. The changelog records the fix.

Estimated code review effort: 2 (Simple) | ~10 minutes

Mergeability Score: ⚪ Minimal · up to 4a571

This change makes emitted read-only-data symbols unique within a module and adds regression coverage for the collision case; no actionable merge-blocking risk remains after normal checks and review.

Suggested labels: bug

Suggested reviewers: thehypnoo, jdalton

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes satisfy issue #8048 by using a module-wide counter, adding specialised and boxed regression coverage, and preserving specialised ABI and typed parsing.
Out of Scope Changes check ✅ Passed The code, regression test, and changelog entry directly support the linked issue and PR objectives; no unrelated changes are evident.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title clearly identifies the main code generation fix: making emitted rodata symbols unique at module scope.
Description check ✅ Passed The description explains the fix, regression coverage, linked issues, and verification results, but uses Evidence instead of the template's Changes and Test plan headings.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/8048-typed-parse-rodata

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@proggeramlug
proggeramlug marked this pull request as ready for review August 13, 2026 22:10
@proggeramlug

Copy link
Copy Markdown
Contributor Author

Independent audit of exact head 4a5712ba526229f36e581d2dcf5e4e8b9bd4b9fc: mergeable.

I audited the complete source diff and a clean landing merge onto current main (fe0d49792). The old counter reset for each emitted function body; the replacement starts from LlModule::ic_counter, advances for every rodata/IC site, and writes the end value back before the next body. The typed-parse, V8, and Node-submodule symbol prefixes remain disjoint. There are no version/Cargo/package changes, no unresolved review threads, and git diff --check plus cargo fmt --all -- --check pass.

Independent isolated optimized regression on the landing tree:

typed_parse_rodata_names_are_unique_across_spec_and_boxed_bodies ... ok
1 passed; 0 failed

The exact product oracle also compiled and ran the real parse-churn subject with correct output, exit 0, seven copying minors, and a current-format non-in-place minor reporting copied_objects=183. The wrapper's red result is separately explained by #8049: its stale parser misreads that nonzero line as zero. I did not use CI status as evidence for or against this product fix.

Disposition: merge exact head; close #8048; keep #7966/#8049 open.

@proggeramlug

Copy link
Copy Markdown
Contributor Author

Independent audit of exact head : mergeable.\n\nI audited the complete source diff and a clean landing merge onto current (). The old counter reset for each emitted function body; the replacement starts from , advances for every rodata/IC site, and writes the end value back before the next body. The typed-parse, V8, and Node-submodule symbol prefixes remain disjoint. There are no version/Cargo/package changes, no unresolved review threads, and plus pass.\n\nIndependent isolated optimized regression on the landing tree:\n\n\n\nThe exact product oracle also compiled and ran the real parse-churn subject with correct output, exit 0, seven copying minors, and a current-format non-in-place minor reporting . The wrapper's red result is separately explained by #8049: its stale parser misreads that nonzero line as zero. I did not use CI status as evidence for or against this product fix.\n\nDisposition: merge exact head; close #8048; keep #7966/#8049 open.

@proggeramlug
proggeramlug merged commit 471f650 into main Aug 13, 2026
31 of 57 checks passed
@proggeramlug
proggeramlug deleted the fix/8048-typed-parse-rodata branch August 13, 2026 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Typed-parse rodata globals collide across specialised and boxed function bodies

1 participant