Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-100239: replace BINARY_SUBSCR & family by BINARY_OP with oparg NB_SUBSCR#129379

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
iritkatriel wants to merge11 commits intopython:mainfromiritkatriel:binary_subscr

Conversation

@iritkatriel
Copy link
Member

@iritkatrieliritkatriel commentedJan 27, 2025
edited by bedevere-appbot
Loading

return0;
}
PyListObject*list= (PyListObject*)container;
Py_ssize_tindex=index_obj->long_value.ob_digit[0];
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to check the index in the guard? We need to check it is nonnegative, but the other checks are handled also in the action by _PyList_GetItemRef. There will be no deopt, but that is no issue perhaps.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

We use the guard both to decide whether to optimise with this action, and then we call it from the action to decide whether to deopt. So once we pass the guard we should know that we're not deopting.

STAT_INC(BINARY_SUBSCR,hit);
Py_ssize_tindex= ((PyLongObject*)sub)->long_value.ob_digit[0];
PyListObject*list= (PyListObject*)container;
#ifdefPy_GIL_DISABLED
Copy link
Contributor

Choose a reason for hiding this comment

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

We can use _PyList_GetItemRef for both ft and normal builds.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Seems right.@corona10 I copied this over from herehttps://github.com/python/cpython/blame/8e57877e3f43e80762196f6869526d0c1585783a/Python/bytecodes.c#L869

Do you remember why we have the two versions?

PyListObject*list= (PyListObject*)container;
#ifdefPy_GIL_DISABLED
PyObject*res_o=_PyList_GetItemRef(list,index);
assert(res_o!=NULL);
Copy link
Contributor

Choose a reason for hiding this comment

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

What if the list is resized after the guard has been executed and before the action is executed. Then_PyList_GetItemRef can return NULL.

iritkatriel reacted with thumbs up emoji
@iritkatriel
Copy link
MemberAuthor

Closing in favour of#129700.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@eendebakpteendebakpteendebakpt left review comments

@ericsnowcurrentlyericsnowcurrentlyAwaiting requested review from ericsnowcurrentlyericsnowcurrently is a code owner

@Fidget-SpinnerFidget-SpinnerAwaiting requested review from Fidget-SpinnerFidget-Spinner is a code owner

@markshannonmarkshannonAwaiting requested review from markshannonmarkshannon is a code owner

@tomasr8tomasr8Awaiting requested review from tomasr8tomasr8 will be requested when the pull request is marked ready for reviewtomasr8 is a code owner

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@iritkatriel@eendebakpt

[8]ページ先頭

©2009-2025 Movatter.jp