mirror of
https://github.com/python/cpython.git
synced 2026-04-21 11:21:03 +00:00
gh-131798: fold super method lookups in JIT (#148231)
This commit is contained in:
parent
ee5232782f
commit
458aca9237
14 changed files with 1762 additions and 1278 deletions
|
|
@ -2630,14 +2630,31 @@ dummy_func(
|
|||
attr_st = PyStackRef_FromPyObjectSteal(attr);
|
||||
}
|
||||
|
||||
inst(LOAD_SUPER_ATTR_METHOD, (unused/1, global_super_st, class_st, self_st -- attr, self_or_null)) {
|
||||
macro(LOAD_SUPER_ATTR_METHOD) =
|
||||
_RECORD_NOS +
|
||||
unused/1 +
|
||||
_GUARD_LOAD_SUPER_ATTR_METHOD +
|
||||
_LOAD_SUPER_ATTR_METHOD;
|
||||
|
||||
op(_GUARD_NOS_TYPE_VERSION, (type_version/2, nos, unused -- nos, unused)) {
|
||||
PyTypeObject *tp = (PyTypeObject *)PyStackRef_AsPyObjectBorrow(nos);
|
||||
assert(type_version != 0);
|
||||
EXIT_IF(!PyType_Check((PyObject *)tp));
|
||||
EXIT_IF(FT_ATOMIC_LOAD_UINT_RELAXED(tp->tp_version_tag) != type_version);
|
||||
}
|
||||
|
||||
op(_GUARD_LOAD_SUPER_ATTR_METHOD, (global_super_st, class_st, unused -- global_super_st, class_st, unused)) {
|
||||
PyObject *global_super = PyStackRef_AsPyObjectBorrow(global_super_st);
|
||||
PyObject *class = PyStackRef_AsPyObjectBorrow(class_st);
|
||||
PyObject *self = PyStackRef_AsPyObjectBorrow(self_st);
|
||||
|
||||
assert(oparg & 1);
|
||||
EXIT_IF(global_super != (PyObject *)&PySuper_Type);
|
||||
EXIT_IF(!PyType_Check(class));
|
||||
}
|
||||
|
||||
op(_LOAD_SUPER_ATTR_METHOD, (global_super_st, class_st, self_st -- attr, self_or_null)) {
|
||||
PyObject *class = PyStackRef_AsPyObjectBorrow(class_st);
|
||||
PyObject *self = PyStackRef_AsPyObjectBorrow(self_st);
|
||||
|
||||
STAT_INC(LOAD_SUPER_ATTR, hit);
|
||||
PyObject *name = GETITEM(FRAME_CO_NAMES, oparg >> 2);
|
||||
PyTypeObject *cls = (PyTypeObject *)class;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue