diff options
author | Mark Shannon <mark@hotpy.org> | 2021-06-21 11:49:21 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-21 11:49:21 +0100 |
commit | fb68791a26e157ed3cdeb409c8d8b6cddc7535bd (patch) | |
tree | f654ff7e23e9736a379ef7939f1dfebecf8ba574 /Python/ceval.c | |
parent | 82e5c28af7049c4f5343c808f172cbe2e145f49b (diff) | |
download | cpython-fb68791a26e157ed3cdeb409c8d8b6cddc7535bd.tar.gz cpython-fb68791a26e157ed3cdeb409c8d8b6cddc7535bd.zip |
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.
Diffstat (limited to 'Python/ceval.c')
-rw-r--r-- | Python/ceval.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index 699cd865faa..b5e3dd53c84 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -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); |