FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

GH-100982: Add `COMPARE_AND_BRANCH` instruction by markshannon · Pull Request #100983 · python/cpython · GitHub

/ cpython Public

GH-100982: Add COMPARE_AND_BRANCH instruction - #100983

Merged
markshannon merged 10 commits into
python:mainfrom
faster-cpython:compare-and-branch-instruction-2
Jan 16, 2023
Merged

GH-100982: Add COMPARE_AND_BRANCH instruction#100983
markshannon merged 10 commits into
python:mainfrom
faster-cpython:compare-and-branch-instruction-2

Conversation

markshannon commented Jan 12, 2023
edited by bedevere-bot
Loading

Copy link
Copy Markdown
Member

Comment thread Lib/opcode.py
jrel_op('JUMP_BACKWARD', 140) # Number of words to skip (backwards)

def_op('COMPARE_AND_BRANCH', 141) # Comparison and jump
hascompare.append(141)

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This opcode needs to be in hasjrel as well.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

The problem is that dis sees COMPARE_AND_BRANCH, then POP_JUMP_IF_. The POP_JUMP_IF_ is where we jump from.
So marking COMPARE_AND_BRANCH as a jump confuses dis, it thinks the operator is a jump offset. COMPARE_AND_BRANCH is effectively a superinstruction.

I could special case COMPARE_AND_BRANCH in dis, but I think it might be better to wait for proper support for longer instructions.

Comment thread Python/specialize.c
markshannon merged commit 7b14c2e into python:main Jan 16, 2023
markshannon deleted the compare-and-branch-instruction-2 branch September 26, 2023 12:53
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL