Skip to content

Commit c7873c2

Browse files
Revert forge_backoff_counter
1 parent a89d6de commit c7873c2

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

Include/internal/pycore_backoff.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,21 @@ static uint16_t value_and_backoff_next[] = {
5858
static inline _Py_BackoffCounter
5959
make_backoff_counter(uint16_t value, uint16_t backoff)
6060
{
61-
//assert(backoff <= UNREACHABLE_BACKOFF);
61+
assert(backoff <= UNREACHABLE_BACKOFF);
6262
assert(value <= MAX_VALUE);
6363
return ((_Py_BackoffCounter){
6464
.value_and_backoff = MAKE_VALUE_AND_BACKOFF(value, backoff)
6565
});
6666
}
6767

68+
static inline _Py_BackoffCounter
69+
forge_backoff_counter(uint16_t counter)
70+
{
71+
_Py_BackoffCounter result;
72+
result.value_and_backoff = counter;
73+
return result;
74+
}
75+
6876
static inline _Py_BackoffCounter
6977
restart_backoff_counter(_Py_BackoffCounter counter)
7078
{

Python/ceval_macros.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ GETITEM(PyObject *v, Py_ssize_t i) {
315315
* which is always an integral type. */
316316
// Force re-specialization when tracing a side exit to get good side exits.
317317
#define ADAPTIVE_COUNTER_TRIGGERS(COUNTER) \
318-
backoff_counter_triggers(make_backoff_counter(0, (COUNTER)))
318+
backoff_counter_triggers(forge_backoff_counter((COUNTER)))
319319

320320
#define ADVANCE_ADAPTIVE_COUNTER(COUNTER) \
321321
do { \

0 commit comments

Comments
 (0)