Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Next Next commit
optimize jit attribute loads on immutable types
  • Loading branch information
kumaraditya303 committed Mar 26, 2026
commit 4b401a7e61ab3e14524695f64d4c1645167d4cef
5 changes: 4 additions & 1 deletion Python/optimizer_analysis.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,10 @@ lookup_attr(JitOptContext *ctx, _PyBloomFilter *dependencies, _PyUOpInstruction
if (type && PyType_Check(type)) {
PyObject *lookup = _PyType_Lookup(type, name);
if (lookup) {
int opcode = _Py_IsImmortal(lookup) ? immortal : mortal;
int opcode = mortal;
if (_Py_IsImmortal(lookup) || (type->tp_flags & Py_TPFLAGS_IMMUTABLETYPE)) {
opcode = immortal;
}
ADD_OP(opcode, 0, (uintptr_t)lookup);
PyType_Watch(TYPE_WATCHER_ID, (PyObject *)type);
_Py_BloomFilter_Add(dependencies, type);
Expand Down
Loading