Skip to content

Commit ea0e772

Browse files
committed
Split LOAD_ATTR_METHOD_LAZY_DICT
1 parent 0f9fa7f commit ea0e772

File tree

5 files changed

+96
-32
lines changed

5 files changed

+96
-32
lines changed

Include/internal/pycore_opcode_metadata.h

Lines changed: 27 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/abstract_interp_cases.c.h

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/bytecodes.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2877,22 +2877,29 @@ dummy_func(
28772877
attr = Py_NewRef(descr);
28782878
}
28792879

2880-
inst(LOAD_ATTR_METHOD_LAZY_DICT, (unused/1, type_version/2, unused/2, descr/4, owner -- attr, self if (1))) {
2881-
assert(oparg & 1);
2882-
PyTypeObject *owner_cls = Py_TYPE(owner);
2883-
DEOPT_IF(owner_cls->tp_version_tag != type_version);
2884-
Py_ssize_t dictoffset = owner_cls->tp_dictoffset;
2880+
op(_CHECK_ATTR_METHOD_LAZY_DICT, (owner -- owner)) {
2881+
Py_ssize_t dictoffset = Py_TYPE(owner)->tp_dictoffset;
28852882
assert(dictoffset > 0);
28862883
PyObject *dict = *(PyObject **)((char *)owner + dictoffset);
28872884
/* This object has a __dict__, just not yet created */
28882885
DEOPT_IF(dict != NULL);
2886+
}
2887+
2888+
op(_LOAD_ATTR_METHOD_LAZY_DICT, (descr/4, owner -- attr, self if (1))) {
2889+
assert(oparg & 1);
28892890
STAT_INC(LOAD_ATTR, hit);
28902891
assert(descr != NULL);
28912892
assert(_PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_METHOD_DESCRIPTOR));
28922893
attr = Py_NewRef(descr);
28932894
self = owner;
28942895
}
28952896

2897+
macro(LOAD_ATTR_METHOD_LAZY_DICT) =
2898+
unused/1 +
2899+
_GUARD_TYPE_VERSION +
2900+
unused/2 +
2901+
_LOAD_ATTR_METHOD_LAZY_DICT;
2902+
28962903
inst(INSTRUMENTED_CALL, ( -- )) {
28972904
int is_meth = PEEK(oparg + 1) != NULL;
28982905
int total_args = oparg + is_meth;

Python/executor_cases.c.h

Lines changed: 29 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/generated_cases.c.h

Lines changed: 17 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)