Skip to content

Commit 44356d6

Browse files
Address review, remove more refcounting
1 parent 3ef237b commit 44356d6

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
Add free-threading support to the JIT. Patch by Ken Jin.
1+
Add free-threading support to the JIT. The JIT is only enabled on
2+
single-threaded code in free-threading, and is disabled when multiple
3+
threads are spawned. Patch by Ken Jin.

Python/optimizer.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ get_index_for_executor(PyCodeObject *code, _Py_CODEUNIT *instr)
9393
static void
9494
insert_executor(PyCodeObject *code, _Py_CODEUNIT *instr, int index, _PyExecutorObject *executor)
9595
{
96-
Py_INCREF(executor);
9796
if (instr->op.code == ENTER_EXECUTOR) {
9897
assert(index == instr->op.arg);
9998
_Py_ExecutorDetach(code->co_executors->executors[index]);
@@ -209,7 +208,6 @@ get_executor_lock_held(PyCodeObject *code, int offset)
209208
if (_PyCode_CODE(code)[i].op.code == ENTER_EXECUTOR && i*2 == offset) {
210209
int oparg = _PyCode_CODE(code)[i].op.arg;
211210
_PyExecutorObject *res = code->co_executors->executors[oparg];
212-
Py_INCREF(res);
213211
return res;
214212
}
215213
i += _PyInstruction_GetLength(code, i);
@@ -1638,14 +1636,12 @@ _PyExecutor_ClearExit(_PyExitData *exit)
16381636
if (exit == NULL) {
16391637
return;
16401638
}
1641-
_PyExecutorObject *old = exit->executor;
16421639
if (exit->is_dynamic) {
16431640
exit->executor = _PyExecutor_GetColdDynamicExecutor();
16441641
}
16451642
else {
16461643
exit->executor = _PyExecutor_GetColdExecutor();
16471644
}
1648-
Py_DECREF(old);
16491645
}
16501646

16511647
/* Detaches the executor from the code object (if any) that
@@ -1683,7 +1679,6 @@ executor_clear(PyObject *op)
16831679
_PyExecutorObject *cold = _PyExecutor_GetColdExecutor();
16841680
for (uint32_t i = 0; i < executor->exit_count; i++) {
16851681
executor->exits[i].temperature = initial_unreachable_backoff_counter();
1686-
_PyExecutorObject *e = executor->exits[i].executor;
16871682
executor->exits[i].executor = cold;
16881683
}
16891684
_Py_ExecutorDetach(executor);

Python/pylifecycle.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ builtins_dict_watcher(PyDict_WatchEvent event, PyObject *dict, PyObject *key, Py
606606
PyInterpreterState *interp = _PyInterpreterState_GET();
607607
#ifdef _Py_TIER2
608608
if (interp->rare_events.builtin_dict < _Py_MAX_ALLOWED_BUILTINS_MODIFICATIONS) {
609-
_Py_Executors_InvalidateAll(_PyInterpreterState_GET(), 1);
609+
_Py_Executors_InvalidateAll(interp, 1);
610610
}
611611
#endif
612612
RARE_EVENT_INTERP_INC(interp, builtin_dict);

0 commit comments

Comments
 (0)