Skip to content

Commit 7d97437

Browse files
reduce diff
1 parent 65b6dd0 commit 7d97437

File tree

9 files changed

+13
-9
lines changed

9 files changed

+13
-9
lines changed

Include/internal/pycore_optimizer.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,8 @@ _PyJit_TryInitializeTracing(PyThreadState *tstate, _PyInterpreterFrame *frame,
358358

359359
void _PyJit_FinalizeTracing(PyThreadState *tstate);
360360

361+
void _PyJit_Tracer_InvalidateDependency(PyThreadState *old_tstate, void *obj);
362+
361363
#ifdef __cplusplus
362364
}
363365
#endif

Modules/_testinternalcapi.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1240,7 +1240,8 @@ add_executor_dependency(PyObject *self, PyObject *args)
12401240
static PyObject *
12411241
invalidate_executors(PyObject *self, PyObject *obj)
12421242
{
1243-
_Py_Executors_InvalidateDependency(_PyInterpreterState_GET(), obj, 1);
1243+
PyInterpreterState *interp = PyInterpreterState_Get();
1244+
_Py_Executors_InvalidateDependency(interp, obj, 1);
12441245
Py_RETURN_NONE;
12451246
}
12461247

Objects/codeobject.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2432,6 +2432,7 @@ code_dealloc(PyObject *self)
24322432
PyMem_Free(co_extra);
24332433
}
24342434
#ifdef _Py_TIER2
2435+
_PyJit_Tracer_InvalidateDependency(tstate, self);
24352436
_Py_Executors_InvalidateDependency(tstate->interp, self, 1);
24362437
if (co->co_executors != NULL) {
24372438
clear_executors(co);

Objects/frameobject.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ framelocalsproxy_setitem(PyObject *self, PyObject *key, PyObject *value)
262262

263263
#if _Py_TIER2
264264
_Py_Executors_InvalidateDependency(_PyInterpreterState_GET(), co, 1);
265+
_PyJit_Tracer_InvalidateDependency(_PyThreadState_GET(), co);
265266
#endif
266267

267268
_PyLocals_Kind kind = _PyLocals_GetKind(co->co_localspluskinds, i);

Objects/funcobject.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include "pycore_setobject.h" // _PySet_NextEntry()
1212
#include "pycore_stats.h"
1313
#include "pycore_weakref.h" // FT_CLEAR_WEAKREFS()
14-
#include "pycore_optimizer.h" // _Py_Executors_InvalidateDependency
14+
#include "pycore_optimizer.h" // _PyJit_Tracer_InvalidateDependency
1515

1616
static const char *
1717
func_event_name(PyFunction_WatchEvent event) {
@@ -1166,6 +1166,7 @@ func_dealloc(PyObject *self)
11661166
}
11671167
#if _Py_TIER2
11681168
_Py_Executors_InvalidateDependency(_PyInterpreterState_GET(), self, 1);
1169+
_PyJit_Tracer_InvalidateDependency(_PyThreadState_GET(), self);
11691170
#endif
11701171
_PyObject_GC_UNTRACK(op);
11711172
FT_CLEAR_WEAKREFS(self, op->func_weakreflist);

Objects/typeobject.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1177,7 +1177,6 @@ set_version_unlocked(PyTypeObject *tp, unsigned int version)
11771177
+ (version % TYPE_VERSION_CACHE_SIZE);
11781178
*slot = tp;
11791179
}
1180-
END_TYPE_LOCK();
11811180
#endif
11821181
}
11831182

Python/ceval.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1716,7 +1716,7 @@ _PyTier2Interpreter(
17161716
for (;;) {
17171717
uopcode = next_uop->opcode;
17181718
#ifdef Py_DEBUG
1719-
if (frame->lltrace >= 4) {
1719+
if (frame->lltrace >= 3) {
17201720
dump_stack(frame, stack_pointer);
17211721
printf(" cache=[");
17221722
dump_cache_item(_tos_cache0, 0, current_cached_values);

Python/instrumentation.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1785,6 +1785,7 @@ force_instrument_lock_held(PyCodeObject *code, PyInterpreterState *interp)
17851785
_PyCode_Clear_Executors(code);
17861786
}
17871787
_Py_Executors_InvalidateDependency(interp, code, 1);
1788+
_PyJit_Tracer_InvalidateDependency(PyThreadState_GET(), code);
17881789
#endif
17891790
int code_len = (int)Py_SIZE(code);
17901791
/* Exit early to avoid creating instrumentation

Python/optimizer.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1786,8 +1786,6 @@ _Py_Executor_DependsOn(_PyExecutorObject *executor, void *obj)
17861786
_Py_BloomFilter_Add(&executor->vm_data.bloom, obj);
17871787
}
17881788

1789-
static void jit_tracer_invalidate_dependency(PyThreadState *tstate, void *obj);
1790-
17911789
/* Invalidate all executors that depend on `obj`
17921790
* May cause other executors to be invalidated as well
17931791
*/
@@ -1798,7 +1796,7 @@ _Py_Executors_InvalidateDependency(PyInterpreterState *interp, void *obj, int is
17981796
// It doesn't matter if we don't invalidate all threads.
17991797
// If more threads are spawned, we force the jit not to compile anyways
18001798
// so the trace gets abandoned.
1801-
jit_tracer_invalidate_dependency(_PyThreadState_GET(), obj);
1799+
_PyJit_Tracer_InvalidateDependency(_PyThreadState_GET(), obj);
18021800

18031801
_PyBloomFilter obj_filter;
18041802
_Py_BloomFilter_Init(&obj_filter);
@@ -1838,7 +1836,7 @@ _Py_Executors_InvalidateDependency(PyInterpreterState *interp, void *obj, int is
18381836
}
18391837

18401838
static void
1841-
jit_tracer_invalidate_dependency(PyThreadState *tstate, void *obj)
1839+
_PyJit_Tracer_InvalidateDependency(PyThreadState *tstate, void *obj)
18421840
{
18431841
_PyBloomFilter obj_filter;
18441842
_Py_BloomFilter_Init(&obj_filter);
@@ -2046,4 +2044,4 @@ _PyExecutor_Free(struct _PyExecutorObject *self)
20462044
Py_UNREACHABLE();
20472045
}
20482046

2049-
#endif /* _Py_TIER2 */
2047+
#endif /* _Py_TIER2 */

0 commit comments

Comments
 (0)