-
-
Notifications
You must be signed in to change notification settings - Fork 34k
gh-143414: Implement unique reference tracking for JIT, optimize unpacking of such tuples #144300
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
base: main
Are you sure you want to change the base?
gh-143414: Implement unique reference tracking for JIT, optimize unpacking of such tuples #144300
Conversation
|
Discussed with @Fidget-Spinner, will reopen the PR after implementing |
|
Windows Ci failure looks possibly related, can you please look into it? |
Fidget-Spinner
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is excellent. Just 2 comments, then I think it's safe to merge.
|
|
||
| op(_COPY, (bottom, unused[oparg-1] -- bottom, unused[oparg-1], top)) { | ||
| assert(oparg > 0); | ||
| bottom = PyJitRef_IsUnique(bottom) ? PyJitRef_StripReferenceInfo(bottom) : bottom; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We only need to strip unique info here, not the borrow info too. This way we still get refcount elimination with the borrow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is consistent with the code?
If the ref is unique, we remove the unique tag, otherwise we leave it as is. Since a ref cannot be both unique and borrowed at the same time, borrowed/invalid refs will be maintained.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, thanks!
Some notes:
_BUILD_TUPLE, to be extended to other objects in the future_LOAD_FAST_*and_COPY.Would appreciate any feedback.
Thanks
unique reference trackingin Tier 2 for reference count optimizations #143414