Skip to content

Commit

Permalink
remove _specialized_instructions, we have the same in _specialized_op…
Browse files Browse the repository at this point in the history
…map now
  • Loading branch information
iritkatriel committed Aug 15, 2023
1 parent 2f67ea8 commit d6ecee1
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 16 deletions.
2 changes: 0 additions & 2 deletions Lib/_opcode_metadata.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Lib/dis.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
_intrinsic_1_descs,
_intrinsic_2_descs,
_specializations,
_specialized_instructions,
_specialized_opmap,
)

Expand Down
2 changes: 1 addition & 1 deletion Lib/opcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import sys
# The build uses older versions of Python which do not have _opcode_metadata
if sys.version_info[:2] >= (3, 13):
from _opcode_metadata import _specializations, _specialized_instructions, _specialized_opmap
from _opcode_metadata import _specializations, _specialized_opmap
from _opcode_metadata import opmap, HAVE_ARGUMENT, MIN_INSTRUMENTED_OPCODE
EXTENDED_ARG = opmap['EXTENDED_ARG']

Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_dis.py
Original file line number Diff line number Diff line change
Expand Up @@ -1942,7 +1942,7 @@ def test_baseopname_and_baseopcode(self):
self.assertEqual(code, baseopcode)

# Specialized instructions
for name in opcode._specialized_instructions:
for name in opcode._specialized_opmap:
instruction = Instruction(opname=name, opcode=dis._all_opmap[name], arg=None, argval=None, argrepr='',
offset=0, start_offset=0, starts_line=1, is_jump_target=False, positions=None)
baseopname = instruction.baseopname
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_embed.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ def is_specialized(f):
for instruction in dis.get_instructions(f, adaptive=True):
opname = instruction.opname
if (
opname in opcode._specialized_instructions
opname in opcode._specialized_opmap
# Exclude superinstructions:
and "__" not in opname
):
Expand Down
8 changes: 0 additions & 8 deletions Tools/cases_generator/generate_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,14 +550,6 @@ def write_metadata(self, metadata_filename: str, pymetadata_filename: str) -> No
)
specialized_ops.add("BINARY_OP_INPLACE_ADD_UNICODE")

# Make list of specialized instructions
self.out.emit("")
self.out.emit(
"_specialized_instructions = ["
"opcode for family in _specializations.values() for opcode in family"
"]"
)

# emit specialized opmap
self.out.emit("")
with self.out.block("_specialized_opmap ="):
Expand Down
4 changes: 2 additions & 2 deletions Tools/scripts/summarize_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
DEFAULT_DIR = "/tmp/py_stats/"

#Create list of all instruction names
specialized = iter(opcode._specialized_instructions)
specialized = iter(opcode._specialized_opmap.keys())
opname = ["<0>"]
for name in opcode.opname[1:]:
if name.startswith("<"):
Expand Down Expand Up @@ -244,7 +244,7 @@ def categorized_counts(opcode_stats):
specialized = 0
not_specialized = 0
specialized_instructions = {
op for op in opcode._specialized_instructions
op for op in opcode._specialized_opmap.keys()
if "__" not in op}
for i, opcode_stat in enumerate(opcode_stats):
if "execution_count" not in opcode_stat:
Expand Down

0 comments on commit d6ecee1

Please sign in to comment.