summaryrefslogtreecommitdiffstats
path: root/Tools/build
diff options
context:
space:
mode:
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>2023-08-23 17:39:00 (GMT)
committerGitHub <noreply@github.com>2023-08-23 17:39:00 (GMT)
commit72119d16a5f658939809febef29dadeca02cf34d (patch)
treecbcc9877f2a83559ee76c91a18330f1aeae36115 /Tools/build
parent422f81b5d2359063826b8561f698d57e94f6a5d8 (diff)
downloadcpython-72119d16a5f658939809febef29dadeca02cf34d.zip
cpython-72119d16a5f658939809febef29dadeca02cf34d.tar.gz
cpython-72119d16a5f658939809febef29dadeca02cf34d.tar.bz2
gh-105481: remove regen-opcode. Generated _PyOpcode_Caches in regen-cases. (#108367)
Diffstat (limited to 'Tools/build')
-rw-r--r--Tools/build/generate_opcode_h.py67
1 files changed, 0 insertions, 67 deletions
diff --git a/Tools/build/generate_opcode_h.py b/Tools/build/generate_opcode_h.py
deleted file mode 100644
index 643918c..0000000
--- a/Tools/build/generate_opcode_h.py
+++ /dev/null
@@ -1,67 +0,0 @@
-# This script generates the pycore_opcode.h header file.
-
-import sys
-import tokenize
-
-SCRIPT_NAME = "Tools/build/generate_opcode_h.py"
-PYTHON_OPCODE = "Lib/opcode.py"
-
-internal_header = f"""
-// Auto-generated by {SCRIPT_NAME} from {PYTHON_OPCODE}
-
-#ifndef Py_INTERNAL_OPCODE_H
-#define Py_INTERNAL_OPCODE_H
-#ifdef __cplusplus
-extern "C" {{
-#endif
-
-#ifndef Py_BUILD_CORE
-# error "this header requires Py_BUILD_CORE define"
-#endif
-
-#include "opcode.h"
-""".lstrip()
-
-internal_footer = """
-#ifdef __cplusplus
-}
-#endif
-#endif // !Py_INTERNAL_OPCODE_H
-"""
-
-DEFINE = "#define {:<38} {:>3}\n"
-
-UINT32_MASK = (1<<32)-1
-
-def get_python_module_dict(filename):
- mod = {}
- with tokenize.open(filename) as fp:
- code = fp.read()
- exec(code, mod)
- return mod
-
-def main(opcode_py,
- internal_opcode_h='Include/internal/pycore_opcode.h'):
-
- opcode = get_python_module_dict(opcode_py)
-
- with open(internal_opcode_h, 'w') as iobj:
- iobj.write(internal_header)
-
- iobj.write("\nextern const uint8_t _PyOpcode_Caches[256];\n")
- iobj.write("\n#ifdef NEED_OPCODE_TABLES\n")
-
- iobj.write("\nconst uint8_t _PyOpcode_Caches[256] = {\n")
- for name, entries in opcode["_inline_cache_entries"].items():
- iobj.write(f" [{name}] = {entries},\n")
- iobj.write("};\n")
-
- iobj.write("#endif // NEED_OPCODE_TABLES\n")
-
- iobj.write(internal_footer)
-
- print(f"{internal_opcode_h} regenerated from {opcode_py}")
-
-
-if __name__ == '__main__':
- main(sys.argv[1], sys.argv[2])