Skip to content

Commit f05e61c

Browse files
re-enable jit on some stuff
1 parent 7f0bc57 commit f05e61c

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

Lib/test/test_capi/test_opt.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,8 +417,6 @@ def testfunc(n, m):
417417
self.assertIn("_FOR_ITER_TIER_TWO", uops)
418418

419419

420-
@requires_specialization
421-
@unittest.skipIf(Py_GIL_DISABLED, "optimizer not yet supported in free-threaded builds")
422420
@requires_jit_enabled
423421
@unittest.skipIf(os.getenv("PYTHON_UOPS_OPTIMIZE") == "0", "Needs uop optimizer to run.")
424422
class TestUopsOptimization(unittest.TestCase):

Python/pystate.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1844,6 +1844,13 @@ tstate_delete_common(PyThreadState *tstate, int release_gil)
18441844
_PyObject_VirtualFree(_tstate->jit_tracer_state.code_buffer, UOP_BUFFER_SIZE);
18451845
_tstate->jit_tracer_state.code_buffer = NULL;
18461846
}
1847+
#ifdef Py_GIL_DISABLED
1848+
// There's only one thread. Re-enable JIT.
1849+
PyThreadState *curr = interp->threads.head;
1850+
if (curr != NULL && curr->prev == NULL && curr->next == NULL) {
1851+
_Py_atomic_store_char_relaxed(&((_PyThreadStateImpl*)curr)->jit_executor_state.jit, true);
1852+
}
1853+
#endif
18471854
#endif
18481855

18491856
HEAD_UNLOCK(runtime);

0 commit comments

Comments
 (0)