gh-105481: generate _specializations and _specialized_instructions from bytecodes.c (#105913)

This commit is contained in:
Irit Katriel 2023-06-19 23:47:04 +01:00 committed by GitHub
parent 28187a9c4f
commit 33f0a8578b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 345 additions and 277 deletions

View file

@ -25,12 +25,13 @@ def write_contents(f):
"""Write C code contents to the target file object.
"""
opcode = find_module('opcode')
_opcode_metadata = find_module('_opcode_metadata')
targets = ['_unknown_opcode'] * 256
for opname, op in opcode.opmap.items():
if not opcode.is_pseudo(op):
targets[op] = "TARGET_%s" % opname
next_op = 1
for opname in opcode._specialized_instructions:
for opname in _opcode_metadata._specialized_instructions:
while targets[next_op] != '_unknown_opcode':
next_op += 1
targets[next_op] = "TARGET_%s" % opname