Skip to content

Commit 9bf03b6

Browse files
committed
[Distributed] Teach runtime that _executeDistributedTarget and accessors are generic over decoder type
1 parent d95a31e commit 9bf03b6

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

stdlib/public/Distributed/DistributedActor.cpp

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ void *swift_distributed_getGenericEnvironment(const char *targetNameStart,
4040
return accessor ? accessor->GenericEnvironment.get() : nullptr;
4141
}
4242

43-
/// func _executeDistributedTarget(
43+
/// func _executeDistributedTarget<D: DistributedTargetInvocationDecoder>(
4444
/// on: AnyObject,
4545
/// _ targetName: UnsafePointer<UInt8>,
4646
/// _ targetNameLength: UInt,
47-
/// argumentDecoder: AnyObject,
47+
/// argumentDecoder: inout D,
4848
/// argumentTypes: UnsafeBufferPointer<Any.Type>,
4949
/// resultBuffer: Builtin.RawPointer,
5050
/// substitutions: UnsafeRawPointer?,
@@ -59,7 +59,9 @@ using TargetExecutorSignature =
5959
/*resultBuffer=*/void *,
6060
/*substitutions=*/void *,
6161
/*witnessTables=*/void **,
62-
/*numWitnessTables=*/size_t),
62+
/*numWitnessTables=*/size_t,
63+
/*decoderType=*/Metadata *,
64+
/*decoderWitnessTable=*/void **),
6365
/*throws=*/true>;
6466

6567
SWIFT_CC(swiftasync)
@@ -75,14 +77,18 @@ TargetExecutorSignature::FunctionType swift_distributed_execute_target;
7577
/// - a list of witness tables
7678
/// - a number of witness tables in the buffer
7779
/// - a reference to an actor to execute method on.
80+
/// - a type of the argument decoder
81+
/// - a witness table associated with argument decoder value
7882
using DistributedAccessorSignature =
7983
AsyncSignature<void(/*argumentDecoder=*/HeapObject *,
8084
/*argumentTypes=*/const Metadata *const *,
8185
/*resultBuffer=*/void *,
8286
/*substitutions=*/void *,
8387
/*witnessTables=*/void **,
8488
/*numWitnessTables=*/size_t,
85-
/*actor=*/HeapObject *),
89+
/*actor=*/HeapObject *,
90+
/*decoderType=*/Metadata *,
91+
/*decoderWitnessTable=*/void **),
8692
/*throws=*/true>;
8793

8894
SWIFT_CC(swiftasync)
@@ -113,7 +119,9 @@ void ::swift_distributed_execute_target(
113119
void *resultBuffer,
114120
void *substitutions,
115121
void **witnessTables,
116-
size_t numWitnessTables) {
122+
size_t numWitnessTables,
123+
Metadata *decoderType,
124+
void **decoderWitnessTable) {
117125
auto *accessor = findDistributedAccessor(targetNameStart, targetNameLength);
118126
if (!accessor) {
119127
assert(false && "no distributed accessor");
@@ -136,10 +144,13 @@ void ::swift_distributed_execute_target(
136144
swift_distributed_execute_target_resume);
137145

138146
accessorEntry(calleeContext,
139-
argumentDecoder, argumentTypes,
147+
argumentDecoder,
148+
argumentTypes,
140149
resultBuffer,
141150
substitutions,
142151
witnessTables,
143152
numWitnessTables,
144-
actor);
153+
actor,
154+
decoderType,
155+
decoderWitnessTable);
145156
}

0 commit comments

Comments
 (0)