KEMBAR78
GH-119258: Handle `STORE_ATTR_WITH_HINT` in tier two by brandtbucher · Pull Request #119481 · python/cpython · GitHub
Skip to content

Conversation

@brandtbucher
Copy link
Member

@brandtbucher brandtbucher commented May 23, 2024

This way we can remove the version check in the optimizer, too!

@brandtbucher brandtbucher added performance Performance or resource usage skip news interpreter-core (Objects, Python, Grammar, and Parser dirs) labels May 23, 2024
@brandtbucher brandtbucher self-assigned this May 23, 2024
@brandtbucher brandtbucher changed the title Handle STORE_ATTR_WITH_HINT in tier two GH-119258: Handle STORE_ATTR_WITH_HINT in tier two May 23, 2024
Copy link
Member

@markshannon markshannon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm hoping to remove STORE_ATTR_WITH_HINT once almost all instance have inline values.
Until then, this seems like a worthwhile improvement.

One question and a couple of suggestions.

#endif

void
PyAPI_FUNC(void)
Copy link
Member

@markshannon markshannon May 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this symbol need to be exposed?
It isn't used by the JIT.

It is used, via the _PyDict_NotifyEvent inline function.


inst(STORE_ATTR_WITH_HINT, (unused/1, type_version/2, hint/1, value, owner --)) {
op(_STORE_ATTR_WITH_HINT, (hint/1, value, owner --)) {
PyTypeObject *tp = Py_TYPE(owner);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
PyTypeObject *tp = Py_TYPE(owner);

This is only used in the assert, AFAICT, so will generate a compiler warning for non-debug builds.

PyTypeObject *tp = Py_TYPE(owner);
assert(type_version != 0);
DEOPT_IF(tp->tp_version_tag != type_version);
assert(tp->tp_flags & Py_TPFLAGS_MANAGED_DICT);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
assert(tp->tp_flags & Py_TPFLAGS_MANAGED_DICT);
assert(Py_TYPE(owner)->tp_flags & Py_TPFLAGS_MANAGED_DICT);

@bedevere-app
Copy link

bedevere-app bot commented May 24, 2024

When you're done making the requested changes, leave the comment: I have made the requested changes; please review again.

@brandtbucher brandtbucher merged commit 5cd3ffd into python:main May 28, 2024
noahbkim pushed a commit to hudson-trading/cpython that referenced this pull request Jul 11, 2024
estyxx pushed a commit to estyxx/cpython that referenced this pull request Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

interpreter-core (Objects, Python, Grammar, and Parser dirs) performance Performance or resource usage skip news

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants