-
Notifications
You must be signed in to change notification settings - Fork 349
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
[TB Optimization] Skip subtrees based on the subtree's root node's permissions #4008
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -173,7 +173,7 @@ impl LocationState { | |
rel_pos: AccessRelatedness, | ||
) -> ContinueTraversal { | ||
if rel_pos.is_foreign() { | ||
let new_access_noop = match (self.latest_foreign_access, access_kind) { | ||
let mut new_access_noop = match (self.latest_foreign_access, access_kind) { | ||
// Previously applied transition makes the new one a guaranteed | ||
// noop in the two following cases: | ||
// (1) justified by `foreign_read_is_noop_after_foreign_write` | ||
|
@@ -185,6 +185,30 @@ impl LocationState { | |
// need to be applied to this subtree. | ||
_ => false, | ||
}; | ||
if self.permission.is_disabled() { | ||
// A foreign access to a `Disabled` tag will have almost no observable effect. | ||
// It's a theorem that `Disabled` node have no protected initialized children, | ||
// and so this foreign access will never trigger any protector. | ||
// Further, the children will never be able to read or write again, since they | ||
// have a `Disabled` parents. Even further, all children of `Disabled` are one | ||
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. The argument could end here, right? The permissions below don't matter since anyway no access is possible. |
||
// of `ReservedIM`, `Disabled`, or a not-yet-accessed "lazy" permission thing. | ||
// The two former are already invariant under all foreign accesses, and for | ||
// the latter it does not really matter, since they can not be used/initialized | ||
// due to having a protected parent. So this only affects diagnostics, but the | ||
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. should be "disabled parent", right? |
||
// blocking write will still be identified directly, just at a different tag. | ||
new_access_noop = true; | ||
} | ||
if self.permission.is_frozen() && access_kind == AccessKind::Read { | ||
// A foreign read to a `Frozen` tag will have almost no observable effect. | ||
// It's a theorem that `Frozen` nodes have no active children, so all children | ||
// already survive foreign reads. Foreign reads in general have almost no | ||
// effect, the only further thing they could do is make protected `Reserved` | ||
// nodes become conflicted, i.e. make them reject child writes for the further | ||
// duration of their protector. But such a child write is already rejected | ||
// because this node is frozen. So this only affects diagnostics, but the | ||
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. Is it possible to add a testcase that demonstrates the effect on diagnostics? |
||
// blocking read will still be identified directly, just at a different tag. | ||
new_access_noop = true; | ||
} | ||
if new_access_noop { | ||
// Abort traversal if the new transition is indeed guaranteed | ||
// to be noop. | ||
|
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.
That's not an obvious theorem -- can you give a brief argument?
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's proven in Coq 😛.
The reason it holds is that to become disabled, you need to have a foreign write access happen. But that would have triggered any protected initialized nodes that are children of the node being disabled. And you can't have a new child of Disabled become initialized, because that would mean the to-be-initialized node has a child access, which is however blocked by the Disabled parent.