-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Distributed] Ensure _remote funcs synthesized before dynamic replacement #38974
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
[Distributed] Ensure _remote funcs synthesized before dynamic replacement #38974
Conversation
@@ -5995,6 +5995,10 @@ class AbstractFunctionDecl : public GenericContext, public ValueDecl { | |||
/// Returns 'true' if the function is distributed. | |||
bool isDistributed() const; | |||
|
|||
/// Get (or synthesize) the associated remote function for this one. | |||
/// For example, for `distributed func hi()` get `func _remote_hi()`. | |||
AbstractFunctionDecl *getDistributedActorRemoteFuncDecl() const; |
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'm really happy with this approach -- it allows us to just get the remote func whenever we want, and if it wasn't synthesized yet, it becomes synthesized.
In some situations we may need for force synthesizing all _remote funcs, e.g. when the dynamic member replacement is triggered, since we don't know yet which exact function we'll be looking up -- I believe we can improve this in the future when we do some @remoteFuncReplacement since then we know exactly which one to "get" for, this way everything will be even more lazy.
@@ -933,18 +933,18 @@ class IsDistributedActorRequest : | |||
bool isCached() const { return true; } | |||
}; | |||
|
|||
/// Determine whether the given func is distributed. | |||
class IsDistributedFuncRequest : |
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 request is removed now since it is so cheap we dont need to cache it
@swift-ci please smoke test |
@swift-ci please build toolchain |
// | ||
// This request is cached, so it won't cause wasted/duplicate work. | ||
TypeChecker::addImplicitDistributedActorRemoteFunctions(clazz); | ||
} |
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 is the important bit (well, one of them); if we first visit an extension, and didn't yet synthesize remote functions, but the extension has an function dynamic member replacement, the function it wants to replace does not exist yet so we must trigger synthesis. We can be smarter about the synthesis later, by requesting the specific func, but realistically we need all of them anyway and this unblocks us for now.
@swift-ci please smoke test |
1 similar comment
@swift-ci please smoke test |
@swift-ci please build toolchain |
Linux Toolchain (Ubuntu 16.04) Install command |
@swift-ci please smoke test |
Weird macos test error
|
@swift-ci please smoke test macOS Platform |
CI is having known issues re:
|
macOS Toolchain Install command |
@swift-ci please smoke test macOS Platform |
@swift-ci please smoke test linux Platform |
MacOS had timed out... @swift-ci please smoke test macOS Platform and merge |
Build timeout again... 😢 |
@swift-ci please smoke test macOS Platform |
CI really not cooperating this weekend...
|
@swift-ci please smoke test macOS Platform |
… replacement (swiftlang#38974)" This reverts commit fe4ba18.
This enables a _remote function to be looked up even if we FIRST visit an extension, say in a different file, and notice a dynamic member replacement there. This will be the case basically always since member replacements are in generated sources, in other files.
This cleans up also some cached requests which don't need to be cached since they just check for the presence of an attribute which is pretty cheap.
More cleanups to follow because now we can move all protocol witness required synthesis to the DerivedMember style -- something we could not do before since we needed to synthesize initializers etc.