@@ -486,7 +486,7 @@ PyTypeObject _PyUOpExecutor_Type = {
486486 .tp_as_sequence = & uop_as_sequence ,
487487 .tp_methods = uop_executor_methods ,
488488 .tp_traverse = executor_traverse ,
489- .tp_clear = executor_clear_implicit_interp ,
489+ .tp_clear = executor_clear ,
490490 .tp_is_gc = executor_is_gc ,
491491};
492492
@@ -1635,7 +1635,7 @@ link_executor(_PyExecutorObject *executor)
16351635}
16361636
16371637static void
1638- unlink_executor (PyInterpreterState * interp , _PyExecutorObject * executor )
1638+ unlink_executor (_PyExecutorObject * executor )
16391639{
16401640 _PyExecutorLinkListNode * links = & executor -> vm_data .links ;
16411641 _PyExecutorObject * next = links -> next ;
@@ -1648,6 +1648,7 @@ unlink_executor(PyInterpreterState *interp, _PyExecutorObject *executor)
16481648 }
16491649 else {
16501650 // prev == NULL implies that executor is the list head
1651+ PyInterpreterState * interp = PyInterpreterState_Get ();
16511652 assert (interp -> executor_list_head == executor );
16521653 interp -> executor_list_head = next ;
16531654 }
@@ -1769,12 +1770,6 @@ executor_clear(PyObject *op)
17691770 return 0 ;
17701771}
17711772
1772- static int
1773- executor_clear_implicit_interp (PyObject * op )
1774- {
1775- return executor_clear (_PyInterpreterState_GET (), op );
1776- }
1777-
17781773void
17791774_Py_Executor_DependsOn (_PyExecutorObject * executor , void * obj )
17801775{
@@ -1790,6 +1785,12 @@ static void jit_tracer_invalidate_dependency(PyThreadState *tstate, void *obj);
17901785void
17911786_Py_Executors_InvalidateDependency (PyInterpreterState * interp , void * obj , int is_invalidation )
17921787{
1788+
1789+ // It doesn't matter if we don't invalidate all threads.
1790+ // If more threads are spawned, we force the jit not to compile anyways
1791+ // so the trace gets abandoned.
1792+ jit_tracer_invalidate_dependency (_PyThreadState_GET (), obj );
1793+
17931794 _PyBloomFilter obj_filter ;
17941795 _Py_BloomFilter_Init (& obj_filter );
17951796 _Py_BloomFilter_Add (& obj_filter , obj );
0 commit comments