Skip to content

Commit f0733d9

Browse files
Rename operand to operand0
1 parent 6d6263c commit f0733d9

File tree

12 files changed

+114
-117
lines changed

12 files changed

+114
-117
lines changed

Include/internal/pycore_optimizer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ typedef struct {
5858
uint16_t error_target;
5959
};
6060
};
61-
uint64_t operand; // A cache entry
61+
uint64_t operand0; // A cache entry
6262
uint64_t operand1;
6363
} _PyUOpInstruction;
6464

Python/bytecodes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,7 @@ dummy_func(
637637
assert(next_instr->op.code == STORE_FAST);
638638
next_oparg = next_instr->op.arg;
639639
#else
640-
next_oparg = CURRENT_OPERAND();
640+
next_oparg = CURRENT_OPERAND0();
641641
#endif
642642
_PyStackRef *target_local = &GETLOCAL(next_oparg);
643643
DEOPT_IF(!PyStackRef_Is(*target_local, left));

Python/executor_cases.c.h

Lines changed: 49 additions & 49 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -288,13 +288,13 @@ _PyUOpPrint(const _PyUOpInstruction *uop)
288288
printf(" (%d, target=%d, operand=%#" PRIx64,
289289
uop->oparg,
290290
uop->target,
291-
(uint64_t)uop->operand);
291+
(uint64_t)uop->operand0);
292292
break;
293293
case UOP_FORMAT_JUMP:
294294
printf(" (%d, jump_target=%d, operand=%#" PRIx64,
295295
uop->oparg,
296296
uop->jump_target,
297-
(uint64_t)uop->operand);
297+
(uint64_t)uop->operand0);
298298
break;
299299
default:
300300
printf(" (%d, Unknown format)", uop->oparg);
@@ -340,7 +340,7 @@ uop_item(_PyExecutorObject *self, Py_ssize_t index)
340340
Py_DECREF(oname);
341341
return NULL;
342342
}
343-
PyObject *operand = PyLong_FromUnsignedLongLong(self->trace[index].operand);
343+
PyObject *operand = PyLong_FromUnsignedLongLong(self->trace[index].operand0);
344344
if (operand == NULL) {
345345
Py_DECREF(target);
346346
Py_DECREF(oparg);
@@ -463,7 +463,7 @@ add_to_trace(
463463
trace[trace_length].format = UOP_FORMAT_TARGET;
464464
trace[trace_length].target = target;
465465
trace[trace_length].oparg = oparg;
466-
trace[trace_length].operand = operand;
466+
trace[trace_length].operand0 = operand;
467467
return trace_length + 1;
468468
}
469469

@@ -970,7 +970,7 @@ static void make_exit(_PyUOpInstruction *inst, int opcode, int target)
970970
{
971971
inst->opcode = opcode;
972972
inst->oparg = 0;
973-
inst->operand = 0;
973+
inst->operand0 = 0;
974974
inst->format = UOP_FORMAT_TARGET;
975975
inst->target = target;
976976
}
@@ -1033,7 +1033,7 @@ prepare_for_execution(_PyUOpInstruction *buffer, int length)
10331033
current_error_target = target;
10341034
make_exit(&buffer[next_spare], _ERROR_POP_N, 0);
10351035
buffer[next_spare].oparg = popped;
1036-
buffer[next_spare].operand = target;
1036+
buffer[next_spare].operand0 = target;
10371037
next_spare++;
10381038
}
10391039
buffer[i].error_target = current_error;
@@ -1150,7 +1150,7 @@ make_executor_from_uops(_PyUOpInstruction *buffer, int length, const _PyBloomFil
11501150
int next_exit = exit_count-1;
11511151
_PyUOpInstruction *dest = (_PyUOpInstruction *)&executor->trace[length];
11521152
assert(buffer[0].opcode == _START_EXECUTOR);
1153-
buffer[0].operand = (uint64_t)executor;
1153+
buffer[0].operand0 = (uint64_t)executor;
11541154
for (int i = length-1; i >= 0; i--) {
11551155
int opcode = buffer[i].opcode;
11561156
dest--;
@@ -1159,13 +1159,13 @@ make_executor_from_uops(_PyUOpInstruction *buffer, int length, const _PyBloomFil
11591159
if (opcode == _EXIT_TRACE) {
11601160
_PyExitData *exit = &executor->exits[next_exit];
11611161
exit->target = buffer[i].target;
1162-
dest->operand = (uint64_t)exit;
1162+
dest->operand0 = (uint64_t)exit;
11631163
next_exit--;
11641164
}
11651165
if (opcode == _DYNAMIC_EXIT) {
11661166
_PyExitData *exit = &executor->exits[next_exit];
11671167
exit->target = 0;
1168-
dest->operand = (uint64_t)exit;
1168+
dest->operand0 = (uint64_t)exit;
11691169
next_exit--;
11701170
}
11711171
}
@@ -1312,7 +1312,7 @@ _PyOptimizer_NewUOpOptimizer(void)
13121312
static void
13131313
counter_dealloc(_PyExecutorObject *self) {
13141314
/* The optimizer is the operand of the second uop. */
1315-
PyObject *opt = (PyObject *)self->trace[1].operand;
1315+
PyObject *opt = (PyObject *)self->trace[1].operand0;
13161316
Py_DECREF(opt);
13171317
uop_dealloc(self);
13181318
}
@@ -1352,7 +1352,7 @@ counter_optimize(
13521352
_Py_CODEUNIT *target = instr + 1 + _PyOpcode_Caches[JUMP_BACKWARD] - oparg;
13531353
_PyUOpInstruction buffer[4] = {
13541354
{ .opcode = _START_EXECUTOR, .jump_target = 3, .format=UOP_FORMAT_JUMP },
1355-
{ .opcode = _LOAD_CONST_INLINE, .operand = (uintptr_t)self },
1355+
{ .opcode = _LOAD_CONST_INLINE, .operand0 = (uintptr_t)self },
13561356
{ .opcode = _INTERNAL_INCREMENT_OPT_COUNTER },
13571357
{ .opcode = _EXIT_TRACE, .target = (uint32_t)(target - _PyCode_CODE(code)), .format=UOP_FORMAT_TARGET }
13581358
};

Python/optimizer_analysis.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,11 @@ convert_global_to_const(_PyUOpInstruction *inst, PyObject *obj)
100100
PyDictObject *dict = (PyDictObject *)obj;
101101
assert(dict->ma_keys->dk_kind == DICT_KEYS_UNICODE);
102102
PyDictUnicodeEntry *entries = DK_UNICODE_ENTRIES(dict->ma_keys);
103-
assert(inst->operand <= UINT16_MAX);
104-
if ((int)inst->operand >= dict->ma_keys->dk_nentries) {
103+
assert(inst->operand0 <= UINT16_MAX);
104+
if ((int)inst->operand0 >= dict->ma_keys->dk_nentries) {
105105
return NULL;
106106
}
107-
PyObject *res = entries[inst->operand].me_value;
107+
PyObject *res = entries[inst->operand0].me_value;
108108
if (res == NULL) {
109109
return NULL;
110110
}
@@ -114,7 +114,7 @@ convert_global_to_const(_PyUOpInstruction *inst, PyObject *obj)
114114
else {
115115
inst->opcode = (inst->oparg & 1) ? _LOAD_CONST_INLINE_WITH_NULL : _LOAD_CONST_INLINE;
116116
}
117-
inst->operand = (uint64_t)res;
117+
inst->operand0 = (uint64_t)res;
118118
return res;
119119
}
120120

@@ -125,7 +125,7 @@ incorrect_keys(_PyUOpInstruction *inst, PyObject *obj)
125125
return 1;
126126
}
127127
PyDictObject *dict = (PyDictObject *)obj;
128-
if (dict->ma_keys->dk_version != inst->operand) {
128+
if (dict->ma_keys->dk_version != inst->operand0) {
129129
return 1;
130130
}
131131
return 0;
@@ -215,7 +215,7 @@ remove_globals(_PyInterpreterFrame *frame, _PyUOpInstruction *buffer,
215215
}
216216
else {
217217
buffer[pc].opcode = _CHECK_FUNCTION;
218-
buffer[pc].operand = function_version;
218+
buffer[pc].operand0 = function_version;
219219
function_checked |= 1;
220220
}
221221
// We're no longer pushing the builtins keys; rewrite the
@@ -248,7 +248,7 @@ remove_globals(_PyInterpreterFrame *frame, _PyUOpInstruction *buffer,
248248
}
249249
else {
250250
buffer[pc].opcode = _CHECK_FUNCTION;
251-
buffer[pc].operand = function_version;
251+
buffer[pc].operand0 = function_version;
252252
function_checked |= 1;
253253
}
254254
if (opcode == _GUARD_GLOBALS_VERSION_PUSH_KEYS) {
@@ -273,7 +273,7 @@ remove_globals(_PyInterpreterFrame *frame, _PyUOpInstruction *buffer,
273273
builtins_watched <<= 1;
274274
globals_watched <<= 1;
275275
function_checked <<= 1;
276-
uint64_t operand = buffer[pc].operand;
276+
uint64_t operand = buffer[pc].operand0;
277277
if (operand == 0 || (operand & 1)) {
278278
// It's either a code object or NULL, so bail
279279
return 1;
@@ -301,7 +301,7 @@ remove_globals(_PyInterpreterFrame *frame, _PyUOpInstruction *buffer,
301301
builtins_watched >>= 1;
302302
globals_watched >>= 1;
303303
function_checked >>= 1;
304-
uint64_t operand = buffer[pc].operand;
304+
uint64_t operand = buffer[pc].operand0;
305305
if (operand == 0 || (operand & 1)) {
306306
// It's either a code object or NULL, so bail
307307
return 1;
@@ -317,7 +317,7 @@ remove_globals(_PyInterpreterFrame *frame, _PyUOpInstruction *buffer,
317317
break;
318318
}
319319
case _CHECK_FUNCTION_EXACT_ARGS:
320-
prechecked_function_version = (uint32_t)buffer[pc].operand;
320+
prechecked_function_version = (uint32_t)buffer[pc].operand0;
321321
break;
322322
default:
323323
if (is_terminator(inst)) {
@@ -343,7 +343,7 @@ remove_globals(_PyInterpreterFrame *frame, _PyUOpInstruction *buffer,
343343
#define REPLACE_OP(INST, OP, ARG, OPERAND) \
344344
INST->opcode = OP; \
345345
INST->oparg = ARG; \
346-
INST->operand = OPERAND;
346+
INST->operand0 = OPERAND;
347347

348348
/* Shortened forms for convenience, used in optimizer_bytecodes.c */
349349
#define sym_is_not_null _Py_uop_sym_is_not_null
@@ -409,7 +409,7 @@ get_code(_PyUOpInstruction *op)
409409
{
410410
assert(op->opcode == _PUSH_FRAME || op->opcode == _RETURN_VALUE || op->opcode == _RETURN_GENERATOR);
411411
PyCodeObject *co = NULL;
412-
uint64_t operand = op->operand;
412+
uint64_t operand = op->operand0;
413413
if (operand == 0) {
414414
return NULL;
415415
}
@@ -429,7 +429,7 @@ static PyCodeObject *
429429
get_code_with_logging(_PyUOpInstruction *op)
430430
{
431431
PyCodeObject *co = NULL;
432-
uint64_t push_operand = op->operand;
432+
uint64_t push_operand = op->operand0;
433433
if (push_operand & 1) {
434434
co = (PyCodeObject *)(push_operand & ~1);
435435
DPRINTF(3, "code=%p ", co);
@@ -534,7 +534,7 @@ optimize_uops(
534534
assert(max_space <= INT_MAX);
535535
assert(max_space <= INT32_MAX);
536536
first_valid_check_stack->opcode = _CHECK_STACK_SPACE_OPERAND;
537-
first_valid_check_stack->operand = max_space;
537+
first_valid_check_stack->operand0 = max_space;
538538
}
539539
return trace_len;
540540

Python/optimizer_bytecodes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ dummy_func(void) {
346346
res = sym_new_type(ctx, &PyUnicode_Type);
347347
}
348348
// _STORE_FAST:
349-
GETLOCAL(this_instr->operand) = res;
349+
GETLOCAL(this_instr->operand0) = res;
350350
}
351351

352352
op(_BINARY_SUBSCR_INIT_CALL, (container, sub -- new_frame: _Py_UOpsAbstractFrame *)) {

0 commit comments

Comments
 (0)