Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Revert forge_backoff_counter
  • Loading branch information
efimov-mikhail committed Nov 19, 2025
commit c7873c276668e56f4d8d94474e4eb767bff37e35
10 changes: 9 additions & 1 deletion Include/internal/pycore_backoff.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,21 @@ static uint16_t value_and_backoff_next[] = {
static inline _Py_BackoffCounter
make_backoff_counter(uint16_t value, uint16_t backoff)
{
//assert(backoff <= UNREACHABLE_BACKOFF);
assert(backoff <= UNREACHABLE_BACKOFF);
assert(value <= MAX_VALUE);
return ((_Py_BackoffCounter){
.value_and_backoff = MAKE_VALUE_AND_BACKOFF(value, backoff)
});
}

static inline _Py_BackoffCounter
forge_backoff_counter(uint16_t counter)
{
_Py_BackoffCounter result;
result.value_and_backoff = counter;
return result;
}

static inline _Py_BackoffCounter
restart_backoff_counter(_Py_BackoffCounter counter)
{
Expand Down
2 changes: 1 addition & 1 deletion Python/ceval_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ GETITEM(PyObject *v, Py_ssize_t i) {
* which is always an integral type. */
// Force re-specialization when tracing a side exit to get good side exits.
#define ADAPTIVE_COUNTER_TRIGGERS(COUNTER) \
backoff_counter_triggers(make_backoff_counter(0, (COUNTER)))
backoff_counter_triggers(forge_backoff_counter((COUNTER)))

#define ADVANCE_ADAPTIVE_COUNTER(COUNTER) \
do { \
Expand Down
Loading