diff options
| author | Brandt Bucher <brandtbucher@microsoft.com> | 2025-05-20 22:09:51 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-20 22:09:51 (GMT) |
| commit | 2f0570caf490d4edbfbfd75c529cdee24f6edb8a (patch) | |
| tree | ff4b0e0a7736df5a522699c5f2502d011c8764f7 /Python/optimizer_bytecodes.c | |
| parent | e1c0c451a2ff815fc817e71ec15c37bff9cb84d0 (diff) | |
| download | cpython-2f0570caf490d4edbfbfd75c529cdee24f6edb8a.zip cpython-2f0570caf490d4edbfbfd75c529cdee24f6edb8a.tar.gz cpython-2f0570caf490d4edbfbfd75c529cdee24f6edb8a.tar.bz2 | |
GH-131798: Narrow types more aggressively in the JIT (GH-134373)
Diffstat (limited to 'Python/optimizer_bytecodes.c')
| -rw-r--r-- | Python/optimizer_bytecodes.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Python/optimizer_bytecodes.c b/Python/optimizer_bytecodes.c index 639b4b7..f12cd7b 100644 --- a/Python/optimizer_bytecodes.c +++ b/Python/optimizer_bytecodes.c @@ -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)) { |
