Skip to content

Commit 525a2de

Browse files
committed
Move builtins-watched to correct scope
1 parent 91e6eae commit 525a2de

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

Include/internal/pycore_optimizer.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,6 @@ PyJitRef_IsBorrowed(JitOptRef ref)
273273
}
274274

275275
struct _Py_UOpsAbstractFrame {
276-
bool builtins_watched;
277-
// Has the globals dict of this frame been watched?
278276
bool globals_watched;
279277
// The version number of the globals dicts, once checked. 0 if unchecked.
280278
uint32_t globals_checked_version;
@@ -300,6 +298,8 @@ typedef struct _JitOptContext {
300298
char done;
301299
char out_of_space;
302300
bool contradiction;
301+
// Has the builtins dict been watched?
302+
bool builtins_watched;
303303
// The current "executing" frame.
304304
_Py_UOpsAbstractFrame *frame;
305305
_Py_UOpsAbstractFrame frames[MAX_ABSTRACT_FRAME_DEPTH];

Python/optimizer_analysis.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ optimize_uops(
320320
ctx->done = false;
321321
ctx->out_of_space = false;
322322
ctx->contradiction = false;
323+
ctx->builtins_watched = false;
323324

324325
_PyUOpInstruction *this_instr = NULL;
325326
for (int i = 0; !ctx->done; i++) {

Python/optimizer_bytecodes.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1268,9 +1268,9 @@ dummy_func(void) {
12681268
/* Do nothing */
12691269
}
12701270
else {
1271-
if (!ctx->frame->builtins_watched) {
1271+
if (!ctx->builtins_watched) {
12721272
PyDict_Watch(BUILTINS_WATCHER_ID, builtins);
1273-
ctx->frame->builtins_watched = true;
1273+
ctx->builtins_watched = true;
12741274
}
12751275
if (ctx->frame->globals_checked_version != 0 && ctx->frame->globals_watched) {
12761276
cnst = convert_global_to_const(this_instr, builtins, false);

Python/optimizer_cases.c.h

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

Python/optimizer_symbols.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,6 @@ _Py_uop_frame_new(
828828
frame->stack = frame->locals + co->co_nlocalsplus;
829829
frame->stack_pointer = frame->stack + curr_stackentries;
830830
frame->globals_checked_version = 0;
831-
frame->builtins_watched = false;
832831
frame->globals_watched = false;
833832
frame->func = NULL;
834833
ctx->n_consumed = ctx->n_consumed + (co->co_nlocalsplus + co->co_stacksize);

0 commit comments

Comments
 (0)