Skip to content

Commit

Permalink
Reset the counter after optimizing
Browse files Browse the repository at this point in the history
  • Loading branch information
brandtbucher committed Nov 7, 2024
1 parent 09d6f5d commit b1d77eb
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
14 changes: 9 additions & 5 deletions Python/bytecodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -2624,15 +2624,16 @@ dummy_func(
}
_PyExecutorObject *executor;
int optimized = _PyOptimizer_Optimize(frame, start, stack_pointer, &executor, 0);
ERROR_IF(optimized < 0, error);
if (optimized) {
if (optimized <= 0) {
this_instr[1].counter = restart_backoff_counter(counter);
ERROR_IF(optimized < 0, error);
}
else {
this_instr[1].counter = initial_jump_backoff_counter();
assert(tstate->previous_executor == NULL);
tstate->previous_executor = Py_None;
GOTO_TIER_TWO(executor);
}
else {
this_instr[1].counter = restart_backoff_counter(counter);
}
}
else {
ADVANCE_ADAPTIVE_COUNTER(this_instr[1].counter);
Expand Down Expand Up @@ -4869,6 +4870,9 @@ dummy_func(
tstate->previous_executor = (PyObject *)current_executor;
GOTO_TIER_ONE(target);
}
else {
exit->temperature = initial_temperature_backoff_counter();
}
}
exit->executor = executor;
}
Expand Down
3 changes: 3 additions & 0 deletions Python/executor_cases.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 8 additions & 5 deletions Python/generated_cases.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b1d77eb

Please sign in to comment.