test(codegen): update scalar_replaced_slot_roots fixtures to #7088's frame enter - #7185
Conversation
📝 WalkthroughWalkthroughThe codegen tests now identify ChangesShadow-frame test expectations
Estimated code review effort: 1 (Trivial) | ~5 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
…7088's frame enter Two tests grepped for `call i64 @js_shadow_frame_push(i32 `, which PerryTS#7088 replaced with `call ptr @js_shadow_frame_enter(i32 ` (same slot-count operand; the pop handle is now derived from frame_top). Both panicked at the grep — "expected a shadow frame push" / "no frame push in the binding function" — BEFORE reaching the assertions they exist for, so the suite was red on main while the PerryTS#6968 rooting contract it guards was in fact intact. Only the callee name and return type change. Every real assertion (the field alloca is bound, the frame grows differentially, the bind is hoisted into the entry block ahead of the storing loop and after the push) is untouched and now actually executes: 11/11 pass. Refs PerryTS#7088, PerryTS#6968.
d570b32 to
5713e22
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@changelog.d/7185-scalar-replaced-slot-roots-fixtures.md`:
- Line 3: Update the two inline code spans describing the IR prefixes in the
changelog entry to remove the trailing spaces before their closing backticks,
while preserving the stated prefixes and all surrounding content.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 6a949c06-d7ae-4940-9652-fad8475aa857
📒 Files selected for processing (2)
changelog.d/7185-scalar-replaced-slot-roots-fixtures.mdcrates/perry-codegen/tests/scalar_replaced_slot_roots.rs
| @@ -0,0 +1,3 @@ | |||
| ### Fixed | |||
|
|
|||
| - **tests: `scalar_replaced_slot_roots` was red on `main` for a stale string, not a real regression**. Two helpers located the shadow frame push by grepping `call i64 @js_shadow_frame_push(i32 `, which #7088 replaced with `call ptr @js_shadow_frame_enter(i32 ` (same slot-count operand; the pop handle is now derived from `frame_top`). Both panicked at the lookup before reaching the assertions they exist for, so `scalar_replaced_object_field_holding_a_heap_value_is_bound` and `bind_is_hoisted_into_the_entry_block_ahead_of_the_storing_loop` failed while the #6968 rooting contract they guard was intact. Fixtures updated to the post-#7088 emission; every real assertion is unchanged and now actually executes (11/11 pass). | |||
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Remove spaces inside the inline code spans.
Markdownlint reports two MD038 violations because both IR prefixes contain a trailing space before the closing backtick. Describe them as prefixes without embedding the trailing spaces.
Proposed fix
-- **tests: `scalar_replaced_slot_roots` was red on `main` for a stale string, not a real regression**. Two helpers located the shadow frame push by grepping `call i64 `@js_shadow_frame_push`(i32 `, which `#7088` replaced with `call ptr `@js_shadow_frame_enter`(i32 ` (same slot-count operand; the pop handle is now derived from `frame_top`). Both panicked at the lookup before reaching the assertions they exist for, so `scalar_replaced_object_field_holding_a_heap_value_is_bound` and `bind_is_hoisted_into_the_entry_block_ahead_of_the_storing_loop` failed while the `#6968` rooting contract they guard was intact. Fixtures updated to the post-#7088 emission; every real assertion is unchanged and now actually executes (11/11 pass).
+- **tests: `scalar_replaced_slot_roots` was red on `main` for a stale string, not a real regression**. Two helpers located the shadow frame push by grepping the `call i64 `@js_shadow_frame_push`(i32` prefix, which `#7088` replaced with the `call ptr `@js_shadow_frame_enter`(i32` prefix (same slot-count operand; the pop handle is now derived from `frame_top`). Both panicked at the lookup before reaching the assertions they exist for, so `scalar_replaced_object_field_holding_a_heap_value_is_bound` and `bind_is_hoisted_into_the_entry_block_ahead_of_the_storing_loop` failed while the `#6968` rooting contract they guard was intact. Fixtures updated to the post-#7088 emission; every real assertion is unchanged and now actually executes (11/11 pass).📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| - **tests: `scalar_replaced_slot_roots` was red on `main` for a stale string, not a real regression**. Two helpers located the shadow frame push by grepping `call i64 @js_shadow_frame_push(i32 `, which #7088 replaced with `call ptr @js_shadow_frame_enter(i32 ` (same slot-count operand; the pop handle is now derived from `frame_top`). Both panicked at the lookup before reaching the assertions they exist for, so `scalar_replaced_object_field_holding_a_heap_value_is_bound` and `bind_is_hoisted_into_the_entry_block_ahead_of_the_storing_loop` failed while the #6968 rooting contract they guard was intact. Fixtures updated to the post-#7088 emission; every real assertion is unchanged and now actually executes (11/11 pass). | |
| - **tests: `scalar_replaced_slot_roots` was red on `main` for a stale string, not a real regression**. Two helpers located the shadow frame push by grepping the `call i64 `@js_shadow_frame_push`(i32` prefix, which `#7088` replaced with the `call ptr `@js_shadow_frame_enter`(i32` prefix (same slot-count operand; the pop handle is now derived from `frame_top`). Both panicked at the lookup before reaching the assertions they exist for, so `scalar_replaced_object_field_holding_a_heap_value_is_bound` and `bind_is_hoisted_into_the_entry_block_ahead_of_the_storing_loop` failed while the `#6968` rooting contract they guard was intact. Fixtures updated to the post-#7088 emission; every real assertion is unchanged and now actually executes (11/11 pass). |
🧰 Tools
🪛 markdownlint-cli2 (0.23.1)
[warning] 3-3: Spaces inside code span elements
(MD038, no-space-in-code)
[warning] 3-3: Spaces inside code span elements
(MD038, no-space-in-code)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@changelog.d/7185-scalar-replaced-slot-roots-fixtures.md` at line 3, Update
the two inline code spans describing the IR prefixes in the changelog entry to
remove the trailing spaces before their closing backticks, while preserving the
stated prefixes and all surrounding content.
Source: Linters/SAST tools
|
Audited and carried forward in #7186 with jdalton preserved as the commit author. The maintainer credential is scoped to PerryTS and GitHub rejected writes to the fork despite |
#7185 landed without the maintainer-side release metadata external contributors intentionally omit. Bump the workspace to 0.5.1277 and make the remaining scalar-root comments and diagnostics consistently name js_shadow_frame_enter. Validated: scalar_replaced_slot_roots 11/11; rustfmt and diff checks clean.
What
crates/perry-codegen/tests/scalar_replaced_slot_roots.rshas two helpers that locate the shadow frame push by string:#7088 replaced that emission with
call ptr @js_shadow_frame_enter(i32 N)— same slot-count operand, but the callee returns theShadowStackStatepointer the inline slot stores address (the pop handle is derived fromframe_top). Both lookups therefore missed and panicked at the grep —expected a shadow frame push/no frame push in the binding function— before reaching the assertions they exist for.So
scalar_replaced_object_field_holding_a_heap_value_is_boundandbind_is_hoisted_into_the_entry_block_ahead_of_the_storing_loophave been red onmainwhile the #6968 rooting contract they guard is in fact intact: thebind_calls(&ir) > 0assertion in the first test passes, and the whole ordering claim in the second was simply never evaluated. That is the #4 failure mode in CLAUDE.md's gate checklist inverted — a test that is red for a reason unrelated to its subject teaches people to ignore it.Fix
Point both at
call ptr @js_shadow_frame_enter(. Nothing else changes — every real assertion (field alloca is bound; the frame grows differentially; the bind is hoisted into the entry block ahead of the storing loop and after the push) is untouched and now actually executes.Verification
(was: 9 passed, 2 failed on
main@6406ed66e)Not in scope
cargo test -p perry-codegen --test loop_safepoint_purityis also red onmain(6/7), for a different and genuine reason: #7161 made the back-edge poll opt-in, soemit_gc_loop_safepointemits nothing by default and every "…keeps the back edge poll" assertion fails. That needs a test-override hook for theOnceLock-cached gate (the codegen analogue of the runtime'sGC_MOVING_LOOP_POLLS_TEST_OVERRIDE) rather than a fixture edit, and it belongs with #7161. Flagging it here so it is not mistaken for the same class of staleness.Summary by CodeRabbit
Tests
Documentation