Skip to content

Commit

Permalink
Rename _PyCode_InitCounters back to _PyCode_Quicken
Browse files Browse the repository at this point in the history
We are quickening LOAD_CONST now.
  • Loading branch information
mpage committed Oct 30, 2024
1 parent 4cbe237 commit 38ff315
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
12 changes: 6 additions & 6 deletions Objects/codeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,8 @@ _PyCode_Validate(struct _PyCodeConstructor *con)
}

extern void
_PyCode_InitCounters(_Py_CODEUNIT *instructions, Py_ssize_t size, PyObject *consts, int enable);
_PyCode_Quicken(_Py_CODEUNIT *instructions, Py_ssize_t size, PyObject *consts,
int enable_counters);

#ifdef Py_GIL_DISABLED
static _PyCodeArray * _PyCodeArray_New(Py_ssize_t size);
Expand Down Expand Up @@ -529,11 +530,10 @@ init_code(PyCodeObject *co, struct _PyCodeConstructor *con)
}
co->_co_firsttraceable = entry_point;
#ifdef Py_GIL_DISABLED
_PyCode_InitCounters(_PyCode_CODE(co), Py_SIZE(co),
co->co_consts,
interp->config.tlbc_enabled);
_PyCode_Quicken(_PyCode_CODE(co), Py_SIZE(co), co->co_consts,
interp->config.tlbc_enabled);
#else
_PyCode_InitCounters(_PyCode_CODE(co), Py_SIZE(co), co->co_consts, 1);
_PyCode_Quicken(_PyCode_CODE(co), Py_SIZE(co), co->co_consts, 1);
#endif
notify_code_watchers(PY_CODE_EVENT_CREATE, co);
return 0;
Expand Down Expand Up @@ -2751,7 +2751,7 @@ copy_code(_Py_CODEUNIT *dst, PyCodeObject *co)
for (int i = 0; i < code_len; i += _PyInstruction_GetLength(co, i)) {
dst[i] = _Py_GetBaseCodeUnit(co, i);
}
_PyCode_InitCounters(dst, code_len, co->co_consts, 1);
_PyCode_Quicken(dst, code_len, co->co_consts, 1);
}

static Py_ssize_t
Expand Down
7 changes: 4 additions & 3 deletions Python/specialize.c
Original file line number Diff line number Diff line change
Expand Up @@ -455,13 +455,14 @@ do { \
# define SPECIALIZATION_FAIL(opcode, kind) ((void)0)
#endif

// Initialize warmup counters. This cannot fail.
// Initialize warmup counters and optimize instructions. This cannot fail.
void
_PyCode_InitCounters(_Py_CODEUNIT *instructions, Py_ssize_t size, PyObject *consts, int enable)
_PyCode_Quicken(_Py_CODEUNIT *instructions, Py_ssize_t size, PyObject *consts,
int enable_counters)
{
#if ENABLE_SPECIALIZATION_FT
_Py_BackoffCounter jump_counter, adaptive_counter;
if (enable) {
if (enable_counters) {
jump_counter = initial_jump_backoff_counter();
adaptive_counter = adaptive_counter_warmup();
}
Expand Down

0 comments on commit 38ff315

Please sign in to comment.