-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
[compiler v2] Emulating some unexpected v1 borrow behavior #13314
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #13314 +/- ##
=========================================
- Coverage 33.0% 32.9% -0.1%
=========================================
Files 1768 1768
Lines 339266 339263 -3
=========================================
- Hits 111995 111840 -155
- Misses 227271 227423 +152 ☔ View full report in Codecov by Sentry. |
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.
LGTM, thanks!
// conditions and produce an error ad-hoc. | ||
if is_mut | ||
&& !self.alive.after.contains_key(&dest) | ||
//&& self.state.children(&label).any(|e| e.target != child) |
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.
maybe remove this commented code?
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.
Done
|
||
// Preprocessing: check borrow safety of the currently active borrow graph for read ref, | ||
// write ref, and function calls. | ||
// Preprocessing: check borrow safety of the currently active borrow graph for |
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.
Since release_refs_not_alive_after is called after handling this instr, this is not needed anymore?
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.
It was always like a defensive meaure 'if something has been not release by now, do it now', but it should not be required as releasing happens (before and after) at the end of each instruction, with or without this new function. I removed it and verified everything works like before.
The difference is really that the cleanup at the end and what you did with your 'release before write' is now unified in release_refs_not_alive_after
. The special check whether the write destination is not a ref is also not longer needed, by doing the releasing after the output graph has been created.
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 suggest adding an "idempotent" comment to the function. Also, I renamed your PR, as discussed in slack.
} | ||
} | ||
|
||
// Some instructions may not have release inputs, do so now. The operation |
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.
release --> released
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.
And if this is operation is idempotent, you should document that on the function, not so necessary here.
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.
Done both
8439986
to
cc88ce9
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Fixes #12781 This also refactors and simplifies the releasing of references before write operations. I initially thought this was the problem but it wasn't, anyway the refactoring simplifies the code a bit.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ Forge suite
|
✅ Forge suite
|
✅ Forge suite
|
Description
Fixes #12781
This also refactors and simplifies the releasing of references before write operations. I initially thought this was the problem but it wasn't, anyway the refactoring simplifies the code a bit.
Type of Change
Which Components or Systems Does This Change Impact?
How Has This Been Tested?
New baseline test