GH-128563: Generate `opcode = ...` in instructions that need `opcode` by markshannon · Pull Request #129608 · python/cpython · GitHub
Skip to content

GH-128563: Generate opcode = ... in instructions that need opcode - #129608

Merged
markshannon merged 3 commits into
python:mainfrom
faster-cpython:make-opcode-static
Feb 3, 2025
Merged

markshannon merged 3 commits into
python:mainfrom
faster-cpython:make-opcode-static

Conversation

@markshannon

@markshannon markshannon commented Feb 3, 2025

Copy link
Copy Markdown
Member

This PR:

  • In instruction bodies that use opcode, generate opcode = ... at the start of the instruction
  • Fix instructions that relied to the dynamic value of opcode by using micro-ops
  • Remove GO_TO_INSTRUCTION macro as it is no longer needed.

This means that we no longer need to pass the opcode parameter in tailcalls.

Performance is neutral.

@Fidget-Spinner Fidget-Spinner changed the title GH-128563: Generate opocde = ... in instructions that need opcode GH-128563: Generate opcode = ... in instructions that need opcode Feb 3, 2025

@Fidget-Spinner Fidget-Spinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I have a feeling if you remove the uint8_t opcode in the outer loop, and just define it as int opcode = XXX in each bytecode case, there will be a speedup in the normal interpreter as well (or at least, there will be less pressure on the register allocator), as it will free up a single outer variable that is live across all basic blocks.

@markshannon

Copy link
Copy Markdown
Member Author

@Fidget-Spinner

Copy link
Copy Markdown
Member

Don't think it's worth diverging the two over that. Let's just keep it simple then and do this.

@markshannon
markshannon merged commit 75b628a into python:main Feb 3, 2025
@bedevere-bot

Copy link
Copy Markdown

srinivasreddy pushed a commit to srinivasreddy/cpython that referenced this pull request Feb 7, 2025
@markshannon
markshannon deleted the make-opcode-static branch February 27, 2025 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants