File tree Expand file tree Collapse file tree 4 files changed +11
-9
lines changed
Expand file tree Collapse file tree 4 files changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -116,7 +116,8 @@ PyAPI_FUNC(void) _Py_Executors_InvalidateCold(PyInterpreterState *interp);
116116
117117// Used as the threshold to trigger executor invalidation when
118118// trace_run_counter is greater than this value.
119- #define JIT_CLEANUP_THRESHOLD 100000
119+ // TODO: Test what should be the optimal value for this.
120+ #define JIT_CLEANUP_THRESHOLD 1000
120121
121122// This is the length of the trace we project initially.
122123#define UOP_MAX_TRACE_LENGTH 800
Original file line number Diff line number Diff line change 1111#include "pycore_audit.h" // _PySys_Audit()
1212#include "pycore_backoff.h"
1313#include "pycore_cell.h" // PyCell_GetRef()
14- #include "pycore_ceval.h"
1514#include "pycore_code.h"
1615#include "pycore_emscripten_signal.h" // _Py_CHECK_EMSCRIPTEN_SIGNALS
1716#include "pycore_function.h"
@@ -5367,10 +5366,6 @@ dummy_func(
53675366
53685367 tier2 op (_MAKE_WARM , (-- )) {
53695368 current_executor -> vm_data .warm = true;
5370- // It's okay if this ends up going negative.
5371- if (-- tstate -> interp -> trace_run_counter == 0 ) {
5372- _Py_set_eval_breaker_bit (tstate , _PY_EVAL_JIT_INVALIDATE_COLD_BIT );
5373- }
53745369 }
53755370
53765371 tier2 op (_FATAL_ERROR , (-- )) {
Original file line number Diff line number Diff line change 66#include "pycore_interp.h"
77#include "pycore_backoff.h"
88#include "pycore_bitutils.h" // _Py_popcount32()
9+ #include "pycore_ceval.h" // _Py_set_eval_breaker_bit
910#include "pycore_code.h" // _Py_GetBaseCodeUnit
1011#include "pycore_function.h" // _PyFunction_LookupByVersion()
1112#include "pycore_interpframe.h"
@@ -1322,6 +1323,14 @@ uop_optimize(
13221323 return -1 ;
13231324 }
13241325 assert (length <= UOP_MAX_TRACE_LENGTH );
1326+
1327+ // Check executor coldness
1328+ PyThreadState * tstate = PyThreadState_Get ();
1329+ // It's okay if this ends up going negative.
1330+ if (-- tstate -> interp -> trace_run_counter == 0 ) {
1331+ _Py_set_eval_breaker_bit (tstate , _PY_EVAL_JIT_INVALIDATE_COLD_BIT );
1332+ }
1333+
13251334 * exec_ptr = executor ;
13261335 return 1 ;
13271336}
You can’t perform that action at this time.
0 commit comments