]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.11] GH-93354: Fix PRECALL's adaptive backoff (GH-98011)
authorBrandt Bucher <brandtbucher@microsoft.com>
Wed, 12 Oct 2022 23:04:47 +0000 (16:04 -0700)
committerGitHub <noreply@github.com>
Wed, 12 Oct 2022 23:04:47 +0000 (16:04 -0700)
Misc/NEWS.d/next/Core and Builtins/2022-10-06-05-41-01.gh-issue-93354.6BpHl2.rst [new file with mode: 0644]
Python/ceval.c

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 (file)
index 0000000..4efc10d
--- /dev/null
@@ -0,0 +1,2 @@
+Fix an issue that could delay the specialization of :opcode:`PRECALL`
+instructions.
index c5283ace43cfb13857dde50690e142e83878fdfd..c0d9c68de04b0c234ffeae7441c2a8151744a21b 100644 (file)
@@ -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);
             }
         }