Skip to content

Commit f88ee3b

Browse files
committed
Revert "Update"
This reverts commit a49bcab.
1 parent a49bcab commit f88ee3b

File tree

5 files changed

+7
-20
lines changed

5 files changed

+7
-20
lines changed

Include/internal/pycore_interp_structs.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -899,6 +899,8 @@ struct _is {
899899
struct _stoptheworld_state stoptheworld;
900900
struct _qsbr_shared qsbr;
901901

902+
struct _PyUOpInstruction *jit_uop_buffer;
903+
902904
#if defined(Py_GIL_DISABLED)
903905
struct _mimalloc_interp_state mimalloc;
904906
struct _brc_state brc; // biased reference counting state
@@ -950,8 +952,6 @@ struct _is {
950952
struct callable_cache callable_cache;
951953
PyObject *common_consts[NUM_COMMON_CONSTANTS];
952954
bool jit;
953-
bool compiling;
954-
struct _PyUOpInstruction *jit_uop_buffer;
955955
struct _PyExecutorObject *executor_list_head;
956956
struct _PyExecutorObject *executor_deletion_list_head;
957957
struct _PyExecutorObject *cold_executor;

Python/bytecodes.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2961,9 +2961,7 @@ dummy_func(
29612961
start--;
29622962
}
29632963
_PyExecutorObject *executor;
2964-
assert(!_PyInterpreterState_GET()->compiling);
29652964
int optimized = _PyOptimizer_Optimize(frame, start, &executor, 0);
2966-
assert(!_PyInterpreterState_GET()->compiling);
29672965
if (optimized <= 0) {
29682966
this_instr[1].counter = restart_backoff_counter(counter);
29692967
ERROR_IF(optimized < 0);

Python/generated_cases.c.h

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

Python/optimizer.c

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,7 @@ _PyOptimizer_Optimize(
116116
_PyExecutorObject **executor_ptr, int chain_depth)
117117
{
118118
_PyStackRef *stack_pointer = frame->stackpointer;
119-
PyInterpreterState *interp = _PyInterpreterState_GET();
120-
assert(interp->jit);
121-
assert(!interp->compiling);
122-
interp->compiling = true;
119+
assert(_PyInterpreterState_GET()->jit);
123120
// The first executor in a chain and the MAX_CHAIN_DEPTH'th executor *must*
124121
// make progress in order to avoid infinite loops or excessively-long
125122
// side-exit chains. We can only insert the executor into the bytecode if
@@ -128,14 +125,12 @@ _PyOptimizer_Optimize(
128125
bool progress_needed = chain_depth == 0;
129126
PyCodeObject *code = _PyFrame_GetCode(frame);
130127
assert(PyCode_Check(code));
131-
int ret = 0;
132128
if (progress_needed && !has_space_for_executor(code, start)) {
133-
goto end;
129+
return 0;
134130
}
135131
int err = uop_optimize(frame, start, executor_ptr, (int)(stack_pointer - _PyFrame_Stackbase(frame)), progress_needed);
136132
if (err <= 0) {
137-
ret = err;
138-
goto end;
133+
return err;
139134
}
140135
assert(*executor_ptr != NULL);
141136
if (progress_needed) {
@@ -148,7 +143,7 @@ _PyOptimizer_Optimize(
148143
* it might get confused by the executor disappearing,
149144
* but there is not much we can do about that here. */
150145
Py_DECREF(*executor_ptr);
151-
goto end;
146+
return 0;
152147
}
153148
insert_executor(code, start, index, *executor_ptr);
154149
}
@@ -157,9 +152,7 @@ _PyOptimizer_Optimize(
157152
}
158153
(*executor_ptr)->vm_data.chain_depth = chain_depth;
159154
assert((*executor_ptr)->vm_data.valid);
160-
end:
161-
interp->compiling = false;
162-
return ret;
155+
return 1;
163156
}
164157

165158
static _PyExecutorObject *
@@ -1288,7 +1281,6 @@ uop_optimize(
12881281
_PyBloomFilter dependencies;
12891282
_Py_BloomFilter_Init(&dependencies);
12901283
PyInterpreterState *interp = _PyInterpreterState_GET();
1291-
assert(interp->compiling);
12921284
if (interp->jit_uop_buffer == NULL) {
12931285
interp->jit_uop_buffer = (_PyUOpInstruction *)_PyObject_VirtualAlloc(UOP_BUFFER_SIZE);
12941286
if (interp->jit_uop_buffer == NULL) {

Python/pystate.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,6 @@ init_interpreter(PyInterpreterState *interp,
577577
}
578578
interp->_code_object_generation = 0;
579579
interp->jit = false;
580-
interp->compiling = false;
581580
interp->executor_list_head = NULL;
582581
interp->executor_deletion_list_head = NULL;
583582
interp->executor_deletion_list_remaining_capacity = 0;

0 commit comments

Comments
 (0)