@@ -32,94 +32,6 @@ findDistributedAccessor(const char *targetNameStart, size_t targetNameLength) {
3232 return nullptr ;
3333}
3434
35- // / Find an accessible function record given a concrete actor type we're
36- // / attempting to make the call on, and the remote call method identifier.
37- static const AccessibleFunctionRecord *findDistributedProtocolMethodAccessor (
38- bool findConcreteWitness, const char *targetActorTypeNameStart,
39- size_t targetActorTypeNameLength, const char *targetNameStart,
40- size_t targetNameLength) {
41- // Find using just the method identifier;
42- // This will work if the call is a concrete method identifier
43- if (auto *func = runtime::swift_findAccessibleFunctionForConcreteType (
44- findConcreteWitness, targetActorTypeNameStart,
45- targetActorTypeNameLength, targetNameStart, targetNameLength)) {
46- assert (func->Flags .isDistributed ());
47- return func;
48- }
49-
50- return nullptr ;
51- }
52-
53- // / Given the presence of protocol witness distributed invocation targets,
54- // / obtain a concrete target name.
55- // /
56- // / A distributed target can be identified by a protocol method name:
57- // / ```
58- // / protocol WorkerProtocol {
59- // / associatedtype Ret
60- // / distributed func func test() -> Ret
61- // / }
62- // / ```
63- // /
64- // / So the remote call identifier may be "WorkerProtocol.test", however in order
65- // / to perform the invocation on a concrete target actor, we need to obtain
66- // / the concrete function we are about to invoke -- not least because of
67- // / its generic context details.
68- // /
69- // / A concrete type on the server may be:
70- // /
71- // / ```
72- // / distributed actor WorkerImpl: WorkerProtocol {
73- // / distributed func func test() -> String { "Hello" }
74- // / }
75- // / ```
76- // /
77- // / Thus this method allows mapping the "protocol method identifier" and
78- // / concrete actor name, into the target witness name.
79- // /
80- // / This way the generic context and other concrete information may be obtained
81- // / in order to perform the call on the concrete `WorkerImpl` type.
82- SWIFT_CC (swift)
83- SWIFT_EXPORT_FROM(swiftDistributed)
84- TypeNamePair swift_distributed_getConcreteAccessibleWitnessName(
85- DefaultActor *actor, const char *targetNameStart, size_t targetNameLength) {
86-
87- // TODO(distributed): Avoid mangling twice; we do it here and in `execute_`
88- auto actorTy = swift_getObjectType (actor);
89- auto actorTyNamePair = swift_getMangledTypeName (actorTy);
90- std::string actorTyName = actorTyNamePair.data ;
91-
92- auto accessor = findDistributedProtocolMethodAccessor (
93- /* findConcreteWitness=*/ true , actorTyNamePair.data ,
94- actorTyNamePair.length , targetNameStart, targetNameLength);
95-
96- if (!accessor) {
97- return {" " , 0 };
98- }
99-
100- auto concreteNameData = accessor->Name .get ();
101- auto concreteNameLength = strlen (accessor->Name .get ());
102- return {concreteNameData, concreteNameLength};
103- }
104-
105- SWIFT_CC (swift)
106- SWIFT_EXPORT_FROM(swiftDistributed)
107- void *swift_distributed_getGenericEnvironmentForConcreteActor(
108- DefaultActor *actor, const char *targetNameStart, size_t targetNameLength) {
109-
110- // TODO(distributed): Avoid mangling twice; we do it here and in `execute_`
111- auto actorTy = swift_getObjectType (actor);
112- auto actorTyNamePair = swift_getMangledTypeName (actorTy);
113-
114- auto *accessor = findDistributedProtocolMethodAccessor (
115- /* findConcreteWitness=*/ true , actorTyNamePair.data ,
116- actorTyNamePair.length , targetNameStart, targetNameLength);
117- if (!accessor) {
118- return nullptr ;
119- }
120-
121- return accessor->GenericEnvironment .get ();
122- }
12335
12436SWIFT_CC (swift)
12537SWIFT_EXPORT_FROM(swiftDistributed)
@@ -141,9 +53,7 @@ void *swift_distributed_getGenericEnvironment(const char *targetNameStart,
14153// / numWitnessTables: UInt
14254// / ) async throws
14355using TargetExecutorSignature =
144- AsyncSignature<void (/* on=*/ DefaultActor *, // FIXME(distributed): Make this
145- // accept AnyObject and not
146- // witness tables
56+ AsyncSignature<void (/* on=*/ DefaultActor *,
14757 /* targetName=*/ const char *, /* targetNameSize=*/ size_t ,
14858 /* argumentDecoder=*/ HeapObject *,
14959 /* argumentTypes=*/ const Metadata *const *,
0 commit comments