| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
@cocolato in future can you avoid referencing the meta-issue in PRs. Make a new issue if you need to. I've done that for this PR already. |
Sorry, something went wrong.
|
The removal of the "heap safe" check can be done for any return and for yields as well. |
Sorry, something went wrong.
Sorry about that, and thanks for letting me know! I've updated the code. |
Sorry, something went wrong.
There was a problem hiding this comment.
Take care with the negation of predicates. The opposite of "knowing x is true", is "not knowing that x is true", not "knowing that x is false".
Can you add a test case that fails for this PR as written.
Something like:
cond = False
def f(a):
if cond:
del a
return a
def g():
x = 1
return f(x)
for _ in range(THRESHOLD):
g()g will pass a borrowed reference to f which will then incorrectly return a borrowed reference.
Sorry, something went wrong.
|
|
||
| op(_MAKE_HEAP_SAFE, (value -- value)) { | ||
| // If the value is not borrowed, or is immortal, it's heap-safe. | ||
| if (!PyJitRef_IsBorrowed(value) || |
There was a problem hiding this comment.
I don't think this is right. PyJitRef_IsBorrowed(value) means that we know that the reference value is borrowed, but !PyJitRef_IsBorrowed(value) merely means that we don't know that it is borrowed, not that we know it isn't borrowed.
I think we can only apply this to immortal values.
Sorry, something went wrong.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request. |
Sorry, something went wrong.
In this case, because a is a small int, so it will be optimized by immortal check, I wrote other simple fail test after we only check immortal return values: def returns_owned(x):
return x + 1
If this does not meet our expectations, I can add more tests later. |
Sorry, something went wrong.
|
I have made the requested changes; please review again |
Sorry, something went wrong.
|
Thanks for making the requested changes! @markshannon: please review the changes made to this pull request. |
Sorry, something went wrong.
There was a problem hiding this comment.
This looks good now, thanks.
(Sorry for taking so long to get back to this)
Sorry, something went wrong.
|
Thanks for reply and review! Updated. |
Sorry, something went wrong.
|
@cocolato @Fidget-Spinner With PYTHON_JIT_STRESS=1 the tests now fail (for me) in test_dataclasses on main, and bisecting leads to this commit. I don't see anything wrong with this PR, so it might have exposed a pre-existing bug. |
Sorry, something went wrong.
|
@markshannon I found the bug and will have a fix up shortly. |
Sorry, something went wrong.
…count operations in RETURN_VALUE and YIELD_VALUE (pythonGH-144414)
| Back | FazBrowse Home | New Git URL |
Split RETURN_VALUE and YIELD_VALUE into macro form with a new _MAKE_HEAP_SAFE micro-op, so the tier2 optimizer can eliminate unnecessary PyStackRef_MakeHeapSafe() calls when the value is already heap-safe (owned or immortal).