mirror of
https://github.com/python/cpython.git
synced 2026-05-06 12:49:07 -04:00
gh-108488: Initialize JUMP_BACKWARD cache to 0, not 17 (#108591)
This mis-initialization caused the executor optimization to kick in sooner than intended. It also set the lower 4 bits of the counter to `1` -- those bits are supposed to be reserved (the actual counter is in the upper 12 bits).
This commit is contained in:
+3
-1
@@ -302,7 +302,9 @@ _PyCode_Quicken(PyCodeObject *code)
|
||||
assert(opcode < MIN_INSTRUMENTED_OPCODE);
|
||||
int caches = _PyOpcode_Caches[opcode];
|
||||
if (caches) {
|
||||
instructions[i + 1].cache = adaptive_counter_warmup();
|
||||
// JUMP_BACKWARD counter counts up from 0 until it is > backedge_threshold
|
||||
instructions[i + 1].cache =
|
||||
opcode == JUMP_BACKWARD ? 0 : adaptive_counter_warmup();
|
||||
i += caches;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user