|
| 1 | +### Codegen: pin the GC strategy onto the define line, in both root lowerings (#7982 follow-up) |
| 2 | + |
| 3 | +#7998 made `LlFunction::define_header` the single renderer of the `define … {` |
| 4 | +line, after the in-process native path's private copy silently lost |
| 5 | +`gc "statepoint-example"` — a natively-constructed module then got no RS4GC |
| 6 | +pass and therefore **no precise roots at all**, while verifying, linking and |
| 7 | +running correctly on any program that does not collect. |
| 8 | + |
| 9 | +The test that shipped with it does not actually pin that property, and the two |
| 10 | +attempts to fix it failed the same way the original bug did. Recorded because |
| 11 | +it is this change's own bug class occurring inside its own test: |
| 12 | + |
| 13 | +1. The `to_ir` == `define_header` agreement test **cannot** see a dropped |
| 14 | + strategy: with one shared renderer both sides change identically. Sabotage |
| 15 | + passed. |
| 16 | +2. A dedicated strategy test that branched on `native_stack_roots_enabled()` |
| 17 | + never ran its ON arm under `cargo test` — no module has called |
| 18 | + `set_native_roots_for_target`, so the predicate is false in the test |
| 19 | + process. Sabotage passed again. |
| 20 | +3. Only pinning **both** lowerings with `NativeRootsPin::{native,shadow}`, and |
| 21 | + asserting `stack_map_slot_count` in each arm first so neither can pass |
| 22 | + vacuously, goes red on the sabotage. |
| 23 | + |
| 24 | +Native-roots must take the stack-map path AND name the strategy; shadow-stack |
| 25 | +must not take it AND must not name the strategy. The tests live in |
| 26 | +`function.rs`, which compiles WITHOUT the `llvm-inprocess` feature, so they run |
| 27 | +in per-PR `cargo-test` rather than only in the feature job. |
| 28 | + |
| 29 | +Sabotage-verified with the fix committed first, then restored and REBUILT: 935 |
| 30 | +`perry-codegen` lib tests green under `--features llvm-inprocess`. |
0 commit comments