Skip to content

test(codegen): update scalar_replaced_slot_roots fixtures to #7088's frame enter - #7185

Merged
proggeramlug merged 1 commit into
PerryTS:mainfrom
jdalton:fix/scalar-replaced-slot-roots-fixtures
Aug 1, 2026
Merged

test(codegen): update scalar_replaced_slot_roots fixtures to #7088's frame enter#7185
proggeramlug merged 1 commit into
PerryTS:mainfrom
jdalton:fix/scalar-replaced-slot-roots-fixtures

Conversation

@jdalton

@jdalton jdalton commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

What

crates/perry-codegen/tests/scalar_replaced_slot_roots.rs has two helpers that locate the shadow frame push by string:

let needle = "call i64 @js_shadow_frame_push(i32 ";
// ...
.find("call i64 @js_shadow_frame_push(")

#7088 replaced that emission with call ptr @js_shadow_frame_enter(i32 N) — same slot-count operand, but the callee returns the ShadowStackState pointer the inline slot stores address (the pop handle is derived from frame_top). Both lookups therefore missed and panicked at the grepexpected 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_bound and bind_is_hoisted_into_the_entry_block_ahead_of_the_storing_loop have been red on main while the #6968 rooting contract they guard is in fact intact: the bind_calls(&ir) > 0 assertion 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

cargo test -p perry-codegen --test scalar_replaced_slot_roots
test result: ok. 11 passed; 0 failed

(was: 9 passed, 2 failed on main @ 6406ed66e)

Not in scope

cargo test -p perry-codegen --test loop_safepoint_purity is also red on main (6/7), for a different and genuine reason: #7161 made the back-edge poll opt-in, so emit_gc_loop_safepoint emits nothing by default and every "…keeps the back edge poll" assertion fails. That needs a test-override hook for the OnceLock-cached gate (the codegen analogue of the runtime's GC_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

    • Updated shadow-frame validation to align with the current runtime interface.
    • Restored successful execution of all 11 existing scalar replacement assertions.
  • Documentation

    • Added a changelog entry describing the fixture and test updates.

@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The codegen tests now identify js_shadow_frame_enter and its ptr return type when validating shadow-frame slot roots. A changelog entry documents the fixture updates.

Changes

Shadow-frame test expectations

Layer / File(s) Summary
Update shadow-frame IR assertions
crates/perry-codegen/tests/scalar_replaced_slot_roots.rs, changelog.d/7185-scalar-replaced-slot-roots-fixtures.md
The tests locate js_shadow_frame_enter for slot-count and entry-order assertions. The changelog records the fixture updates.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the test fixture update and the migration to the frame-enter API from #7088.
Description check ✅ Passed The description clearly explains the problem, fix, verification results, and out-of-scope failures, but it does not use the repository template headings or checklist.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

…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.
@jdalton
jdalton force-pushed the fix/scalar-replaced-slot-roots-fixtures branch from d570b32 to 5713e22 Compare August 1, 2026 12:35

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 73a9084 and 5713e22.

📒 Files selected for processing (2)
  • changelog.d/7185-scalar-replaced-slot-roots-fixtures.md
  • crates/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).

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 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.

Suggested change
- **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

@proggeramlug
proggeramlug merged commit d8be5f4 into PerryTS:main Aug 1, 2026
1 of 7 checks passed
@proggeramlug

Copy link
Copy Markdown
Contributor

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 maintainer_can_modify=true, so #7186 is the same-repository landing branch with the required version bump and small review/diagnostic cleanups. Targeted suite: 11/11 passing.

proggeramlug added a commit that referenced this pull request Aug 1, 2026
#7185 landed while its same-repository maintainer branch was being prepared, but the contributor commit intentionally did not carry release metadata. Bump the workspace to 0.5.1277 and make the remaining scalar-root diagnostics consistently name js_shadow_frame_enter.

Refs #7185.
proggeramlug added a commit that referenced this pull request Aug 1, 2026
#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.
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.

2 participants