cpython/Lib/importlib
Guido van Rossum bcce5e2718
gh-109039: Branch prediction for Tier 2 interpreter (#109038)
This adds a 16-bit inline cache entry to the conditional branch instructions POP_JUMP_IF_{FALSE,TRUE,NONE,NOT_NONE} and their instrumented variants, which is used to keep track of the branch direction.

Each time we encounter these instructions we shift the cache entry left by one and set the bottom bit to whether we jumped.

Then when it's time to translate such a branch to Tier 2 uops, we use the bit count from the cache entry to decided whether to continue translating the "didn't jump" branch or the "jumped" branch.

The counter is initialized to a pattern of alternating ones and zeros to avoid bias.

The .pyc file magic number is updated. There's a new test, some fixes for existing tests, and a few miscellaneous cleanups.
2023-09-11 18:20:24 +00:00
..
metadata
resources
__init__.py
_abc.py
_bootstrap.py GH-106176, GH-104702: Fix reference leak when importing across multiple threads (#108497) 2023-08-29 09:17:25 +02:00
_bootstrap_external.py gh-109039: Branch prediction for Tier 2 interpreter (#109038) 2023-09-11 18:20:24 +00:00
abc.py
machinery.py
readers.py
simple.py
util.py