summaryrefslogtreecommitdiff
path: root/Include/internal/pycore_code.h
diff options
context:
space:
mode:
authorBrandt Bucher <brandtbucher@microsoft.com>2022-11-02 10:42:57 -0700
committerGitHub <noreply@github.com>2022-11-02 10:42:57 -0700
commit276d77724f2373cc03838448a3e62977aa28bf0d (patch)
treeaeb2f83a896f02a3f38ace9d6ecb65b9620be8e3 /Include/internal/pycore_code.h
parent18fc232e07c14536d99f07821e338ebddfd8cb63 (diff)
downloadcpython-git-276d77724f2373cc03838448a3e62977aa28bf0d.tar.gz
GH-98686: Quicken everything (GH-98687)
Diffstat (limited to 'Include/internal/pycore_code.h')
-rw-r--r--Include/internal/pycore_code.h32
1 files changed, 6 insertions, 26 deletions
diff --git a/Include/internal/pycore_code.h b/Include/internal/pycore_code.h
index bf5945435c..cf8573aa91 100644
--- a/Include/internal/pycore_code.h
+++ b/Include/internal/pycore_code.h
@@ -91,28 +91,8 @@ typedef struct {
#define INLINE_CACHE_ENTRIES_FOR_ITER CACHE_ENTRIES(_PyForIterCache)
-#define QUICKENING_WARMUP_DELAY 8
-
-/* We want to compare to zero for efficiency, so we offset values accordingly */
-#define QUICKENING_INITIAL_WARMUP_VALUE (-QUICKENING_WARMUP_DELAY)
-
-void _PyCode_Quicken(PyCodeObject *code);
-
-static inline void
-_PyCode_Warmup(PyCodeObject *code)
-{
- if (code->co_warmup != 0) {
- code->co_warmup++;
- if (code->co_warmup == 0) {
- _PyCode_Quicken(code);
- }
- }
-}
-
extern uint8_t _PyOpcode_Adaptive[256];
-extern Py_ssize_t _Py_QuickenedCount;
-
// Borrowed references to common callables:
struct callable_cache {
PyObject *isinstance;
@@ -252,10 +232,10 @@ extern void _Py_Specialize_UnpackSequence(PyObject *seq, _Py_CODEUNIT *instr,
int oparg);
extern void _Py_Specialize_ForIter(PyObject *iter, _Py_CODEUNIT *instr);
-/* Deallocator function for static codeobjects used in deepfreeze.py */
-extern void _PyStaticCode_Dealloc(PyCodeObject *co);
-/* Function to intern strings of codeobjects */
-extern int _PyStaticCode_InternStrings(PyCodeObject *co);
+/* Finalizer function for static codeobjects used in deepfreeze.py */
+extern void _PyStaticCode_Fini(PyCodeObject *co);
+/* Function to intern strings of codeobjects and quicken the bytecode */
+extern int _PyStaticCode_Init(PyCodeObject *co);
#ifdef Py_STATS
@@ -397,8 +377,8 @@ write_location_entry_start(uint8_t *ptr, int code, int length)
/* With a 16-bit counter, we have 12 bits for the counter value, and 4 bits for the backoff */
#define ADAPTIVE_BACKOFF_BITS 4
-/* The initial counter value is 31 == 2**ADAPTIVE_BACKOFF_START - 1 */
-#define ADAPTIVE_BACKOFF_START 5
+/* The initial counter value is 1 == 2**ADAPTIVE_BACKOFF_START - 1 */
+#define ADAPTIVE_BACKOFF_START 1
#define MAX_BACKOFF_VALUE (16 - ADAPTIVE_BACKOFF_BITS)