Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

GH-138245: Perform boolean guards by testing a single bit, rather than a full pointer comparison. #143810

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
markshannon wants to merge 1 commit into python:main
base: main
Choose a base branch
Loading
from markshannon:boolean-guard-bit-check

Conversation

@markshannon
Copy link
Member

@markshannon markshannon commented Jan 13, 2026
edited
Loading

This reduces the overhead of performing boolean guards in jitted code.

On Aarch64 reduces the size of the stencil from 5 to 2 instructions.

GUARD_IS_FALSE_POP_r10:

 adrp x8, 0x0 // _Py_FalseStruct
 ldr x8, [x8] // _Py_FalseStruct
 orr x8, x8, #0x1
 cmp x24, x8
 b.ne jump_target

_GUARD_BIT_IS_SET_POP_4_r10:

 tbnz w24, #0x4, next
 b jump_target
next:
 // 0000000000000004: R_AARCH64_JUMP26 _JIT_JUMP_TARGET

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@tomasr8 tomasr8 Awaiting requested review from tomasr8 tomasr8 is a code owner

@Fidget-Spinner Fidget-Spinner Awaiting requested review from Fidget-Spinner Fidget-Spinner is a code owner

@savannahostrowski savannahostrowski Awaiting requested review from savannahostrowski savannahostrowski is a code owner

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /