Skip to content

Commit 395bdfc

Browse files
eendebakptclaude
andcommitted
Add TO_BOOL_GENERIC specialization and _TO_BOOL_DICT JIT optimization
- Add TO_BOOL_GENERIC: a catch-all specialization for types not covered by existing TO_BOOL variants (dict, tuple, float, set, bytes, frozenset, etc. and heap types with __bool__/__len__). Records type info for the JIT. - Add _TO_BOOL_DICT: a tier2-only uop that checks dict.ma_used directly instead of calling PyObject_IsTrue(). The JIT optimizer replaces _TO_BOOL with _TO_BOOL_DICT when the type is known to be dict or frozendict. - Fix _GUARD_TYPE_VERSION optimizer handler to resolve types from recorded type info even when the type version cache has a collision. This enables the optimizer to eliminate redundant type guards (e.g. _GUARD_NOS_LIST) in more cases. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 6009309 commit 395bdfc

17 files changed

+1295
-990
lines changed

Include/internal/pycore_opcode_metadata.h

Lines changed: 8 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)