8000 Separate opcode and uopcode variables · python/cpython@badfdf2 · GitHub
[go: up one dir, main page]

Skip to content
/ cpython Public

Commit badfdf2

Browse files
committed
Separate opcode and uopcode variables
1 parent 7e8f4fc commit badfdf2

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

Python/ceval.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
678678
#ifdef Py_STATS
679679
int lastopcode = 0;
680680
#endif
681-
uint16_t opcode; /* Current opcode */
681+
uint8_t opcode; /* Current opcode */
682682
int oparg; /* Current opcode argument, if any */
683683
#ifdef LLTRACE
684684
int lltrace = 0;
@@ -983,30 +983,31 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
983983

984984
OPT_STAT_INC(traces_executed);
985985
_PyUOpInstruction *next_uop = current_executor->trace;
986+
uint16_t uopcode;
986987
uint64_t operand;
987988
#ifdef Py_STATS
988989
uint64_t trace_uop_execution_counter = 0;
989990
#endif
990991

991992
for (;;) {
992-
opcode = next_uop->opcode;
993+
uopcode = next_uop->opcode;
993994
oparg = next_uop->oparg;
994995
operand = next_uop->operand;
995996
DPRINTF(3,
996997
"%4d: uop %s, oparg %d, operand %" PRIu64 ", stack_level %d\n",
997998
(int)(next_uop - current_executor->trace),
998-
opcode < 256 ? _PyOpcode_OpName[opcode] : _PyOpcode_uop_name[opcode],
999+
uopcode < 256 ? _PyOpcode_OpName[uopcode] : _PyOpcode_uop_name[uopcode],
9991000
oparg,
10001001
operand,
10011002
(int)(stack_pointer - _PyFrame_Stackbase(frame)));
10021003
next_uop++;
10031004
OPT_STAT_INC(uops_executed);
1004-
UOP_STAT_INC(opcode, execution_count);
1005+
UOP_STAT_INC(uopcode, execution_count);
10051006
#ifdef Py_STATS
10061007
trace_uop_execution_counter++;
10071008
#endif
10081009

1009-
switch (opcode) {
1010+
switch (uopcode) {
10101011

10111012
#include "executor_cases.c.h"
10121013

@@ -1042,7 +1043,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
10421043
pop_1_error_tier_two:
10431044
STACK_SHRINK(1);
10441045
error_tier_two:
1045-
DPRINTF(2, "Error: [Opcode %d, operand %" PRIu64 "]\n", opcode, operand);
1046+
DPRINTF(2, "Error: [Opcode %d, operand %" PRIu64 "]\n", uopcode, operand);
10461047
OPT_HIST(trace_uop_execution_counter, trace_run_length_hist);
10471048
frame->return_offset = 0; // Don't leave this random
10481049
_PyFrame_SetStackPointer(frame, stack_pointer);
@@ -1053,9 +1054,9 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
10531054
deoptimize:
10541055
// On DEOPT_IF we just repeat the last instruction.
10551056
// This presumes nothing was popped from the stack (nor pushed).
1056-
DPRINTF(2, "DEOPT: [Opcode %d, operand %" PRIu64 " @ %d]\n", opcode, operand, (int)(next_uop-current_executor->trace-1));
1057+
DPRINTF(2, "DEOPT: [Opcode %d, operand %" PRIu64 " @ %d]\n", uopcode, operand, (int)(next_uop-current_executor->trace-1));
10571058
OPT_HIST(trace_uop_execution_counter, trace_run_length_hist);
1058-
UOP_STAT_INC(opcode, miss);
1059+
UOP_STAT_INC(uopcode, miss);
10591060
frame->return_offset = 0; // Dispatch to frame->instr_ptr
10601061
_PyFrame_SetStackPointer(frame, stack_pointer);
10611062
frame->instr_ptr = next_uop[-1].target + _PyCode_CODE((PyCodeObject *)frame->f_executable);

0 commit comments

Comments
 (0)
0