← 输入框|github.com|刷新
Skip to content

gh-162711: Only record branch history when tier 2 is enabled - #162804

Open
kumaraditya303 wants to merge 1 commit into
python:mainfrom
kumaraditya303:gh-162711-branch-history-tier2
Open

kumaraditya303 wants to merge 1 commit into
python:mainfrom
kumaraditya303:gh-162711-branch-history-tier2

Conversation

@kumaraditya303

@kumaraditya303 kumaraditya303 commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

In the free-threaded build the main thread's bytecode is stored inline in the code object, so the store done by RECORD_BRANCH_TAKEN on every conditional jump caused false sharing with other threads reading co_tlbc and _co_instrumentation_version when calling the same function.

The branch history is only used by the tier 2 optimizer, so only record it when _Py_TIER2 is defined.

In the free-threaded build the main thread's bytecode is stored inline
in the code object, so the store done by RECORD_BRANCH_TAKEN on every
conditional jump caused false sharing with other threads reading
co_tlbc and _co_instrumentation_version when calling the same function.

The branch history is only used by the tier 2 optimizer, so only record
it when _Py_TIER2 is defined.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant