summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2023-11-09 13:49:51 (GMT)
committerGitHub <noreply@github.com>2023-11-09 13:49:51 (GMT)
commit34a03e951b027902d993c7066ba8e6b7e92cb2a9 (patch)
tree3a25738c13185ea521b0e8bad09e0ee2eda660a7 /Include
parent25c49564880e6868e4c76602f9f1650f0bc71c75 (diff)
downloadcpython-34a03e951b027902d993c7066ba8e6b7e92cb2a9.zip
cpython-34a03e951b027902d993c7066ba8e6b7e92cb2a9.tar.gz
cpython-34a03e951b027902d993c7066ba8e6b7e92cb2a9.tar.bz2
GH-111843: Tier 2 exponential backoff (GH-111850)
Diffstat (limited to 'Include')
-rw-r--r--Include/cpython/optimizer.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/Include/cpython/optimizer.h b/Include/cpython/optimizer.h
index 2a5251b..adc2c1f 100644
--- a/Include/cpython/optimizer.h
+++ b/Include/cpython/optimizer.h
@@ -45,6 +45,8 @@ typedef int (*optimize_func)(_PyOptimizerObject* self, PyCodeObject *code, _Py_C
typedef struct _PyOptimizerObject {
PyObject_HEAD
optimize_func optimize;
+ /* These thresholds are treated as signed so do not exceed INT16_MAX
+ * Use INT16_MAX to indicate that the optimizer should never be called */
uint16_t resume_threshold;
uint16_t backedge_threshold;
/* Data needed by the optimizer goes here, but is opaque to the VM */
@@ -76,6 +78,8 @@ PyAPI_FUNC(PyObject *)PyUnstable_Optimizer_NewCounter(void);
PyAPI_FUNC(PyObject *)PyUnstable_Optimizer_NewUOpOptimizer(void);
#define OPTIMIZER_BITS_IN_COUNTER 4
+/* Minimum of 16 additional executions before retry */
+#define MINIMUM_TIER2_BACKOFF 4
#ifdef __cplusplus
}