diff options
author | Mark Shannon <mark@hotpy.org> | 2021-06-10 07:46:01 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-10 07:46:01 (GMT) |
commit | e117c0283705943189e6b1aef668a1f68f3f00a4 (patch) | |
tree | 2f0ed87b3a6ee853b65b7db260b39d62337e87bd /Tools | |
parent | 309ab616020f8504ced8ca64f7d7abc2df25a37f (diff) | |
download | cpython-e117c0283705943189e6b1aef668a1f68f3f00a4.zip cpython-e117c0283705943189e6b1aef668a1f68f3f00a4.tar.gz cpython-e117c0283705943189e6b1aef668a1f68f3f00a4.tar.bz2 |
bpo-44337: Port LOAD_ATTR to PEP 659 adaptive interpreter (GH-26595)
* Specialize LOAD_ATTR with LOAD_ATTR_SLOT and LOAD_ATTR_SPLIT_KEYS
* Move dict-common.h to internal/pycore_dict.h
* Add LOAD_ATTR_WITH_HINT specialized opcode.
* Quicken in function if loopy
* Specialize LOAD_ATTR for module attributes.
* Add specialization stats
Diffstat (limited to 'Tools')
-rw-r--r-- | Tools/scripts/generate_opcode_h.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Tools/scripts/generate_opcode_h.py b/Tools/scripts/generate_opcode_h.py index 290f625..41ae3fe 100644 --- a/Tools/scripts/generate_opcode_h.py +++ b/Tools/scripts/generate_opcode_h.py @@ -53,6 +53,10 @@ def main(opcode_py, outfile='Include/opcode.h'): opmap = opcode['opmap'] hasjrel = opcode['hasjrel'] hasjabs = opcode['hasjabs'] + used = [ False ] * 256 + next_op = 1 + for name, op in opmap.items(): + used[op] = True with open(outfile, 'w') as fobj: fobj.write(header) for name in opcode['opname']: @@ -61,6 +65,11 @@ def main(opcode_py, outfile='Include/opcode.h'): if name == 'POP_EXCEPT': # Special entry for HAVE_ARGUMENT fobj.write("#define %-23s %3d\n" % ('HAVE_ARGUMENT', opcode['HAVE_ARGUMENT'])) + for name in opcode['_specialized_instructions']: + while used[next_op]: + next_op += 1 + fobj.write("#define %-23s %3s\n" % (name, next_op)) + used[next_op] = True fobj.write("#ifdef NEED_OPCODE_JUMP_TABLES\n") write_int_array_from_ops("_PyOpcode_RelativeJump", opcode['hasjrel'], fobj) write_int_array_from_ops("_PyOpcode_Jump", opcode['hasjrel'] + opcode['hasjabs'], fobj) |