summaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>2023-01-19 18:14:55 (GMT)
committerGitHub <noreply@github.com>2023-01-19 18:14:55 (GMT)
commite9ccfe4a636d5fe33f65cea2605c3621ffa55f19 (patch)
tree56949db98d45d3f744f893e6f8d4909041a679fc /Tools
parenta1e051a23736fdf3da812363bcaf32e53a294f03 (diff)
downloadcpython-e9ccfe4a636d5fe33f65cea2605c3621ffa55f19.zip
cpython-e9ccfe4a636d5fe33f65cea2605c3621ffa55f19.tar.gz
cpython-e9ccfe4a636d5fe33f65cea2605c3621ffa55f19.tar.bz2
gh-100712: make it possible to disable specialization (for debugging) (#100713)
Diffstat (limited to 'Tools')
-rw-r--r--Tools/build/generate_opcode_h.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Tools/build/generate_opcode_h.py b/Tools/build/generate_opcode_h.py
index 174573a..9b2112f 100644
--- a/Tools/build/generate_opcode_h.py
+++ b/Tools/build/generate_opcode_h.py
@@ -85,6 +85,7 @@ def main(opcode_py, outfile='Include/opcode.h', internaloutfile='Include/interna
is_pseudo = opcode['is_pseudo']
_pseudo_ops = opcode['_pseudo_ops']
+ ENABLE_SPECIALIZATION = opcode["ENABLE_SPECIALIZATION"]
HAVE_ARGUMENT = opcode["HAVE_ARGUMENT"]
MIN_PSEUDO_OPCODE = opcode["MIN_PSEUDO_OPCODE"]
MAX_PSEUDO_OPCODE = opcode["MAX_PSEUDO_OPCODE"]
@@ -171,6 +172,10 @@ def main(opcode_py, outfile='Include/opcode.h', internaloutfile='Include/interna
for i, (op, _) in enumerate(opcode["_nb_ops"]):
fobj.write(DEFINE.format(op, i))
+ fobj.write("\n")
+ fobj.write("/* Defined in Lib/opcode.py */\n")
+ fobj.write(f"#define ENABLE_SPECIALIZATION {int(ENABLE_SPECIALIZATION)}")
+
iobj.write("\n")
iobj.write("#ifdef Py_DEBUG\n")
iobj.write(f"static const char *const _PyOpcode_OpName[{NUM_OPCODES}] = {{\n")