python / python/cpython

Tier 2 trace projection does not insert necessary guards

Open
#118,540 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

interpreter-core
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

Tier 2 trace projection can project traces through branches, calls, etc.
Currently we rely on the tier 1 instruction definition to perform the necessary checks, but this is flawed.

Consider a perfectly valid specialization of calls to class, that checked merely that the callable was a class.
This would be a perfectly valid instruction and will work flawlessly in tier 1, but will be wrong in a tier 2 trace that assumes a specific class.
Tier 2 trace projection needs to insert the necessary guards.

A lot of these extra guards will be redundant, but we can rely on the optimizer to remove them.

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

Locate the Tier 2 trace projection entry points and compare them with the Tier 1 instruction definitions, focusing on branches and calls. Define the missing guard cases, then verify that projected traces remain correct when an instruction specializes a callable to a specific class, including coverage for redundant guards removed by optimization.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
compilers
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.