swift
75152e78 - [region-isolation] Teach region isolation how to handle cases where due to compiler bugs, we have a function isolated to self without an isolated parameter.

Commit
1 year ago
[region-isolation] Teach region isolation how to handle cases where due to compiler bugs, we have a function isolated to self without an isolated parameter. Closures generally only inherit actor instance isolation if they directly capture state from the actor instance. In this case, for some reason that is not true, so we hit an assert that assumes that we will only see a global actor isolated isolation. Region Isolation should be able to handle code even if the closure isolation invariant is violated by the frontend. So to do this, I am introducing a new singleton actor instance to represent the isolation of a defer or closure created in an actor instance isolated method. The reason why I am using a singleton is that closures and defer are not methods so we do not actually know which parameter is 'self' since it isn't in the abi. But we still need some value to represent the captured values as belonging to. To square this circle, I just did what we have done in a similar situation where we did not have a value: (ActorAccessorInit). In that case, we just use a sentinel to represent the instance (NOTE: This is represented just via a kind so ActorInstances that are operator== equal will not &value equal since we are just using a kind).
Author
Committer
Parents
Loading