Skip to content

Commit e723700

Browse files
authored
Rename ...Uop... to ...UOp... (uppercase O) for consistency (#112327)
* Rename _PyUopExecute to _PyUOpExecute (uppercase O) for consistency * Also rename _PyUopName and _PyUOp_Replacements, and some output strings
1 parent e413daf commit e723700

File tree

5 files changed

+23
-23
lines changed

5 files changed

+23
-23
lines changed

Include/internal/pycore_uops.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ typedef struct {
2424
_PyUOpInstruction trace[1];
2525
} _PyUOpExecutorObject;
2626

27-
_PyInterpreterFrame *_PyUopExecute(
27+
_PyInterpreterFrame *_PyUOpExecute(
2828
_PyExecutorObject *executor,
2929
_PyInterpreterFrame *frame,
3030
PyObject **stack_pointer);

Python/bytecodes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2357,7 +2357,7 @@ dummy_func(
23572357
JUMPBY(1-original_oparg);
23582358
frame->instr_ptr = next_instr;
23592359
Py_INCREF(executor);
2360-
if (executor->execute == _PyUopExecute) {
2360+
if (executor->execute == _PyUOpExecute) {
23612361
current_executor = (_PyUOpExecutorObject *)executor;
23622362
GOTO_TIER_TWO();
23632363
}

Python/ceval.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ static const _Py_CODEUNIT _Py_INTERPRETER_TRAMPOLINE_INSTRUCTIONS[] = {
647647

648648
extern const struct _PyCode_DEF(8) _Py_InitCleanup;
649649

650-
extern const char *_PyUopName(int index);
650+
extern const char *_PyUOpName(int index);
651651

652652
/* Disable unused label warnings. They are handy for debugging, even
653653
if computed gotos aren't used. */
@@ -1002,7 +1002,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
10021002
DPRINTF(3,
10031003
"%4d: uop %s, oparg %d, operand %" PRIu64 ", target %d, stack_level %d\n",
10041004
(int)(next_uop - current_executor->trace),
1005-
_PyUopName(uopcode),
1005+
_PyUOpName(uopcode),
10061006
next_uop->oparg,
10071007
next_uop->operand,
10081008
next_uop->target,
@@ -1051,8 +1051,8 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
10511051
pop_1_error_tier_two:
10521052
STACK_SHRINK(1);
10531053
error_tier_two:
1054-
DPRINTF(2, "Error: [Uop %d (%s), oparg %d, operand %" PRIu64 ", target %d @ %d]\n",
1055-
uopcode, _PyUopName(uopcode), next_uop[-1].oparg, next_uop[-1].operand, next_uop[-1].target,
1054+
DPRINTF(2, "Error: [UOp %d (%s), oparg %d, operand %" PRIu64 ", target %d @ %d]\n",
1055+
uopcode, _PyUOpName(uopcode), next_uop[-1].oparg, next_uop[-1].operand, next_uop[-1].target,
10561056
(int)(next_uop - current_executor->trace - 1));
10571057
OPT_HIST(trace_uop_execution_counter, trace_run_length_hist);
10581058
frame->return_offset = 0; // Don't leave this random
@@ -1064,8 +1064,8 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
10641064
deoptimize:
10651065
// On DEOPT_IF we just repeat the last instruction.
10661066
// This presumes nothing was popped from the stack (nor pushed).
1067-
DPRINTF(2, "DEOPT: [Uop %d (%s), oparg %d, operand %" PRIu64 ", target %d @ %d]\n",
1068-
uopcode, _PyUopName(uopcode), next_uop[-1].oparg, next_uop[-1].operand, next_uop[-1].target,
1067+
DPRINTF(2, "DEOPT: [UOp %d (%s), oparg %d, operand %" PRIu64 ", target %d @ %d]\n",
1068+
uopcode, _PyUOpName(uopcode), next_uop[-1].oparg, next_uop[-1].operand, next_uop[-1].target,
10691069
(int)(next_uop - current_executor->trace - 1));
10701070
OPT_HIST(trace_uop_execution_counter, trace_run_length_hist);
10711071
UOP_STAT_INC(uopcode, miss);

Python/generated_cases.c.h

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/optimizer.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ uop_dealloc(_PyUOpExecutorObject *self) {
325325
}
326326

327327
const char *
328-
_PyUopName(int index)
328+
_PyUOpName(int index)
329329
{
330330
if (index <= MAX_REAL_OPCODE) {
331331
return _PyOpcode_OpName[index];
@@ -347,7 +347,7 @@ uop_item(_PyUOpExecutorObject *self, Py_ssize_t index)
347347
PyErr_SetNone(PyExc_IndexError);
348348
return NULL;
349349
}
350-
const char *name = _PyUopName(self->trace[index].opcode);
350+
const char *name = _PyUOpName(self->trace[index].opcode);
351351
if (name == NULL) {
352352
name = "<nil>";
353353
}
@@ -388,7 +388,7 @@ PyTypeObject _PyUOpExecutor_Type = {
388388

389389
/* TO DO -- Generate these tables */
390390
static const uint16_t
391-
_PyUop_Replacements[OPCODE_METADATA_SIZE] = {
391+
_PyUOp_Replacements[OPCODE_METADATA_SIZE] = {
392392
[_ITER_JUMP_RANGE] = _GUARD_NOT_EXHAUSTED_RANGE,
393393
[_ITER_JUMP_LIST] = _GUARD_NOT_EXHAUSTED_LIST,
394394
[_ITER_JUMP_TUPLE] = _GUARD_NOT_EXHAUSTED_TUPLE,
@@ -451,7 +451,7 @@ translate_bytecode_to_trace(
451451
#define ADD_TO_TRACE(OPCODE, OPARG, OPERAND, TARGET) \
452452
DPRINTF(2, \
453453
" ADD_TO_TRACE(%s, %d, %" PRIu64 ")\n", \
454-
_PyUopName(OPCODE), \
454+
_PyUOpName(OPCODE), \
455455
(OPARG), \
456456
(uint64_t)(OPERAND)); \
457457
assert(trace_length < max_length); \
@@ -474,7 +474,7 @@ translate_bytecode_to_trace(
474474
}
475475

476476
// Reserve space for N uops, plus 3 for _SET_IP, _CHECK_VALIDITY and _EXIT_TRACE
477-
#define RESERVE(needed) RESERVE_RAW((needed) + 3, _PyUopName(opcode))
477+
#define RESERVE(needed) RESERVE_RAW((needed) + 3, _PyUOpName(opcode))
478478

479479
// Trace stack operations (used by _PUSH_FRAME, _POP_FRAME)
480480
#define TRACE_STACK_PUSH() \
@@ -546,8 +546,8 @@ translate_bytecode_to_trace(
546546
uint32_t uopcode = BRANCH_TO_GUARD[opcode - POP_JUMP_IF_FALSE][jump_likely];
547547
_Py_CODEUNIT *next_instr = instr + 1 + _PyOpcode_Caches[_PyOpcode_Deopt[opcode]];
548548
DPRINTF(4, "%s(%d): counter=%x, bitcount=%d, likely=%d, uopcode=%s\n",
549-
_PyUopName(opcode), oparg,
550-
counter, bitcount, jump_likely, _PyUopName(uopcode));
549+
_PyUOpName(opcode), oparg,
550+
counter, bitcount, jump_likely, _PyUOpName(uopcode));
551551
ADD_TO_TRACE(uopcode, max_length, 0, target);
552552
if (jump_likely) {
553553
_Py_CODEUNIT *target_instr = next_instr + oparg;
@@ -615,8 +615,8 @@ translate_bytecode_to_trace(
615615
oparg += extras;
616616
}
617617
}
618-
if (_PyUop_Replacements[uop]) {
619-
uop = _PyUop_Replacements[uop];
618+
if (_PyUOp_Replacements[uop]) {
619+
uop = _PyUOp_Replacements[uop];
620620
if (uop == _FOR_ITER_TIER_TWO) {
621621
target += 1 + INLINE_CACHE_ENTRIES_FOR_ITER + oparg + 1;
622622
assert(_PyCode_CODE(code)[target-1].op.code == END_FOR ||
@@ -712,7 +712,7 @@ translate_bytecode_to_trace(
712712
}
713713
break;
714714
}
715-
DPRINTF(2, "Unsupported opcode %s\n", _PyUopName(opcode));
715+
DPRINTF(2, "Unsupported opcode %s\n", _PyUOpName(opcode));
716716
OPT_UNSUPPORTED_OPCODE(opcode);
717717
goto done; // Break out of loop
718718
} // End default
@@ -832,7 +832,7 @@ make_executor_from_uops(_PyUOpInstruction *buffer, _PyBloomFilter *dependencies)
832832
dest--;
833833
}
834834
assert(dest == -1);
835-
executor->base.execute = _PyUopExecute;
835+
executor->base.execute = _PyUOpExecute;
836836
_Py_ExecutorInit((_PyExecutorObject *)executor, dependencies);
837837
#ifdef Py_DEBUG
838838
char *python_lltrace = Py_GETENV("PYTHON_LLTRACE");
@@ -845,7 +845,7 @@ make_executor_from_uops(_PyUOpInstruction *buffer, _PyBloomFilter *dependencies)
845845
for (int i = 0; i < length; i++) {
846846
printf("%4d %s(%d, %d, %" PRIu64 ")\n",
847847
i,
848-
_PyUopName(executor->trace[i].opcode),
848+
_PyUOpName(executor->trace[i].opcode),
849849
executor->trace[i].oparg,
850850
executor->trace[i].target,
851851
executor->trace[i].operand);
@@ -888,11 +888,11 @@ uop_optimize(
888888
return 1;
889889
}
890890

891-
/* Dummy execute() function for Uop Executor.
891+
/* Dummy execute() function for UOp Executor.
892892
* The actual implementation is inlined in ceval.c,
893893
* in _PyEval_EvalFrameDefault(). */
894894
_PyInterpreterFrame *
895-
_PyUopExecute(_PyExecutorObject *executor, _PyInterpreterFrame *frame, PyObject **stack_pointer)
895+
_PyUOpExecute(_PyExecutorObject *executor, _PyInterpreterFrame *frame, PyObject **stack_pointer)
896896
{
897897
Py_FatalError("Tier 2 is now inlined into Tier 1");
898898
}

0 commit comments

Comments
 (0)