Skip to content

JIT: remove all uses of _PyType_LookupByVersion in optimizer_bytecodes.c #148380

Open

Description

@Fidget-Spinner

Feature or enhancement

Proposal:

We should use recorded values instead, as that is not bounded by a limited-size cache, and it will be easier to make the optimizer thread safe for FT. See for example how I use recorded values for guards in this commit 8fab9d3

Ops that need converting:

  • _CHECK_ATTR_CLASS
  • _GUARD_TYPE_VERSION

@NekoAsakura would you like to work on this?

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

No response

Linked PRs

Activity

  1. Fidget-Spinner commented on Apr 11, 2026

    @Fidget-Spinner
    MemberAuthor

    not bounded by a limited-size cache

    A side note: this will make certain optimizations a lot more effective as well.

  2. NekoAsakura commented on Apr 11, 2026

    @NekoAsakura
    Member

    Sure!

  3. kumaraditya303 commented on Apr 11, 2026

    @kumaraditya303
    Contributor

    There is probably still some value in using the fixed version tags for builtin types, maybe we can find a way to use that with recorded types.

  4. Fidget-Spinner commented on Apr 11, 2026

    @Fidget-Spinner
    MemberAuthor

    the fixed version tags for builtin types

    Oh yes definitely. Which is why I'm still keeping it around in optimizer_symbols.c. So that builtin type versions are always successfully reverse lookuped to builtin types.

  5. added 9 commits that reference this issue on Apr 11, 2026
  6. added a commit that references this issue on May 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)topic-JITtype-featureA feature request or enhancementtype-refactorCode refactoring (with no changes in behavior)

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions