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 — Remove ReturnConst/Break/Continue ops by youknowone · Pull Request #6816 · RustPython/RustPython

Conversation

@youknowone

@youknowone youknowone commented Jan 20, 2026 •
edited by coderabbitai Bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

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
All reactions
  • 🚀 1 reaction
@coderabbitai

coderabbitai Bot commented Jan 20, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor
📝 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

  • ShaharNaveh

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
  • 📝 Generate docstrings

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 changed the title Break continue Remove ReturnConst/Break/Continue Jan 20, 2026
@youknowone youknowone changed the title Remove ReturnConst/Break/Continue Remove ReturnConst/Break/Continue ops Jan 20, 2026
@youknowone
youknowone force-pushed the break-continue branch from 8b9641c to 00bea3a Compare January 20, 2026 12:36
youknowone added 2 commits January 20, 2026 23:19
@youknowone
Remove ReturnConst
1de8678
@youknowone
Remove break/continue ops
a984dda
@youknowone
youknowone force-pushed the break-continue branch from 00bea3a to a984dda Compare January 20, 2026 14:19
@youknowone
youknowone marked this pull request as ready for review January 20, 2026 14:58
@youknowone
youknowone merged commit e0cceaf into RustPython:main Jan 20, 2026
13 checks passed

Uh oh!

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

@youknowone
youknowone deleted the break-continue branch January 20, 2026 15:03
This was referenced Jan 21, 2026
instruction improvements #6829
Merged
Seperate between scope exit & unconditional jump opcodes #6841
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

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.

1 participant

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