Skip to content

Propagate native-root decisions to codegen-unit workers - #8071

Merged
proggeramlug merged 3 commits into
mainfrom
fix/8070-split-native-roots
Aug 14, 2026
Merged

Propagate native-root decisions to codegen-unit workers#8071
proggeramlug merged 3 commits into
mainfrom
fix/8070-split-native-roots

Conversation

@proggeramlug

@proggeramlug proggeramlug commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Summary

  • carry the producer-selected native-root backend explicitly into text and native codegen-unit workers
  • use one explicit value for RS4GC rewriting, assembly/compact-map planning, and finishing
  • make the split precise-root witness non-vacuous and add a shadow-stack negative worker arm

Local proof

Exact main base f9475fb, LLVM 22.1.4:

  • before: PERRY_CODEGEN_UNIT_JOBS=1 focused split native-root test fails; native object has no map while text has one
  • after: focused native_emit tests 4/4 pass with one codegen job
  • after: in-process RS4GC tests 2/2 pass; compile-plan tests 5/5 pass; focused perry-codegen cargo check passes
  • cargo fmt --all --check and git diff --check pass

No broad workspace test was used.

Closes #8070.
Refs #7966.

Summary by CodeRabbit

  • Bug Fixes
    • Fixed native root handling during split compilation so all workers consistently use the selected root backend.
    • Improved statepoint rewriting and compact GC-map generation for native-root builds.
    • Ensured native and shadow-stack compilation modes remain consistent across direct, split, and differential builds.
  • Tests
    • Expanded coverage for root-backend propagation, GC-map output, concurrent compilation, and native emission scenarios.

@coderabbitai

coderabbitai Bot commented Aug 14, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

No new commits to review since the last review.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: c1793b40-e7cf-4de6-99be-32f9588b2279

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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: 7ad3c528-fb77-4a8a-9de5-72597ad5ef97

📥 Commits

Reviewing files that changed from the base of the PR and between f9475fb and 11b61e5.

📒 Files selected for processing (7)
  • changelog.d/8071-split-native-root-workers.md
  • crates/perry-codegen/src/inprocess.rs
  • crates/perry-codegen/src/linker.rs
  • crates/perry-codegen/src/linker_temp_lifecycle_tests.rs
  • crates/perry-codegen/src/linker_tests.rs
  • crates/perry-codegen/src/native_emit.rs
  • crates/perry-codegen/src/native_root_coverage/mod.rs

📝 Walkthrough

Walkthrough

The codegen pipeline now captures the producer-selected native-roots backend and passes it through compile planning, LLVM emission, split workers, and fallback paths. Tests validate statepoint rewriting, compact GC-map output, shadow-stack behavior, and updated APIs.

Changes

Native-roots codegen propagation

Layer / File(s) Summary
Explicit compilation selection
crates/perry-codegen/src/inprocess.rs, crates/perry-codegen/src/linker.rs
Compilation and emission APIs now accept explicit native_roots and compact_gc_map values. Statepoint rewriting uses the propagated root mode.
Worker root-mode propagation
crates/perry-codegen/src/linker.rs, crates/perry-codegen/src/native_emit.rs
The producer thread captures the native-roots decision and passes it through sequential, parallel, direct-native, and differential codegen paths.
Root-mode regression coverage
crates/perry-codegen/src/native_emit.rs, crates/perry-codegen/src/linker_temp_lifecycle_tests.rs, crates/perry-codegen/src/linker_tests.rs, crates/perry-codegen/src/native_root_coverage/mod.rs, changelog.d/8071-split-native-root-workers.md
Tests cover compact GC-map detection, native and shadow-stack output, byte equality, lifecycle calls, compile-plan calls, and native assembly emission. The changelog records the fix.

Estimated code review effort: 4 (Complex) | ~45 minutes

Merge Risk: ⚪ Minimal · up to 11b61

The change explicitly propagates native-root decisions to codegen-unit workers and is supported by passing focused validation; no actionable merge-blocking risk remains beyond normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  participant Producer
  participant compile_units_to_object
  participant Worker
  participant optimize_and_emit_module
  Producer->>compile_units_to_object: select native_roots
  compile_units_to_object->>Worker: pass native_roots
  Worker->>optimize_and_emit_module: pass native_roots
  optimize_and_emit_module->>Worker: rewrite statepoints and emit GC map
Loading

Possibly related issues

  • PerryTS/perry issue 8065: Both changes modify the LLVM RS4GC pipeline, including statepoint processing.

Possibly related PRs

  • PerryTS/perry#8062: Both modify native LLVM codegen and split-worker paths for precise roots.
  • PerryTS/perry#7370: Both address explicit propagation of the native-roots decision through LLVM compilation.
  • PerryTS/perry#7653: Both modify native-root coverage and compact GC-map emission.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes satisfy issue #8070 by propagating native-root decisions, validating GC-map output, preserving a negative case, and testing with LLVM 22.1.4.
Out of Scope Changes check ✅ Passed The code, tests, and changelog entry directly support the linked issue objectives, with no unrelated changes identified.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Title check ✅ Passed The title clearly and concisely describes the main change: propagating native-root decisions to codegen-unit workers.
Description check ✅ Passed The description explains the change, related issues, and focused validation, but omits several template headings and checklist details.
✨ 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/8070-split-native-roots

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

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 14, 2026

Copy link
Copy Markdown
⚠️ Action not completed

Already reviewed.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@proggeramlug

Copy link
Copy Markdown
Contributor Author

Independent exact-head audit: APPROVE 11b61e5. The producer-selected native-root decision is carried coherently through text and native unit workers, RS4GC, compile planning, compact-map finishing, and non-split paths. The positive split arm requires a real platform map section plus PGCM payload on both objects before byte equality; the shadow negative proves the producer emits shadow binds and no addrspace(1) root, then requires both text and worker-native artifacts to have no map/payload and to match exactly. Local focused evidence is 4/4 native_emit tests, 2/2 in-process RS4GC tests, 5/5 compile-plan tests, cargo check, fmt, and diff check. CI was not used as correctness evidence. Changelog/closure scope are correct, no version bump, and CodeRabbit completed with zero review threads.

@proggeramlug
proggeramlug merged commit 601a02d into main Aug 14, 2026
35 of 55 checks passed
@proggeramlug
proggeramlug deleted the fix/8070-split-native-roots branch August 14, 2026 04:17
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.

Split native codegen workers lose native-roots backend decision and omit GC maps

1 participant