mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +00:00
gh-131798: Optimize _ITER_CHECK_TUPLE
(GH-134803)
This commit is contained in:
parent
ac539e7e0d
commit
79d81f7cba
3 changed files with 14 additions and 0 deletions
|
@ -0,0 +1 @@
|
|||
Allow the JIT to remove unnecessary ``_ITER_CHECK_TUPLE`` ops.
|
|
@ -914,6 +914,13 @@ dummy_func(void) {
|
|||
}
|
||||
}
|
||||
|
||||
op(_ITER_CHECK_TUPLE, (iter, null_or_index -- iter, null_or_index)) {
|
||||
if (sym_matches_type(iter, &PyTuple_Type)) {
|
||||
REPLACE_OP(this_instr, _NOP, 0, 0);
|
||||
}
|
||||
sym_set_type(iter, &PyTuple_Type);
|
||||
}
|
||||
|
||||
op(_ITER_NEXT_RANGE, (iter, null_or_index -- iter, null_or_index, next)) {
|
||||
next = sym_new_type(ctx, &PyLong_Type);
|
||||
}
|
||||
|
|
6
Python/optimizer_cases.c.h
generated
6
Python/optimizer_cases.c.h
generated
|
@ -1615,6 +1615,12 @@
|
|||
}
|
||||
|
||||
case _ITER_CHECK_TUPLE: {
|
||||
JitOptSymbol *iter;
|
||||
iter = stack_pointer[-2];
|
||||
if (sym_matches_type(iter, &PyTuple_Type)) {
|
||||
REPLACE_OP(this_instr, _NOP, 0, 0);
|
||||
}
|
||||
sym_set_type(iter, &PyTuple_Type);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue