GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Use `stack_effect_info` for getting pop&push count by ShaharNaveh · Pull Request #6913 · RustPython/RustPython

Conversation

@ShaharNaveh

@ShaharNaveh ShaharNaveh commented Jan 31, 2026 •
edited by coderabbitai Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Followup on #6893

Summary by CodeRabbit

  • Refactor
    • Streamlined internal code generation logic to improve maintainability and reduce code duplication. No changes to user-facing functionality or APIs.

✏️ Tip: You can customize this high-level summary in your review settings.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

youknowone reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@ShaharNaveh
Use stack_effect_info for getting pop&push count
39dff7a
@coderabbitai

coderabbitai Bot commented Jan 31, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • crates/codegen/src/snapshots/rustpython_codegen__compile__tests__nested_double_async_with.snap is excluded by !**/*.snap

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

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

  • 🔍 Trigger a full review
📝 Walkthrough

Walkthrough

The PR refactors stack effect computation in the codegen IR by replacing manual per-instruction decomposition with a unified stack_effect_info-based approach, reducing code complexity by 54 lines while maintaining existing behavior including underflow handling and LOAD_FAST optimization tracking.

Changes

Cohort / File(s) Summary
Stack Effect Refactoring
crates/codegen/src/ir.rs
Replaces extensive per-instruction pop/push mappings with unified stack_effect_info-derived pushes/pops computation. Removes large match statements for BinaryOp, LoadAttr, Call and other instructions. Updates variable naming from (pops, pushes) to (pushes, pops) while preserving downstream underflow handling and NOT_LOCAL-based LOAD_FAST optimization tracking.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • Split stack_effect into pushed & popped #6893 — Directly corresponds to this PR's changes by introducing the split of stack_effect into pushed/popped that this refactoring relies on.
  • Remove SUBSCRIPT, JUMP_IF_{TRUE,FALSE}_OR_POP #6810 — Also modifies how instruction stack effects are represented and handled across the codebase.
  • LoadClosure as pseudo op #6789 — Modifies instruction handling in the same IR file with related stack-effect machinery changes.

Suggested reviewers

  • youknowone

Poem

🐰 Stack effects need not be verbose and grand,
Unite the wisdom, simplify the stand!
Fifty-four lines vanish, yet the logic stays,
A cleaner IR shines through the codegen maze! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Use stack_effect_info for getting pop&push count' clearly and specifically describes the main refactoring change: replacing manual stack effect decomposition with the stack_effect_info-based approach.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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
  • X
  • Mastodon
  • Reddit
  • LinkedIn

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@youknowone
youknowone enabled auto-merge (squash) January 31, 2026 08:58
ShaharNaveh added 2 commits January 31, 2026 12:53
@ShaharNaveh
Merge remote-tracking branch 'upstream/main' into after-split-cleanup
79c8872
@ShaharNaveh
Update snapshot
f3a527a
youknowone
youknowone approved these changes Jan 31, 2026
View reviewed changes
@youknowone
youknowone disabled auto-merge January 31, 2026 14:45
@youknowone
youknowone merged commit c771427 into RustPython:main Jan 31, 2026
23 of 24 checks passed

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@youknowone youknowone youknowone approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@ShaharNaveh @youknowone
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.