Remove cells_frees duplicate storage from Frame#7351
Conversation
Cell/free variable objects were stored in both a separate `Box<[PyCellRef]>` (cells_frees field) and in the localsplus fastlocals array. Remove the redundant cells_frees field and access cell objects directly through localsplus, eliminating one Box allocation and N clone operations per frame creation.
📝 WalkthroughWalkthroughFrame's cell and free variable storage refactored from a separate Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
Sorry, something went wrong.
|
Code has been automatically formatted The code in this PR has been formatted using:
git pull origin worktree-frame-datastack |
Sorry, something went wrong.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Sorry, something went wrong.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@crates/vm/src/frame.rs`:
- Around line 743-744: Rename the misleading method clear_stack_and_cells() to
clear_stack() and update its docstring to state it only clears the value stack
(delegating cell/free clearing to clear_locals_and_stack()); inside the function
keep calling stack_clear() as before, and update all callsites and references
(including any uses alongside clear_locals_and_stack()) to the new name to
maintain behavior; ensure public API/export names are adjusted and tests/uses
compile.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
Run ID: 97256480-8c7b-4237-bb71-6049292ef84a
📒 Files selected for processing (1)
crates/vm/src/frame.rs
Sorry, something went wrong.
Cell/free variable objects were stored in both a separate
Box<[PyCellRef]>(cells_frees field) and in the localsplus fastlocals array. Remove the redundant cells_frees field and access cell objects directly through localsplus, eliminating one Box allocation and N clone operations per frame creation.Summary by CodeRabbit