Skip to content

Commit afd521f

Browse files
committed
[Distributed] Undo ABI change in _executeDistributedTarget
1 parent 9eb9a2e commit afd521f

File tree

4 files changed

+22
-40
lines changed

4 files changed

+22
-40
lines changed

lib/IRGen/GenDistributed.cpp

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -230,14 +230,9 @@ static CanSILFunctionType getAccessorType(IRGenModule &IGM,
230230

231231
// actor
232232

233-
auto actorTypeParam =
234-
GenericTypeParamType::get(/*isParameterPack=*/false,
235-
/*depth=*/0, /*index=*/1, Context);
233+
auto actorTypeParam = Context.getAnyObjectType();
236234
parameters.push_back(
237235
GenericFunctionType::Param(actorTypeParam));
238-
auto distributedActorTy =
239-
Context.getDistributedActorDecl()
240-
->getDeclaredInterfaceType();
241236

242237
auto decoderProtocolTy =
243238
Context
@@ -250,21 +245,13 @@ static CanSILFunctionType getAccessorType(IRGenModule &IGM,
250245
SmallVector<GenericTypeParamType *, 4> genericParams;
251246
SmallVector<Requirement, 4> genericRequirements;
252247

253-
assert(getDistributedActorOf(Target) &&
254-
"target must be declared inside distributed actor");
255-
256248
// Add a generic parameter `D` which stands for decoder type in the
257249
// accessor signature - `inout D`.
258250
genericParams.push_back(decoderType);
259251
// Add a requirement that decoder conforms to the expected protocol.
260252
genericRequirements.push_back(
261253
{RequirementKind::Conformance, decoderType, decoderProtocolTy});
262254

263-
genericRequirements.push_back(
264-
{RequirementKind::Conformance, actorTypeParam, distributedActorTy});
265-
266-
genericParams.push_back(actorTypeParam);
267-
268255
signature = buildGenericSignature(Context, GenericSignature(),
269256
std::move(genericParams),
270257
std::move(genericRequirements),
@@ -603,14 +590,8 @@ void DistributedAccessor::emit() {
603590
// Metadata that represents passed in the invocation decoder.
604591
auto *decoderType = params.claimNext();
605592

606-
// Metadata that represents the actor the invocation is on.
607-
auto *actorType = params.claimNext();
608-
(void)actorType;
609-
610593
// Witness table for decoder conformance to DistributedTargetInvocationDecoder
611594
auto *decoderProtocolWitness = params.claimNext();
612-
auto *distributedActorWitness = params.claimNext();
613-
(void)distributedActorWitness;
614595

615596
// Preliminary: Setup async context for this accessor.
616597
{

stdlib/public/Distributed/DistributedActor.cpp

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,7 @@ using TargetExecutorSignature =
6161
/*witnessTables=*/void **,
6262
/*numWitnessTables=*/size_t,
6363
/*decoderType=*/Metadata *,
64-
/*actorType=*/Metadata *,
65-
/*decoderWitnessTable=*/void **,
66-
/*distributedActorWitnessTable=*/void **
64+
/*decoderWitnessTable=*/void **
6765
),
6866
/*throws=*/true>;
6967

@@ -91,9 +89,8 @@ using DistributedAccessorSignature =
9189
/*numWitnessTables=*/size_t,
9290
/*actor=*/HeapObject *,
9391
/*decoderType=*/Metadata *,
94-
/*actorType=*/Metadata *,
95-
/*decoderWitnessTable=*/void **,
96-
/*actorWitnessTable=*/void **),
92+
/*decoderWitnessTable=*/void **
93+
),
9794
/*throws=*/true>;
9895

9996
SWIFT_CC(swiftasync)
@@ -129,9 +126,11 @@ void swift_distributed_execute_target(
129126
void **witnessTables,
130127
size_t numWitnessTables,
131128
Metadata *decoderType,
132-
Metadata *actorType,
133-
void **decoderWitnessTable,
134-
void **actorWitnessTable) {
129+
// Metadata *actorType,
130+
void **decoderWitnessTable
131+
// ,
132+
// void **actorWitnessTable
133+
) {
135134
auto *accessor = findDistributedAccessor(targetNameStart, targetNameLength);
136135
if (!accessor) {
137136
SwiftError *error =
@@ -166,7 +165,9 @@ void swift_distributed_execute_target(
166165
numWitnessTables,
167166
actor,
168167
decoderType,
169-
actorType,
170-
decoderWitnessTable,
171-
actorWitnessTable);
168+
// actorType,
169+
decoderWitnessTable
170+
// ,
171+
// actorWitnessTable
172+
);
172173
}

stdlib/public/Distributed/DistributedActorSystem.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -652,8 +652,8 @@ public struct RemoteCallTarget: CustomStringConvertible, Hashable {
652652

653653
@available(SwiftStdlib 5.7, *)
654654
@_silgen_name("swift_distributed_execute_target")
655-
func _executeDistributedTarget<D: DistributedTargetInvocationDecoder, DA: DistributedActor>(
656-
on actor: DA, // DistributedActor
655+
func _executeDistributedTarget<D: DistributedTargetInvocationDecoder>(
656+
on actor: AnyObject, // : DistributedActor
657657
_ targetName: UnsafePointer<UInt8>, _ targetNameLength: UInt,
658658
argumentDecoder: inout D,
659659
argumentTypes: Builtin.RawPointer,

test/Distributed/distributed_actor_accessor_thunks_64bit.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public distributed actor MyOtherActor {
9494

9595
// CHECK: define hidden swift{{(tail)?}}cc void @"$s27distributed_actor_accessors7MyActorC7simple1yySiYaKFTE"
9696

97-
// CHECK: define linkonce_odr hidden swift{{(tail)?}}cc void @"$s27distributed_actor_accessors7MyActorC7simple1yySiYaKFTETF"(ptr swiftasync %0, ptr %1, ptr %2, ptr %3, {{.*}}, ptr [[ACTOR:%.*]], ptr [[DECODER_TYPE:%.*]], ptr [[ACTOR_TYPE:%.*]], ptr [[DECODER_PROTOCOL_WITNESS:%.*]], ptr [[ACTOR_PROTOCOL_WITNESS:%.*]])
97+
// CHECK: define linkonce_odr hidden swift{{(tail)?}}cc void @"$s27distributed_actor_accessors7MyActorC7simple1yySiYaKFTETF"(ptr swiftasync %0, ptr %1, ptr %2, ptr %3, {{.*}}, ptr [[ACTOR:%.*]], ptr [[DECODER_TYPE:%.*]], ptr [[DECODER_PROTOCOL_WITNESS:%.*]])
9898

9999
/// Read the current offset and cast an element to `Int`
100100

@@ -177,7 +177,7 @@ public distributed actor MyOtherActor {
177177
// CHECK: define hidden swift{{(tail)?}}cc void @"$s27distributed_actor_accessors7MyActorC7simple3ySiSSYaKFTE"
178178

179179
/// !!! in `simple3` interesting bits are: argument value extraction (because string is exploded into N arguments) and call to distributed thunk
180-
// CHECK: define linkonce_odr hidden swift{{(tail)?}}cc void @"$s27distributed_actor_accessors7MyActorC7simple3ySiSSYaKFTETF"(ptr swiftasync %0, ptr [[ARG_DECODER:%.*]], ptr [[ARG_TYPES:%.*]], ptr [[RESULT_BUFF:%.*]], ptr [[SUBS:%.*]], ptr [[WITNESS_TABLES:%.*]], i64 [[NUM_WITNESS_TABLES:%.*]], ptr [[ACTOR]], ptr [[DECODER_TYPE:%.*]], ptr [[ACTOR_TYPE:%.*]], ptr [[DECODER_PROTOCOL_WITNESS:%.*]], ptr [[ACTOR_PROTOCOL_WITNESS:%.*]])
180+
// CHECK: define linkonce_odr hidden swift{{(tail)?}}cc void @"$s27distributed_actor_accessors7MyActorC7simple3ySiSSYaKFTETF"(ptr swiftasync %0, ptr [[ARG_DECODER:%.*]], ptr [[ARG_TYPES:%.*]], ptr [[RESULT_BUFF:%.*]], ptr [[SUBS:%.*]], ptr [[WITNESS_TABLES:%.*]], i64 [[NUM_WITNESS_TABLES:%.*]], ptr [[ACTOR]], ptr [[DECODER_TYPE:%.*]], ptr [[DECODER_PROTOCOL_WITNESS:%.*]])
181181

182182

183183
// CHECK: [[ARG_SIZE:%.*]] = and i64 {{.*}}, -16
@@ -217,7 +217,7 @@ public distributed actor MyOtherActor {
217217

218218
// CHECK: define hidden swift{{(tail)?}}cc void @"$s27distributed_actor_accessors7MyActorC16single_case_enumyAA7SimpleEOAFYaKFTE"
219219

220-
// CHECK: define linkonce_odr hidden swift{{(tail)?}}cc void @"$s27distributed_actor_accessors7MyActorC16single_case_enumyAA7SimpleEOAFYaKFTETF"(ptr swiftasync %0, ptr [[ARG_DECODER:%.*]], ptr [[ARG_TYPES:%.*]], ptr [[RESULT_BUFF:%.*]], ptr [[SUBS:%.*]], ptr [[WITNESS_TABLES:%.*]], i64 [[NUM_WITNESS_TABLES:%.*]], ptr [[ACTOR]], ptr [[DECODER_TYPE]], ptr [[ACTOR_TYPE]], ptr [[DECODER_PROTOCOL_WITNESS:%.*]], ptr [[ACTOR_PROTOCOL_WITNESS:%.*]])
220+
// CHECK: define linkonce_odr hidden swift{{(tail)?}}cc void @"$s27distributed_actor_accessors7MyActorC16single_case_enumyAA7SimpleEOAFYaKFTETF"(ptr swiftasync %0, ptr [[ARG_DECODER:%.*]], ptr [[ARG_TYPES:%.*]], ptr [[RESULT_BUFF:%.*]], ptr [[SUBS:%.*]], ptr [[WITNESS_TABLES:%.*]], i64 [[NUM_WITNESS_TABLES:%.*]], ptr [[ACTOR]], ptr [[DECODER_TYPE]], ptr [[DECODER_PROTOCOL_WITNESS:%.*]])
221221

222222
/// Let's check that the call doesn't have any arguments and returns nothing.
223223

@@ -257,7 +257,7 @@ public distributed actor MyOtherActor {
257257

258258
// CHECK: define hidden swift{{(tail)?}}cc void @"$s27distributed_actor_accessors7MyActorC7complexyAA11LargeStructVSaySiG_AA3ObjCSSSgAFtYaKFTE"
259259

260-
// CHECK: define linkonce_odr hidden swift{{(tail)?}}cc void @"$s27distributed_actor_accessors7MyActorC7complexyAA11LargeStructVSaySiG_AA3ObjCSSSgAFtYaKFTETF"(ptr swiftasync {{.*}}, ptr [[ARG_DECODER:%.*]], ptr [[ARG_TYPES:%.*]], ptr [[RESULT_BUFF:%.*]], ptr [[SUBS:%.*]], ptr [[WITNESS_TABLES:%.*]], i64 [[NUM_WITNESS_TABLES:%.*]], ptr [[ACTOR]], ptr [[DECODER_TYPE:%.*]], ptr [[ACTOR_TYPE]], ptr [[DECODER_PROTOCOL_WITNESS:%.*]], ptr [[ACTOR_PROTOCOL_WITNESS:%.*]])
260+
// CHECK: define linkonce_odr hidden swift{{(tail)?}}cc void @"$s27distributed_actor_accessors7MyActorC7complexyAA11LargeStructVSaySiG_AA3ObjCSSSgAFtYaKFTETF"(ptr swiftasync {{.*}}, ptr [[ARG_DECODER:%.*]], ptr [[ARG_TYPES:%.*]], ptr [[RESULT_BUFF:%.*]], ptr [[SUBS:%.*]], ptr [[WITNESS_TABLES:%.*]], i64 [[NUM_WITNESS_TABLES:%.*]], ptr [[DECODER_TYPE:%.*]], ptr [[DECODER_PROTOCOL_WITNESS:%.*]])
261261

262262
/// First, let's check that all of the different argument types here are loaded correctly.
263263

@@ -304,7 +304,7 @@ public distributed actor MyOtherActor {
304304

305305
/// ---> Accessor for `genericArgs`
306306

307-
// CHECK: define linkonce_odr hidden swift{{(tail)?}}cc void @"$s27distributed_actor_accessors7MyActorC11genericArgsyyx_Sayq_GtYaKSeRzSERzSeR_SER_r0_lFTETF"(ptr swiftasync %0, ptr [[ARG_DECODER:%.*]], ptr [[ARG_TYPES:%.*]], ptr [[RESULT_BUF:%.*]], ptr [[GENERIC_SUBS:%.*]], ptr [[WITNESS_TABLES:%.*]], i64 [[NUM_WITNESS_TABLES:%.*]], ptr [[ACTOR:%.*]], ptr [[DECODER_TYPE:%.*]], ptr [[ACTOR_TYPE]], ptr [[DECODER_PROTOCOL_WITNESS:%.*]], ptr [[ACTOR_PROTOCOL_WITNESS:%.*]])
307+
// CHECK: define linkonce_odr hidden swift{{(tail)?}}cc void @"$s27distributed_actor_accessors7MyActorC11genericArgsyyx_Sayq_GtYaKSeRzSERzSeR_SER_r0_lFTETF"(ptr swiftasync %0, ptr [[ARG_DECODER:%.*]], ptr [[ARG_TYPES:%.*]], ptr [[RESULT_BUF:%.*]], ptr [[GENERIC_SUBS:%.*]], ptr [[WITNESS_TABLES:%.*]], i64 [[NUM_WITNESS_TABLES:%.*]], ptr [[ACTOR:%.*]], ptr [[DECODER_TYPE:%.*]], ptr [[DECODER_PROTOCOL_WITNESS:%.*]])
308308

309309
/// ---> Load `T`
310310

@@ -353,7 +353,7 @@ public distributed actor MyOtherActor {
353353

354354
/// Let's check that there is argument decoding since parameter list is empty
355355

356-
// CHECK: define linkonce_odr hidden swift{{(tail)?}}cc void @"$s27distributed_actor_accessors12MyOtherActorC5emptyyyYaKFTETF"(ptr swiftasync {{.*}}, ptr [[ARG_DECODER:%.*]], ptr [[ARG_TYPES:%.*]], ptr [[RESULT_BUFF:%.*]], ptr [[SUBS:%.*]], ptr [[WITNESS_TABLES:%.*]], i64 [[NUM_WITNESS_TABLES:%.*]], ptr {{.*}}, ptr [[DECODER_TYPE:%.*]], ptr [[DECODER_PROTOCOL_WITNESS:%.*]], ptr [[ACTOR_PROTOCOL_WITNESS:%.*]])
356+
// CHECK: define linkonce_odr hidden swift{{(tail)?}}cc void @"$s27distributed_actor_accessors12MyOtherActorC5emptyyyYaKFTETF"(ptr swiftasync {{.*}}, ptr [[ARG_DECODER:%.*]], ptr [[ARG_TYPES:%.*]], ptr [[RESULT_BUFF:%.*]], ptr [[SUBS:%.*]], ptr [[WITNESS_TABLES:%.*]], i64 [[NUM_WITNESS_TABLES:%.*]], ptr {{.*}}, ptr [[DECODER_TYPE:%.*]], ptr [[DECODER_PROTOCOL_WITNESS:%.*]])
357357
// CHECK-NEXT: entry:
358358
// CHECK-NEXT: {{.*}} = alloca ptr
359359
// CHECK-NEXT: %swifterror = alloca swifterror ptr

0 commit comments

Comments
 (0)