Skip to content

Conversation

@brandtbucher
Copy link
Member

@brandtbucherbrandtbucher commented May 20, 2025

When setting the type version, we should also set the type (if possible). We can use this to narrow unknown classes to constants in uops like _CHECK_ATTR_CLASS.

(Also, fix a couple of cases where we were incorrectly detecting contradictions when updating some symbols.)

@brandtbucherbrandtbucher requested a review from tomasr8May 20, 2025 18:14
@brandtbucherbrandtbucher self-assigned this May 20, 2025
@brandtbucherbrandtbucher added performance Performance or resource usage interpreter-core (Objects, Python, Grammar, and Parser dirs) topic-JIT labels May 20, 2025
Comment on lines -568 to -592
case _POP_TOP_LOAD_CONST_INLINE:
case _POP_TOP_LOAD_CONST_INLINE_BORROW:
last->opcode = _NOP;
goto optimize_pop_top_again;
case _COPY:
case _LOAD_CONST_INLINE:
case _LOAD_CONST_INLINE_BORROW:
case _LOAD_FAST:
case _LOAD_FAST_BORROW:
case _LOAD_SMALL_INT:
last->opcode = _NOP;
if (opcode == _POP_TOP){
opcode = buffer[pc].opcode = _NOP;
}
else if (opcode == _POP_TOP_LOAD_CONST_INLINE){
opcode = buffer[pc].opcode = _LOAD_CONST_INLINE;
}
else if (opcode == _POP_TOP_LOAD_CONST_INLINE_BORROW){
opcode = buffer[pc].opcode = _LOAD_CONST_INLINE_BORROW;
}
else{
assert(opcode == _POP_TWO_LOAD_CONST_INLINE_BORROW);
opcode = buffer[pc].opcode = _POP_TOP_LOAD_CONST_INLINE_BORROW;
goto optimize_pop_top_again;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feels good 🤩

@brandtbucherbrandtbucher merged commit 2f0570c into python:mainMay 20, 2025
60 checks passed
lkollar pushed a commit to lkollar/cpython that referenced this pull request May 26, 2025
Pranjal095 pushed a commit to Pranjal095/cpython that referenced this pull request Jul 12, 2025
taegyunkim pushed a commit to taegyunkim/cpython that referenced this pull request Aug 4, 2025
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

interpreter-core(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usagetopic-JIT

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@brandtbucher@tomasr8