Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
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>
  • Loading branch information
eendebakpt and claude committed Mar 25, 2026
commit 395bdfc9aa2d2c62eaea7eafbce5dacf5ac34ea5
10 changes: 8 additions & 2 deletions Include/internal/pycore_opcode_metadata.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading