mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-44337: Improve LOAD_ATTR specialization (GH-26759)
* Specialize obj.__class__ with LOAD_ATTR_SLOT * Specialize instance attribute lookup with attribute on class, provided attribute on class is not an overriding descriptor. * Add stat for how many times the unquickened instruction has executed.
This commit is contained in:
parent
82e5c28af7
commit
fb68791a26
3 changed files with 179 additions and 72 deletions
|
@ -2805,6 +2805,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag)
|
|||
|
||||
case TARGET(LOAD_GLOBAL): {
|
||||
PREDICTED(LOAD_GLOBAL);
|
||||
STAT_INC(LOAD_GLOBAL, unquickened);
|
||||
PyObject *name = GETITEM(names, oparg);
|
||||
PyObject *v;
|
||||
if (PyDict_CheckExact(GLOBALS())
|
||||
|
@ -3273,6 +3274,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag)
|
|||
|
||||
case TARGET(LOAD_ATTR): {
|
||||
PREDICTED(LOAD_ATTR);
|
||||
STAT_INC(LOAD_ATTR, unquickened);
|
||||
PyObject *name = GETITEM(names, oparg);
|
||||
PyObject *owner = TOP();
|
||||
PyObject *res = PyObject_GetAttr(owner, name);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue