summaryrefslogtreecommitdiffstats
path: root/Python/optimizer.c
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2024-08-13 13:22:57 (GMT)
committerGitHub <noreply@github.com>2024-08-13 13:22:57 (GMT)
commit7a65439b93d6ee4d4e32757b55909b882f9a2056 (patch)
tree0df6d926c920125cf98e02ab7d8c0612565b055e /Python/optimizer.c
parentfe23f8ed970425828de20fb48750fa89da914886 (diff)
downloadcpython-7a65439b93d6ee4d4e32757b55909b882f9a2056.zip
cpython-7a65439b93d6ee4d4e32757b55909b882f9a2056.tar.gz
cpython-7a65439b93d6ee4d4e32757b55909b882f9a2056.tar.bz2
GH-122390: Replace `_Py_GetbaseOpcode` with `_Py_GetBaseCodeUnit` (GH-122942)
Diffstat (limited to 'Python/optimizer.c')
-rw-r--r--Python/optimizer.c19
1 files changed, 2 insertions, 17 deletions
diff --git a/Python/optimizer.c b/Python/optimizer.c
index 1758329..dbd5467 100644
--- a/Python/optimizer.c
+++ b/Python/optimizer.c
@@ -22,20 +22,6 @@
#define MAX_EXECUTORS_SIZE 256
-#ifdef Py_DEBUG
-static int
-base_opcode(PyCodeObject *code, int offset)
-{
- int opcode = _Py_GetBaseOpcode(code, offset);
- if (opcode == ENTER_EXECUTOR) {
- int oparg = _PyCode_CODE(code)[offset].op.arg;
- _PyExecutorObject *ex = code->co_executors->executors[oparg];
- return ex->vm_data.opcode;
- }
- return opcode;
-}
-#endif
-
static bool
has_space_for_executor(PyCodeObject *code, _Py_CODEUNIT *instr)
{
@@ -771,9 +757,8 @@ translate_bytecode_to_trace(
{
uint32_t next_inst = target + 1 + INLINE_CACHE_ENTRIES_FOR_ITER + (oparg > 255);
uint32_t jump_target = next_inst + oparg;
- assert(base_opcode(code, jump_target) == END_FOR ||
- base_opcode(code, jump_target) == INSTRUMENTED_END_FOR);
- assert(base_opcode(code, jump_target+1) == POP_TOP);
+ assert(_Py_GetBaseCodeUnit(code, jump_target).op.code == END_FOR);
+ assert(_Py_GetBaseCodeUnit(code, jump_target+1).op.code == POP_TOP);
}
#endif
break;