GeezerVison is showing github.com — Remove ReturnConst/Break/Continue ops by youknowone · Pull Request #6816 · RustPython/RustPython
Conversation
youknowone
commented
Jan 20, 2026
•
edited by coderabbitai
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Summary by CodeRabbit
- Refactor
- Optimized bytecode instruction set by consolidating control-flow and return mechanisms for improved efficiency and simplified internal handling.
✏️ 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.
ShaharNaveh reacted with rocket emoji
coderabbitai
Bot
commented
Jan 20, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
📝 Walkthrough
Walkthrough
This PR removes three specialized bytecode instruction variants (Break, Continue, and ReturnConst) from the instruction set and consolidates their functionality into generic alternatives (Jump for break/continue control flow, ReturnValue for constant returns), simplifying the bytecode instruction architecture.
Changes
| Cohort / File(s) |
Summary |
Instruction Definition crates/compiler-core/src/bytecode/instruction.rs |
Removes Break, Continue, and ReturnConst enum variants and all associated metadata handling (label arguments, unconditional branch detection, stack effect calculations, and disassembler formatting). |
Code Generation crates/codegen/src/compile.rs |
Replaces emit_return_const() to load constants and emit ReturnValue instead; removes optimization in emit_return_value() that reused trailing LoadConst as ReturnConst; updates emit_jump() for break/continue to emit generic Jump to computed targets. |
Opcode Predicates crates/stdlib/src/opcode.rs |
Updates has_const() to exclude ReturnConst from constant-returning opcodes; removes Break and Continue from has_jump() matching. |
VM Runtime Execution crates/vm/src/frame.rs |
Removes Break and Continue variants from UnwindReason enum; deletes instruction handling for Break, Continue, and ReturnConst in execute_instruction(); eliminates break/continue unwinding paths. |
JIT Instruction Handling crates/jit/src/instructions.rs |
Removes ReturnConst from instruction termination recognition and instruction emitter logic. |
Test Utilities crates/jit/tests/common.rs |
Removes ReturnConst handling from annotation extraction and StackMachine execution flow. |
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
- Instruction 3.14 #6805: Directly inverse operation—adds
Break, Continue, and ReturnConst variants that this PR removes.
- Bytecode pseudo opcodes #6715: Introduces
PseudoInstruction and instruction enum consolidation that likely motivates this removal.
- Fix opcode args #6649: Modifies the same opcode predicate functions (
has_const, has_jump) in crates/stdlib/src/opcode.rs.
Suggested reviewers
Poem
🐰 Hops along with glee,
Break and Continue—now set free!
ReturnConst fades from bytecode bright,
Jump and ReturnValue shine so right. ✨
🚥 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 precisely summarizes the main change: removing three instruction variants (ReturnConst, Break, Continue) from the bytecode instruction set across multiple crates. |
| 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
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 and usage tips.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
youknowone
changed the title
Remove ReturnConst/Break/Continue
Remove ReturnConst/Break/Continue ops
Jan 20, 2026
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Jan 21, 2026
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
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.
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.
|