summaryrefslogtreecommitdiffstats
path: root/Include/internal/pycore_code.h
diff options
context:
space:
mode:
Diffstat (limited to 'Include/internal/pycore_code.h')
-rw-r--r--Include/internal/pycore_code.h23
1 files changed, 12 insertions, 11 deletions
diff --git a/Include/internal/pycore_code.h b/Include/internal/pycore_code.h
index 194af46..d4d1392 100644
--- a/Include/internal/pycore_code.h
+++ b/Include/internal/pycore_code.h
@@ -137,24 +137,25 @@ _GetSpecializedCacheEntryForInstruction(const _Py_CODEUNIT *first_instr, int nex
#define QUICKENING_INITIAL_WARMUP_VALUE (-QUICKENING_WARMUP_DELAY)
#define QUICKENING_WARMUP_COLDEST 1
-static inline void
-PyCodeObject_IncrementWarmup(PyCodeObject * co)
-{
- co->co_warmup++;
-}
+int _Py_Quicken(PyCodeObject *code);
-/* Used by the interpreter to determine when a code object should be quickened */
+/* Returns 1 if quickening occurs.
+ * -1 if an error occurs
+ * 0 otherwise */
static inline int
-PyCodeObject_IsWarmedUp(PyCodeObject * co)
+_Py_IncrementCountAndMaybeQuicken(PyCodeObject *code)
{
- return (co->co_warmup == 0);
+ if (code->co_warmup != 0) {
+ code->co_warmup++;
+ if (code->co_warmup == 0) {
+ return _Py_Quicken(code) ? -1 : 1;
+ }
+ }
+ return 0;
}
-int _Py_Quicken(PyCodeObject *code);
-
extern Py_ssize_t _Py_QuickenedCount;
-
/* "Locals plus" for a code object is the set of locals + cell vars +
* free vars. This relates to variable names as well as offsets into
* the "fast locals" storage array of execution frames. The compiler