@@ -689,7 +689,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
689
689
#ifdef Py_STATS
690
690
int lastopcode = 0 ;
691
691
#endif
692
- int opcode ; /* Current opcode */
692
+ uint8_t opcode ; /* Current opcode */
693
693
int oparg ; /* Current opcode argument, if any */
694
694
#ifdef LLTRACE
695
695
int lltrace = 0 ;
@@ -776,9 +776,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
776
776
/* Start instructions */
777
777
#if !USE_COMPUTED_GOTOS
778
778
dispatch_opcode :
779
- // Cast to an 8-bit value to improve the code generated by MSVC
780
- // (in combination with the EXTRA_CASES macro).
781
- switch ((uint8_t )opcode )
779
+ switch (opcode )
782
780
#endif
783
781
{
784
782
@@ -822,7 +820,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
822
820
#if USE_COMPUTED_GOTOS
823
821
_unknown_opcode :
824
822
#else
825
- EXTRA_CASES // From pycore_opcode .h, a 'case' for each unused opcode
823
+ EXTRA_CASES // From pycore_opcode_metadata .h, a 'case' for each unused opcode
826
824
#endif
827
825
/* Tell C compilers not to hold the opcode variable in the loop.
828
826
next_instr points the current instruction without TARGET(). */
@@ -994,28 +992,29 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
994
992
995
993
OPT_STAT_INC (traces_executed );
996
994
_PyUOpInstruction * next_uop = current_executor -> trace ;
995
+ uint16_t uopcode ;
997
996
#ifdef Py_STATS
998
997
uint64_t trace_uop_execution_counter = 0 ;
999
998
#endif
1000
999
1001
1000
for (;;) {
1002
- opcode = next_uop -> opcode ;
1001
+ uopcode = next_uop -> opcode ;
1003
1002
DPRINTF (3 ,
1004
1003
"%4d: uop %s, oparg %d, operand %" PRIu64 ", target %d, stack_level %d\n" ,
1005
1004
(int )(next_uop - current_executor -> trace ),
1006
- _PyUopName (opcode ),
1005
+ _PyUopName (uopcode ),
1007
1006
next_uop -> oparg ,
1008
1007
next_uop -> operand ,
1009
1008
next_uop -> target ,
1010
1009
(int )(stack_pointer - _PyFrame_Stackbase (frame )));
1011
1010
next_uop ++ ;
1012
1011
OPT_STAT_INC (uops_executed );
1013
- UOP_STAT_INC (opcode , execution_count );
1012
+ UOP_STAT_INC (uopcode , execution_count );
1014
1013
#ifdef Py_STATS
1015
1014
trace_uop_execution_counter ++ ;
1016
1015
#endif
1017
1016
1018
- switch (opcode ) {
1017
+ switch (uopcode ) {
1019
1018
1020
1019
#include "executor_cases.c.h"
1021
1020
@@ -1053,7 +1052,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
1053
1052
STACK_SHRINK (1 );
1054
1053
error_tier_two :
1055
1054
DPRINTF (2 , "Error: [Uop %d (%s), oparg %d, operand %" PRIu64 ", target %d @ %d]\n" ,
1056
- opcode , _PyUopName (opcode ), next_uop [-1 ].oparg , next_uop [-1 ].operand , next_uop [-1 ].target ,
1055
+ uopcode , _PyUopName (uopcode ), next_uop [-1 ].oparg , next_uop [-1 ].operand , next_uop [-1 ].target ,
1057
1056
(int )(next_uop - current_executor -> trace - 1 ));
1058
1057
OPT_HIST (trace_uop_execution_counter , trace_run_length_hist );
1059
1058
frame -> return_offset = 0 ; // Don't leave this random
@@ -1066,10 +1065,10 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
1066
1065
// On DEOPT_IF we just repeat the last instruction.
1067
1066
// This presumes nothing was popped from the stack (nor pushed).
1068
1067
DPRINTF (2 , "DEOPT: [Uop %d (%s), oparg %d, operand %" PRIu64 ", target %d @ %d]\n" ,
1069
- opcode , _PyUopName (opcode ), next_uop [-1 ].oparg , next_uop [-1 ].operand , next_uop [-1 ].target ,
1068
+ uopcode , _PyUopName (uopcode ), next_uop [-1 ].oparg , next_uop [-1 ].operand , next_uop [-1 ].target ,
1070
1069
(int )(next_uop - current_executor -> trace - 1 ));
1071
1070
OPT_HIST (trace_uop_execution_counter , trace_run_length_hist );
1072
- UOP_STAT_INC (opcode , miss );
1071
+ UOP_STAT_INC (uopcode , miss );
1073
1072
frame -> return_offset = 0 ; // Dispatch to frame->instr_ptr
1074
1073
_PyFrame_SetStackPointer (frame , stack_pointer );
1075
1074
frame -> instr_ptr = next_uop [-1 ].target + _PyCode_CODE (_PyFrame_GetCode (frame ));
0 commit comments