mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +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
|
@ -118,6 +118,18 @@ dummy_func(void) {
|
|||
sym_set_type(left, &PyLong_Type);
|
||||
}
|
||||
|
||||
op(_CHECK_ATTR_CLASS, (type_version/2, owner -- owner)) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
op(_GUARD_TYPE_VERSION, (type_version/2, owner -- owner)) {
|
||||
assert(type_version);
|
||||
if (sym_matches_type_version(owner, type_version)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue