| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -135,6 +135,20 @@ initial_jump_backoff_counter(_PyOptimizationConfig *opt_config) | |||
| 135 | 135 | opt_config->jump_backward_initial_backoff); | |
| 136 | 136 | } | |
| 137 | 137 | ||
| 138 | + // This needs to be around 2-4x of JUMP_BACKWARD_INITIAL_VALUE | ||
| 139 | + // The reasoning is that we always want loop traces to form and inline | ||
| 140 | + // functions before functions themselves warm up and link to them instead | ||
| 141 | + // of inlining. | ||
| 142 | + #define RESUME_INITIAL_VALUE 8190 | ||
| 143 | + #define RESUME_INITIAL_BACKOFF 6 | ||
| 144 | + static inline _Py_BackoffCounter | ||
| 145 | + initial_resume_backoff_counter(_PyOptimizationConfig *opt_config) | ||
| 146 | + { | ||
| 147 | + return make_backoff_counter( | ||
| 148 | + opt_config->resume_initial_value, | ||
| 149 | + opt_config->resume_initial_backoff); | ||
| 150 | + } | ||
| 151 | + | ||
| 138 | 152 | /* Initial exit temperature. | |
| 139 | 153 | * Must be larger than ADAPTIVE_COOLDOWN_VALUE, | |
| 140 | 154 | * otherwise when a side exit warms up we may construct | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -323,6 +323,7 @@ PyAPI_FUNC(void) _Py_Specialize_ToBool(_PyStackRef value, _Py_CODEUNIT *instr); | |||
| 323 | 323 | PyAPI_FUNC(void) _Py_Specialize_ContainsOp(_PyStackRef value, _Py_CODEUNIT *instr); | |
| 324 | 324 | PyAPI_FUNC(void) _Py_GatherStats_GetIter(_PyStackRef iterable); | |
| 325 | 325 | PyAPI_FUNC(void) _Py_Specialize_CallFunctionEx(_PyStackRef func_st, _Py_CODEUNIT *instr); | |
| 326 | + PyAPI_FUNC(void) _Py_Specialize_Resume(_Py_CODEUNIT *instr, PyThreadState *tstate, _PyInterpreterFrame *frame); | ||
| 326 | 327 | ||
| 327 | 328 | // Utility functions for reading/writing 32/64-bit values in the inline caches. | |
| 328 | 329 | // Great care should be taken to ensure that these functions remain correct and | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -414,6 +414,9 @@ typedef struct _PyOptimizationConfig { | |||
| 414 | 414 | uint16_t jump_backward_initial_value; | |
| 415 | 415 | uint16_t jump_backward_initial_backoff; | |
| 416 | 416 | ||
| 417 | + uint16_t resume_initial_value; | ||
| 418 | + uint16_t resume_initial_backoff; | ||
| 419 | + | ||
| 417 | 420 | // JIT optimization thresholds | |
| 418 | 421 | uint16_t side_exit_initial_value; | |
| 419 | 422 | uint16_t side_exit_initial_backoff; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -292,6 +292,7 @@ Known values: | |||
| 292 | 292 | Python 3.15a4 3659 (Add CALL_FUNCTION_EX specialization) | |
| 293 | 293 | Python 3.15a4 3660 (Change generator preamble code) | |
| 294 | 294 | Python 3.15a4 3661 (Lazy imports IMPORT_NAME opcode changes) | |
| 295 | + Python 3.15a6 3662 (Add counter to RESUME) | ||
| 295 | 296 | ||
| 296 | 297 | ||
| 297 | 298 | Python 3.16 will start with 3700 | |
@@ -305,7 +306,7 @@ PC/launcher.c must also be updated. | |||
| 305 | 306 | ||
| 306 | 307 | */ | |
| 307 | 308 | ||
| 308 | - #define PYC_MAGIC_NUMBER 3661 | ||
| 309 | + #define PYC_MAGIC_NUMBER 3662 | ||
| 309 | 310 | /* This is equivalent to converting PYC_MAGIC_NUMBER to 2 bytes | |
| 310 | 311 | (little-endian) and then appending b'\r\n'. */ | |
| 311 | 312 | #define PYC_MAGIC_NUMBER_TOKEN \ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -361,6 +361,8 @@ _PyJit_TryInitializeTracing(PyThreadState *tstate, _PyInterpreterFrame *frame, | |||
| 361 | 361 | int oparg, _PyExecutorObject *current_executor); | |
| 362 | 362 | ||
| 363 | 363 | PyAPI_FUNC(void) _PyJit_FinalizeTracing(PyThreadState *tstate, int err); | |
| 364 | + PyAPI_FUNC(bool) _PyJit_EnterExecutorShouldStopTracing(int og_opcode); | ||
| 365 | + | ||
| 364 | 366 | void _PyPrintExecutor(_PyExecutorObject *executor, const _PyUOpInstruction *marker); | |
| 365 | 367 | void _PyJit_TracerFree(_PyThreadStateImpl *_tstate); | |
| 366 | 368 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -36,7 +36,7 @@ typedef struct _PyUOpInstruction{ | |||
| 36 | 36 | } _PyUOpInstruction; | |
| 37 | 37 | ||
| 38 | 38 | // This is the length of the trace we translate initially. | |
| 39 | - #ifdef Py_DEBUG | ||
| 39 | + #if defined(Py_DEBUG) && defined(_Py_JIT) | ||
| 40 | 40 | // With asserts, the stencils are a lot larger | |
| 41 | 41 | #define UOP_MAX_TRACE_LENGTH 1000 | |
| 42 | 42 | #else | |
| Back | FazBrowse Home | New Git URL |
0 commit comments