Skip to content

Commit d55f4c9

Browse files
committed
Fix up name confusion
1 parent 7cb9f6a commit d55f4c9

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

Python/optimizer_analysis.c

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ remove_globals(_PyInterpreterFrame *frame, _PyUOpInstruction *buffer,
155155
/* These values represent stacks of booleans (one bool per bit).
156156
* Pushing a frame shifts left, popping a frame shifts right. */
157157
uint32_t function_checked = 0;
158-
uint32_t globals_checked = 0;
158+
uint32_t builtins_watched = 0;
159159
uint32_t globals_watched = 0;
160160
uint32_t prechecked_function_version = 0;
161161
if (interp->dict_state.watchers[GLOBALS_WATCHER_ID] == NULL) {
@@ -172,9 +172,9 @@ remove_globals(_PyInterpreterFrame *frame, _PyUOpInstruction *buffer,
172172
if (interp->rare_events.builtin_dict >= _Py_MAX_ALLOWED_BUILTINS_MODIFICATIONS) {
173173
continue;
174174
}
175-
if ((function_checked & 1) == 0) {
175+
if ((builtins_watched & 1) == 0) {
176176
PyDict_Watch(BUILTINS_WATCHER_ID, builtins);
177-
function_checked |= 1;
177+
builtins_watched |= 1;
178178
}
179179
if (function_checked & 1) {
180180
buffer[pc].opcode = NOP;
@@ -198,39 +198,39 @@ remove_globals(_PyInterpreterFrame *frame, _PyUOpInstruction *buffer,
198198
_Py_BloomFilter_Add(dependencies, globals);
199199
globals_watched |= 1;
200200
}
201-
if (globals_checked & 1) {
201+
if (function_checked & 1) {
202202
buffer[pc].opcode = NOP;
203203
}
204204
else {
205205
buffer[pc].opcode = _CHECK_FUNCTION;
206206
buffer[pc].operand = (uintptr_t)globals;
207-
globals_checked |= 1;
207+
function_checked |= 1;
208208
}
209209
break;
210210
case _LOAD_GLOBAL_BUILTINS:
211-
if (globals_checked & function_checked & globals_watched & 1) {
211+
if (function_checked & globals_watched & builtins_watched & 1) {
212212
convert_global_to_const(inst, builtins);
213213
}
214214
break;
215215
case _LOAD_GLOBAL_MODULE:
216-
if (globals_checked & globals_watched & 1) {
216+
if (function_checked & globals_watched & 1) {
217217
convert_global_to_const(inst, globals);
218218
}
219219
break;
220220
case _PUSH_FRAME:
221221
{
222-
globals_checked <<= 1;
222+
builtins_watched <<= 1;
223223
globals_watched <<= 1;
224224
function_checked <<= 1;
225225
PyFunctionObject *func = (PyFunctionObject *)buffer[pc].operand;
226226
if (func == NULL) {
227227
return 1;
228228
}
229+
assert(PyFunction_Check(func));
229230
if (prechecked_function_version == func->func_version) {
230231
function_checked |= 1;
231232
}
232233
prechecked_function_version = 0;
233-
assert(PyFunction_Check(func));
234234
globals = func->func_globals;
235235
builtins = func->func_builtins;
236236
if (builtins != interp->builtins) {
@@ -240,7 +240,7 @@ remove_globals(_PyInterpreterFrame *frame, _PyUOpInstruction *buffer,
240240
}
241241
case _POP_FRAME:
242242
{
243-
globals_checked >>= 1;
243+
builtins_watched >>= 1;
244244
globals_watched >>= 1;
245245
function_checked >>= 1;
246246
PyFunctionObject *func = (PyFunctionObject *)buffer[pc].operand;
@@ -252,8 +252,6 @@ remove_globals(_PyInterpreterFrame *frame, _PyUOpInstruction *buffer,
252252
case _CHECK_FUNCTION_EXACT_ARGS:
253253
prechecked_function_version = (uint32_t)buffer[pc].operand;
254254
break;
255-
case _SAVE_RETURN_OFFSET:
256-
break;
257255
default:
258256
if (op_is_end(opcode)) {
259257
return 1;

0 commit comments

Comments
 (0)