Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-119258: Handle STORE_ATTR_WITH_HINT in tier two #119481

Merged
merged 4 commits into from
May 28, 2024

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.

@@ -246,7 +246,7 @@ dict_next_version(PyInterpreterState *interp)
((INTERP)->dict_state.global_version += DICT_VERSION_INCREMENT)
#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.

@@ -2135,10 +2135,8 @@ dummy_func(
_GUARD_DORV_NO_DICT +
_STORE_ATTR_INSTANCE_VALUE;

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
55 of 56 checks passed
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