mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-131798: JIT: Narrow the return type of _CALL_LEN to int (#132940)
Reduce unnecessary guards whenever `len()` is called and used after. Co-authored-by: Max Bernstein <tekknolagi@gmail.com>
This commit is contained in:
parent
f0485de43a
commit
4c20f46fa0
4 changed files with 18 additions and 1 deletions
|
@ -1055,6 +1055,10 @@ dummy_func(void) {
|
|||
sym_set_const(callable, (PyObject *)&PyUnicode_Type);
|
||||
}
|
||||
|
||||
op(_CALL_LEN, (callable[1], self_or_null[1], args[oparg] -- res)) {
|
||||
res = sym_new_type(ctx, &PyLong_Type);
|
||||
}
|
||||
|
||||
// END BYTECODES //
|
||||
|
||||
}
|
||||
|
|
2
Python/optimizer_cases.c.h
generated
2
Python/optimizer_cases.c.h
generated
|
@ -2014,7 +2014,7 @@
|
|||
|
||||
case _CALL_LEN: {
|
||||
JitOptSymbol *res;
|
||||
res = sym_new_not_null(ctx);
|
||||
res = sym_new_type(ctx, &PyLong_Type);
|
||||
stack_pointer[-2 - oparg] = res;
|
||||
stack_pointer += -1 - oparg;
|
||||
assert(WITHIN_STACK_BOUNDS());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue