summaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authorDennis Sweeney <36520290+sweeneyde@users.noreply.github.com>2022-05-03 14:59:12 (GMT)
committerGitHub <noreply@github.com>2022-05-03 14:59:12 (GMT)
commitb156578bd63a94fe3d80a4c6a8dbc067feba5d06 (patch)
treeef52569184e48c4f282032e3f67b519c432c372f /Tools
parent04dc4b06a3afc79a658cacca87ee1d93a34653bd (diff)
downloadcpython-b156578bd63a94fe3d80a4c6a8dbc067feba5d06.zip
cpython-b156578bd63a94fe3d80a4c6a8dbc067feba5d06.tar.gz
cpython-b156578bd63a94fe3d80a4c6a8dbc067feba5d06.tar.bz2
gh-92031: Deoptimize Static Code at Finalization (GH-92039)
Diffstat (limited to 'Tools')
-rw-r--r--Tools/scripts/generate_opcode_h.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Tools/scripts/generate_opcode_h.py b/Tools/scripts/generate_opcode_h.py
index 6a04297..e1f4f01 100644
--- a/Tools/scripts/generate_opcode_h.py
+++ b/Tools/scripts/generate_opcode_h.py
@@ -117,6 +117,7 @@ def main(opcode_py, outfile='Include/opcode.h', internaloutfile='Include/interna
iobj.write("\nextern const uint8_t _PyOpcode_Caches[256];\n")
iobj.write("\nextern const uint8_t _PyOpcode_Deopt[256];\n")
+ iobj.write("\nextern const uint8_t _PyOpcode_Original[256];\n")
iobj.write("\n#ifdef NEED_OPCODE_TABLES\n")
write_int_array_from_ops("_PyOpcode_RelativeJump", opcode['hasjrel'], iobj)
write_int_array_from_ops("_PyOpcode_Jump", opcode['hasjrel'] + opcode['hasjabs'], iobj)
@@ -137,6 +138,12 @@ def main(opcode_py, outfile='Include/opcode.h', internaloutfile='Include/interna
for opt, deopt in sorted(deoptcodes.items()):
iobj.write(f" [{opt}] = {deopt},\n")
iobj.write("};\n")
+ iobj.write("\nconst uint8_t _PyOpcode_Original[256] = {\n")
+ for opt, deopt in sorted(deoptcodes.items()):
+ if opt.startswith("EXTENDED_ARG"):
+ deopt = "EXTENDED_ARG_QUICK"
+ iobj.write(f" [{opt}] = {deopt},\n")
+ iobj.write("};\n")
iobj.write("#endif // NEED_OPCODE_TABLES\n")
fobj.write("\n")