◐ Shell
clean mode source ↗

gh-105481: generate _specializations and _specialized_instructions from bytecodes.c by iritkatriel · Pull Request #105913 · python/cpython

Conversation

@iritkatriel

This generates the metadata about specialised opcodes from bytecodes.c, to replace the hard coded dict in opcode.py.

There is one irregularity that I needed to special-case: BINARY_OP_INPLACE_ADD_UNICODE, which is commented out in bytecodes.c (because it has different stack effect compared to the rest of the family).

@markshannon

We should move the optimization in BINARY_OP_INPLACE_ADD_UNICODE to tier 2, once it we have a tier 2 optimizer. It makes sense there, but not in tier 1.
For now we can just remove it. I suspect BINARY_OP_INPLACE_ADD_UNICODE is not safe for PEP 669 anyway.
#100982

markshannon

@markshannon

Looks like summarize_stats.py needs updating

gvanrossum

Choose a reason for hiding this comment

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

LGTM. One nit; no need to get another review if you decide to fix that. Also okay to merge as-is.

Reviewers

@markshannon markshannon markshannon approved these changes

@gvanrossum gvanrossum gvanrossum approved these changes

@brettcannon brettcannon Awaiting requested review from brettcannon brettcannon is a code owner

@ericsnowcurrently ericsnowcurrently Awaiting requested review from ericsnowcurrently ericsnowcurrently is a code owner

@ncoghlan ncoghlan Awaiting requested review from ncoghlan ncoghlan is a code owner

@warsaw warsaw Awaiting requested review from warsaw warsaw is a code owner

Labels