-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[region-isolation] Do not look through begin_borrow or move_value if they are marked as a var_decl. #72959
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
Conversation
@swift-ci smoke test |
This is actually going to cause a merge conflict with a different PR I have going. I am going to do some more work here and rebase on top of that. That means I am going to put my SILIsolationInfo refactoring work here as well. |
b74015c
to
0a38a5b
Compare
@swift-ci smoke test |
0a38a5b
to
75e7a40
Compare
@swift-ci smoke test |
75e7a40
to
dc13982
Compare
@swift-ci smoke test |
isolatedValue(isolatedValue), actorInstance(actorInstance) { | ||
assert((!actorInstance || | ||
(actorIsolation.getKind() == ActorIsolation::ActorInstance && | ||
actorInstance->getType().isActor())) && |
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.
actorInstance->getType().isActor())) && | |
actorInstance->getType().isAnyActor())) && |
otherwise would crash on a distributed actor
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 actually calls:
bool TypeBase::isActorType() {
if (auto actor = getAnyActor())
return actor->isActor();
return false;
}
which does any actor.
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.
Right, which is still wrong isn't it? It does actor->isActor()
there but should do actor->isAnyActor()
.
The isActor
checks for inheriting from Actor
but we need either Actor
or DistributedActor
or this will fail when isolated to a distributed actor
right?
Not much I can say about the analysis bits but looked good :) |
… isolation info. I am finding that I am calling that a bunch so this just makes it a little more convenient.
…ment. Having two artificial typedefs for the same wrapped value is just confusing. Better to just have one and make the code simpler to understand.
…they are marked as a var_decl. The reason why we do this is that we want to treat this as a separate value from their operand since they are the result of defining a new value. This has a few nice side-effects, one of which is that if a let results in just a begin_borrow [var_decl], we emit names for it. I also did a little work around helping variable name utils to lookup names from applies that are fed into a {move_value,begin_borrow} [var_decl] which then has the debug_value we are searching for.
…ment_addr and global_addr onto SILIsolationInfo and call that instead.
…efInst/ClassMethodInst into SILIsolationInfo::get instead of handrolling in RegionAnalysis.
…ationInfo::get instead of computing actor isolation by hand. Just more recoring on top of SILIsolationInfo::get.
This ensures that when we process, we consider load/load_borrow's result to be equivalent to its operand. This ensures that a load/load_borrow cannot act as a use of its operand preventing spurious diagnostics.
…ce that a value is isolated to if we are dealing with an actor instance. This will let us distinguish in between values derived from two actor instances of the same type and to emit better errors.
…o VariableNameInferrer. I have been using these in TransferNonSendable and they are useful in terms of reducing the amount of code that one has to type to use this API. I am going to need to use it in SILIsolationInfo, so it makes sense to move it into SILOptimizer/Utils. NFCI.
…iagnostics, if we have a SIL actor instance, print -isolated instead of actor-isolated. rdar://122501400
…ctor self. rdar://122501400
…ated to a #isolated as being globally isolated to that. Instead, we need to consider the isolation at the apply site. rdar://126285681 rdar://125078448
The thinko was that rather than use the actual isolated parameter of a partial apply as the isolated parameter, I instead just used the last operand... :doh:. This fixes: rdar://126297097
dc13982
to
969dd69
Compare
@swift-ci smoke test |
Lets try this again |
@swift-ci smoke test |
1 similar comment
@swift-ci smoke test |
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.
Sorry but I still think this assertion will wrongly crash for distributed actor isolated code -- commented inline
I went through and converted all usages in TransferNonSendable to use isAnyActor instead of isActor as requested.
@swift-ci smoke test |
I also included some tests around distributed actors as well to validate that we do not crash. |
Just chopping off parts of a larger piece of work while I work at the same time on another piece of work.
The reason why we do this is that we want to treat this as a separate value from
their operand since they are the result of defining a new value.
This has a few nice side-effects, one of which is that if a let results in just
a begin_borrow [var_decl], we emit names for it.
I also did a little work around helping variable name utils to lookup names from
applies that are fed into a {move_value,begin_borrow} [var_decl] which then has
the debug_value we are searching for.