-
-
Notifications
You must be signed in to change notification settings - Fork 34.5k
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
Changes from 1 commit
e4b7f51
b32a8e2
7aeac0e
f8b7e4e
37d7c4b
7df2176
6f66c56
b251825
bcd5654
acfa737
a0fd9e2
645776a
cdb4a05
275732b
dbde059
bd70ebd
d16f298
bec7ee3
5c9b9c6
cdbe2e6
fb1d227
c7e53fb
6851962
8c8e0a9
a6fffdc
78978aa
0b07ac4
14e5d3d
8506038
d67617f
100eeb5
e476061
06a9ec1
6bce6b4
89dc467
4e6c792
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -1675,6 +1675,7 @@ dummy_func( | |||||
| PyObject *seq_o = PyStackRef_AsPyObjectBorrow(seq); | ||||||
| assert(PyTuple_CheckExact(seq_o)); | ||||||
| DEOPT_IF(PyTuple_GET_SIZE(seq_o) != oparg); | ||||||
|
reidenong marked this conversation as resolved.
Outdated
|
||||||
| DEOPT_IF(!_PyObject_IsUniquelyReferenced(seq_o)); | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
If our analysis is correct, we don't need a runtime check.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we might need itt? There could be an escaping uop in between the intial creation of the tuple which gets all gc tracked objects, accesses the unique tuple on the stack, then references it so that it's no longer unique under our feet.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any update on this?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we only track references on the evaluation stack, then there is no need for this check as the reference cannot escape. As soon as a value is stored in a local, it is unlikely to only have one reference to it when we actually use it.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think Mark is right here. |
||||||
| STAT_INC(UNPACK_SEQUENCE, hit); | ||||||
| PyObject **items = _PyTuple_ITEMS(seq_o); | ||||||
| for (int i = oparg; --i >= 0; ) { | ||||||
|
|
||||||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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 want to free the tuple directly, so we need to steal the reference.