mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
GH-131798: Narrow types more aggressively in the JIT (GH-134373)
This commit is contained in:
parent
e1c0c451a2
commit
2f0570caf4
10 changed files with 180 additions and 88 deletions
18
Python/optimizer_cases.c.h
generated
18
Python/optimizer_cases.c.h
generated
|
@ -102,6 +102,12 @@
|
|||
break;
|
||||
}
|
||||
|
||||
case _POP_TWO: {
|
||||
stack_pointer += -2;
|
||||
assert(WITHIN_STACK_BOUNDS());
|
||||
break;
|
||||
}
|
||||
|
||||
case _PUSH_NULL: {
|
||||
JitOptSymbol *res;
|
||||
res = sym_new_null(ctx);
|
||||
|
@ -1259,6 +1265,18 @@
|
|||
}
|
||||
|
||||
case _CHECK_ATTR_CLASS: {
|
||||
JitOptSymbol *owner;
|
||||
owner = stack_pointer[-1];
|
||||
uint32_t type_version = (uint32_t)this_instr->operand0;
|
||||
PyObject *type = (PyObject *)_PyType_LookupByVersion(type_version);
|
||||
if (type) {
|
||||
if (type == sym_get_const(ctx, owner)) {
|
||||
REPLACE_OP(this_instr, _NOP, 0, 0);
|
||||
}
|
||||
else {
|
||||
sym_set_const(owner, type);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue