@@ -318,32 +318,8 @@ _PyInstruction_GetLength(PyCodeObject *code, int offset)
318318{
319319 ASSERT_WORLD_STOPPED_OR_LOCKED (code );
320320
321- int opcode = _PyCode_CODE (code )[offset ].op .code ;
322- assert (opcode != 0 );
323- assert (opcode != RESERVED );
324- if (opcode == INSTRUMENTED_LINE ) {
325- opcode = code -> _co_monitoring -> lines [offset ].original_opcode ;
326- }
327- if (opcode == INSTRUMENTED_INSTRUCTION ) {
328- opcode = code -> _co_monitoring -> per_instruction_opcodes [offset ];
329- }
330- int deinstrumented = DE_INSTRUMENT [opcode ];
331- if (deinstrumented ) {
332- opcode = deinstrumented ;
333- }
334- else {
335- opcode = _PyOpcode_Deopt [opcode ];
336- }
337- assert (opcode != 0 );
338- if (opcode == ENTER_EXECUTOR ) {
339- int exec_index = _PyCode_CODE (code )[offset ].op .arg ;
340- _PyExecutorObject * exec = code -> co_executors -> executors [exec_index ];
341- opcode = _PyOpcode_Deopt [exec -> vm_data .opcode ];
342- }
343- assert (!is_instrumented (opcode ));
344- assert (opcode != ENTER_EXECUTOR );
345- assert (opcode == _PyOpcode_Deopt [opcode ]);
346- return 1 + _PyOpcode_Caches [opcode ];
321+ _Py_CODEUNIT inst = _Py_GetBaseCodeUnit (code , offset );
322+ return 1 + _PyOpcode_Caches [inst .op .code ];
347323}
348324
349325#ifdef INSTRUMENT_DEBUG
@@ -591,16 +567,15 @@ _Py_GetBaseCodeUnit(PyCodeObject *code, int i)
591567 int opcode = inst .op .code ;
592568 if (opcode < MIN_INSTRUMENTED_OPCODE ) {
593569 inst .op .code = _PyOpcode_Deopt [opcode ];
594- assert (inst .op .code <= RESUME );
570+ assert (inst .op .code < MIN_SPECIALIZED_OPCODE );
595571 return inst ;
596572 }
597573 if (opcode == ENTER_EXECUTOR ) {
598574 _PyExecutorObject * exec = code -> co_executors -> executors [inst .op .arg ];
599575 opcode = _PyOpcode_Deopt [exec -> vm_data .opcode ];
600576 inst .op .code = opcode ;
601- assert (opcode <= RESUME );
602577 inst .op .arg = exec -> vm_data .oparg ;
603- assert (inst .op .code <= RESUME );
578+ assert (inst .op .code < MIN_SPECIALIZED_OPCODE );
604579 return inst ;
605580 }
606581 if (opcode == INSTRUMENTED_LINE ) {
0 commit comments