summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrandt Bucher <brandtbucher@microsoft.com>2022-10-12 23:04:47 (GMT)
committerGitHub <noreply@github.com>2022-10-12 23:04:47 (GMT)
commit0a67f82eb1daf0afaebc68f31ac7e4609f314353 (patch)
treecd09edcef01e8c10bfb5540778088886b9160ee8
parent450306ed6770d7ffd16cb9128e471677dda9b3d1 (diff)
downloadcpython-0a67f82eb1daf0afaebc68f31ac7e4609f314353.zip
cpython-0a67f82eb1daf0afaebc68f31ac7e4609f314353.tar.gz
cpython-0a67f82eb1daf0afaebc68f31ac7e4609f314353.tar.bz2
[3.11] GH-93354: Fix PRECALL's adaptive backoff (GH-98011)
-rw-r--r--Misc/NEWS.d/next/Core and Builtins/2022-10-06-05-41-01.gh-issue-93354.6BpHl2.rst2
-rw-r--r--Python/ceval.c4
2 files changed, 4 insertions, 2 deletions
diff --git a/Misc/NEWS.d/next/Core and Builtins/2022-10-06-05-41-01.gh-issue-93354.6BpHl2.rst b/Misc/NEWS.d/next/Core and Builtins/2022-10-06-05-41-01.gh-issue-93354.6BpHl2.rst
new file mode 100644
index 0000000..4efc10d
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2022-10-06-05-41-01.gh-issue-93354.6BpHl2.rst
@@ -0,0 +1,2 @@
+Fix an issue that could delay the specialization of :opcode:`PRECALL`
+instructions.
diff --git a/Python/ceval.c b/Python/ceval.c
index c5283ac..c0d9c68 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -4793,7 +4793,7 @@ handle_eval_breaker:
TARGET(PRECALL_ADAPTIVE) {
_PyPrecallCache *cache = (_PyPrecallCache *)next_instr;
- if (cache->counter == 0) {
+ if (ADAPTIVE_COUNTER_IS_ZERO(cache)) {
next_instr--;
int is_meth = is_method(stack_pointer, oparg);
int nargs = oparg + is_meth;
@@ -4807,7 +4807,7 @@ handle_eval_breaker:
}
else {
STAT_INC(PRECALL, deferred);
- cache->counter--;
+ DECREMENT_ADAPTIVE_COUNTER(cache);
JUMP_TO_INSTRUCTION(PRECALL);
}
}