https://github.com/python/cpython/commit/c869898f39a64113689b4d674b996d678dec2843
commit: c869898f39a64113689b4d674b996d678dec2843
branch: 3.14
author: Miss Islington (bot) <31488909+miss-isling...@users.noreply.github.com>
committer: DinoV <dinoviehl...@gmail.com>
date: 2025-05-19T11:09:15-04:00
summary:

[3.14] gh-128045: Mark unknown opcodes as deopting to themselves (GH-128044) 
(#134228)

* gh-128045: Mark unknown opcodes as deopting to themselves (GH-128044)

files:
M Include/internal/pycore_opcode_metadata.h
M Tools/cases_generator/opcode_metadata_generator.py

diff --git a/Include/internal/pycore_opcode_metadata.h 
b/Include/internal/pycore_opcode_metadata.h
index 0e34074f1600a7..8d92e29c435056 100644
--- a/Include/internal/pycore_opcode_metadata.h
+++ b/Include/internal/pycore_opcode_metadata.h
@@ -1787,6 +1787,35 @@ const uint8_t _PyOpcode_Caches[256] = {
 extern const uint8_t _PyOpcode_Deopt[256];
 #ifdef NEED_OPCODE_METADATA
 const uint8_t _PyOpcode_Deopt[256] = {
+    [121] = 121,
+    [122] = 122,
+    [123] = 123,
+    [124] = 124,
+    [125] = 125,
+    [126] = 126,
+    [127] = 127,
+    [212] = 212,
+    [213] = 213,
+    [214] = 214,
+    [215] = 215,
+    [216] = 216,
+    [217] = 217,
+    [218] = 218,
+    [219] = 219,
+    [220] = 220,
+    [221] = 221,
+    [222] = 222,
+    [223] = 223,
+    [224] = 224,
+    [225] = 225,
+    [226] = 226,
+    [227] = 227,
+    [228] = 228,
+    [229] = 229,
+    [230] = 230,
+    [231] = 231,
+    [232] = 232,
+    [233] = 233,
     [BINARY_OP] = BINARY_OP,
     [BINARY_OP_ADD_FLOAT] = BINARY_OP,
     [BINARY_OP_ADD_INT] = BINARY_OP,
diff --git a/Tools/cases_generator/opcode_metadata_generator.py 
b/Tools/cases_generator/opcode_metadata_generator.py
index 620e4b6f1f4a69..10567204dcc599 100644
--- a/Tools/cases_generator/opcode_metadata_generator.py
+++ b/Tools/cases_generator/opcode_metadata_generator.py
@@ -157,6 +157,13 @@ def generate_deopt_table(analysis: Analysis, out: CWriter) 
-> None:
         if inst.family is not None:
             deopt = inst.family.name
         deopts.append((inst.name, deopt))
+    defined = set(analysis.opmap.values())
+    for i in range(256):
+        if i not in defined:
+            deopts.append((f'{i}', f'{i}'))
+
+    assert len(deopts) == 256
+    assert len(set(x[0] for x in deopts)) == 256
     for name, deopt in sorted(deopts):
         out.emit(f"[{name}] = {deopt},\n")
     out.emit("};\n\n")

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: arch...@mail-archive.com

Reply via email to