GH-100923: Embed jump mask in COMPARE_OP oparg#100924
Merged
markshannon merged 10 commits intopython:mainfrom Jan 11, 2023
Merged
GH-100923: Embed jump mask in COMPARE_OP oparg#100924markshannon merged 10 commits intopython:mainfrom
COMPARE_OP oparg#100924markshannon merged 10 commits intopython:mainfrom
Conversation
COMPARE_OP opargCOMPARE_OP oparg
iritkatriel
reviewed
Jan 11, 2023
iritkatriel
approved these changes
Jan 11, 2023
Member
|
Can the mask be added at compile time to avoid mutating the logical code? def f():
...
c0 = f.__code__.replace()
# ... run the code here ...
c1 = f.__code__
assert c0 == c1 # fails?
assert hash(c0) == hash(c1) # fails? |
Member
|
Oh I see, the work is being done in PyCode_Quicken, which is already called on every code object, so we should be okay. |
Member
Author
|
Yes, the plan is to move |
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
iritkatriel
reviewed
Jan 11, 2023
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
Contributor
|
I just stumbled upon this. It seems like this PR didn't update the docs, as: https://docs.python.org/3.12/library/dis.html#opcode-COMPARE_OP Reads:
Perhaps the new masking mechanism could be included here? Or maybe it will suffice to update the docs to say |
Member
|
That issue is being covered in #107457. |
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
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.

Saves a few bytes in the code array.
COMPARE_OPcould be stored in the oparg. #100923