python / python/cpython

JIT: remove all uses of _PyType_LookupByVersion in optimizer_bytecodes.c

Open
#148,380 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

interpreter-core topic-JIT type-feature type-refactor
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

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 https://github.com/python/cpython/pull/148277/commits/8fab9d33c998d9c50a85f7705d0205aa175d03ab

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
  • gh-148394

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in optimizer_bytecodes.c and inspect the remaining _CHECK_ATTR_CLASS use of _PyType_LookupByVersion, using the linked commit and PR 148277 as context for recorded-value guards. Check PR 148394 because the issue lists linked work. Done means the remaining listed operation is converted and its relevant tests pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, python
Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.