@@ -607,9 +607,12 @@ _PyJIT_translate_single_bytecode_to_trace(
607607 !(opcode == JUMP_BACKWARD_NO_INTERRUPT || opcode == JUMP_BACKWARD || opcode == JUMP_BACKWARD_JIT ) &&
608608 !(opcode == POP_JUMP_IF_TRUE || opcode == POP_JUMP_IF_FALSE || opcode == POP_JUMP_IF_NONE || opcode == POP_JUMP_IF_NOT_NONE );
609609
610+ assert (opcode != ENTER_EXECUTOR && opcode != EXTENDED_ARG );
611+
612+ const struct opcode_macro_expansion * expansion = & _PyOpcode_macro_expansion [opcode ];
610613
611- // Strange control-flow
612- if (jump_taken || opcode == WITH_EXCEPT_START || opcode == RERAISE || opcode == CLEANUP_THROW || opcode == PUSH_EXC_INFO ) {
614+ // Strange control-flow, unsupported opcode, etc.
615+ if (jump_taken || expansion -> nuops == 0 || opcode == WITH_EXCEPT_START || opcode == RERAISE || opcode == CLEANUP_THROW || opcode == PUSH_EXC_INFO ) {
613616 // Rewind to previous instruction and replace with _EXIT_TRACE.
614617 _PyUOpInstruction * curr = & trace [trace_length - 1 ];
615618 while (curr -> opcode != _SET_IP && trace_length > 1 ) {
@@ -620,10 +623,6 @@ _PyJIT_translate_single_bytecode_to_trace(
620623 curr -> opcode = _EXIT_TRACE ;
621624 goto done ;
622625 }
623-
624- assert (opcode != ENTER_EXECUTOR && opcode != EXTENDED_ARG );
625-
626- const struct opcode_macro_expansion * expansion = & _PyOpcode_macro_expansion [opcode ];
627626 RESERVE_RAW (expansion -> nuops + needs_guard_ip + 3 , "uop and various checks" );
628627
629628 ADD_TO_TRACE (_CHECK_VALIDITY , 0 , 0 , target );
@@ -692,12 +691,9 @@ _PyJIT_translate_single_bytecode_to_trace(
692691 default :
693692 {
694693 const struct opcode_macro_expansion * expansion = & _PyOpcode_macro_expansion [opcode ];
695- if (expansion -> nuops == 0 ) {
696- DPRINTF (2 , "Unsupported opcode %s\n" , _PyOpcode_OpName [opcode ]);
697- goto full ;
698- }
699694 // Reserve space for nuops (+ _SET_IP + _EXIT_TRACE)
700695 int nuops = expansion -> nuops ;
696+ assert (nuops > 0 );
701697 RESERVE (nuops + 1 ); /* One extra for exit */
702698 uint32_t orig_oparg = oparg ; // For OPARG_TOP/BOTTOM
703699 for (int i = 0 ; i < nuops ; i ++ ) {
@@ -906,6 +902,9 @@ prepare_for_execution(_PyUOpInstruction *buffer, int length)
906902 for (int i = 0 ; i < length ; i ++ ) {
907903 _PyUOpInstruction * inst = & buffer [i ];
908904 int opcode = inst -> opcode ;
905+ if (inst -> format != UOP_FORMAT_TARGET ) {
906+ fprintf (stdout , "I: %d\n" , i );
907+ }
909908 int32_t target = (int32_t )uop_get_target (inst );
910909 uint16_t exit_flags = _PyUop_Flags [opcode ] & (HAS_EXIT_FLAG | HAS_DEOPT_FLAG | HAS_PERIODIC_FLAG );
911910 if (exit_flags ) {
0 commit comments