-
-
Notifications
You must be signed in to change notification settings - Fork 30.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GH-100923: Embed jump mask in COMPARE_OP
oparg
#100924
GH-100923: Embed jump mask in COMPARE_OP
oparg
#100924
Conversation
COMPARE_OP
opargCOMPARE_OP
oparg
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? |
Oh I see, the work is being done in PyCode_Quicken, which is already called on every code object, so we should be okay. |
Yes, the plan is to move |
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
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 |
That issue is being covered in #107457. |
Saves a few bytes in the code array.
COMPARE_OP
could be stored in the oparg. #100923