]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-116968: Reimplement Tier 2 counters (#117144)
authorGuido van Rossum <guido@python.org>
Thu, 4 Apr 2024 15:03:27 +0000 (08:03 -0700)
committerGitHub <noreply@github.com>
Thu, 4 Apr 2024 15:03:27 +0000 (15:03 +0000)
commit060a96f1a9a901b01ed304aa82b886d248ca1cb6
treecb3e95ecac1f90440b7d3752c4aad015ea734bf0
parent63bbe77d9bb2be4db83ed09b96dd22f2a44ef55b
gh-116968: Reimplement Tier 2 counters (#117144)

Introduce a unified 16-bit backoff counter type (``_Py_BackoffCounter``),
shared between the Tier 1 adaptive specializer and the Tier 2 optimizer. The
API used for adaptive specialization counters is changed but the behavior is
(supposed to be) identical.

The behavior of the Tier 2 counters is changed:
- There are no longer dynamic thresholds (we never varied these).
- All counters now use the same exponential backoff.
- The counter for ``JUMP_BACKWARD`` starts counting down from 16.
- The ``temperature`` in side exits starts counting down from 64.
19 files changed:
Include/cpython/code.h
Include/cpython/optimizer.h
Include/internal/pycore_backoff.h [new file with mode: 0644]
Include/internal/pycore_code.h
Include/internal/pycore_interp.h
Lib/test/test_capi/test_opt.py
Makefile.pre.in
Misc/NEWS.d/next/Core and Builtins/2024-04-03-13-44-04.gh-issue-116968.zgcdG2.rst [new file with mode: 0644]
Modules/_testinternalcapi.c
PCbuild/pythoncore.vcxproj
Python/bytecodes.c
Python/ceval.c
Python/ceval_macros.h
Python/executor_cases.c.h
Python/generated_cases.c.h
Python/instrumentation.c
Python/optimizer.c
Python/specialize.c
Tools/jit/template.c