@@ -566,13 +566,7 @@ de_instrument(PyCodeObject *code, int i, int event)
566566 _Py_CODEUNIT * instr = & _PyCode_CODE (code )[i ];
567567 uint8_t * opcode_ptr = & instr -> op .code ;
568568 int opcode = * opcode_ptr ;
569- if (opcode == ENTER_EXECUTOR ) {
570- int oparg = instr -> op .arg ;
571- _PyExecutorObject * exec = code -> co_executors -> executors [oparg ];
572- opcode_ptr = & exec -> vm_data .opcode ;
573- opcode = * opcode_ptr ;
574- assert (opcode != ENTER_EXECUTOR );
575- }
569+ assert (opcode != ENTER_EXECUTOR );
576570 if (opcode == INSTRUMENTED_LINE ) {
577571 opcode_ptr = & code -> _co_monitoring -> lines [i ].original_opcode ;
578572 opcode = * opcode_ptr ;
@@ -717,22 +711,7 @@ remove_tools(PyCodeObject * code, int offset, int event, int tools)
717711 assert (event != PY_MONITORING_EVENT_LINE );
718712 assert (event != PY_MONITORING_EVENT_INSTRUCTION );
719713 assert (PY_MONITORING_IS_INSTRUMENTED_EVENT (event ));
720- #ifndef NDEBUG
721- _Py_CODEUNIT co_instr = _PyCode_CODE (code )[offset ];
722- uint8_t opcode = co_instr .op .code ;
723- uint8_t oparg = co_instr .op .arg ;
724- if (opcode == ENTER_EXECUTOR ) {
725- _PyExecutorObject * exec = code -> co_executors -> executors [oparg ];
726- assert (exec -> vm_data .opcode != ENTER_EXECUTOR );
727- opcode = _PyOpcode_Deopt [exec -> vm_data .opcode ];
728- opcode = exec -> vm_data .oparg ;
729- }
730- else {
731- opcode = _Py_GetBaseOpcode (code , offset );
732- }
733- assert (opcode != ENTER_EXECUTOR );
734- assert (opcode_has_event (opcode ));
735- #endif
714+ assert (opcode_has_event (_Py_GetBaseOpcode (code , offset )));
736715 _PyCoMonitoringData * monitoring = code -> _co_monitoring ;
737716 if (monitoring && monitoring -> tools ) {
738717 monitoring -> tools [offset ] &= ~tools ;
@@ -1303,16 +1282,9 @@ initialize_tools(PyCodeObject *code)
13031282 for (int i = 0 ; i < code_len ; i ++ ) {
13041283 _Py_CODEUNIT * instr = & _PyCode_CODE (code )[i ];
13051284 int opcode = instr -> op .code ;
1306- int oparg = instr -> op .arg ;
1307- if (opcode == ENTER_EXECUTOR ) {
1308- _PyExecutorObject * exec = code -> co_executors -> executors [oparg ];
1309- opcode = exec -> vm_data .opcode ;
1310- oparg = exec -> vm_data .oparg ;
1311- }
1312- else if (opcode == INSTRUMENTED_LINE ) {
1285+ if (opcode == INSTRUMENTED_LINE ) {
13131286 opcode = code -> _co_monitoring -> lines [i ].original_opcode ;
13141287 }
1315- assert (opcode != ENTER_EXECUTOR );
13161288 bool instrumented = is_instrumented (opcode );
13171289 if (instrumented ) {
13181290 opcode = DE_INSTRUMENT [opcode ];
@@ -1323,7 +1295,7 @@ initialize_tools(PyCodeObject *code)
13231295 if (instrumented ) {
13241296 int8_t event ;
13251297 if (opcode == RESUME ) {
1326- event = oparg != 0 ;
1298+ event = instr -> op . arg != 0 ;
13271299 }
13281300 else {
13291301 event = EVENT_FOR_OPCODE [opcode ];
0 commit comments