mirror of
https://github.com/python/cpython.git
synced 2026-01-29 18:52:38 +00:00
GH-138245: Perform boolean guards by testing a single bit, rather than a full pointer comparison. (GH-143810)
This commit is contained in:
parent
f52af86cba
commit
9eab67d507
8 changed files with 2478 additions and 1027 deletions
|
|
@ -5273,6 +5273,28 @@ dummy_func(
|
|||
AT_END_EXIT_IF(!is_false);
|
||||
}
|
||||
|
||||
replicate(4:8) op (_GUARD_BIT_IS_SET_POP, (flag -- )) {
|
||||
#ifdef Py_STACKREF_DEBUG
|
||||
uintptr_t bits = flag.index;
|
||||
#else
|
||||
uintptr_t bits = flag.bits;
|
||||
#endif
|
||||
uintptr_t set = (1 << oparg) & bits;
|
||||
DEAD(flag);
|
||||
AT_END_EXIT_IF(set == 0);
|
||||
}
|
||||
|
||||
replicate(4:8) op (_GUARD_BIT_IS_UNSET_POP, (flag -- )) {
|
||||
#ifdef Py_STACKREF_DEBUG
|
||||
uintptr_t bits = flag.index;
|
||||
#else
|
||||
uintptr_t bits = flag.bits;
|
||||
#endif
|
||||
uintptr_t set = (1 << oparg) & bits;
|
||||
DEAD(flag);
|
||||
AT_END_EXIT_IF(set != 0);
|
||||
}
|
||||
|
||||
op (_GUARD_IS_NONE_POP, (val -- )) {
|
||||
int is_none = PyStackRef_IsNone(val);
|
||||
if (!is_none) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue