@@ -69,32 +69,44 @@ llvm::Value *irgen::emitDistributedActorInitializeRemote(
6969namespace {
7070
7171struct ArgumentDecoderInfo {
72+ // / The instance of the decoder this information belongs to.
7273 llvm::Value *Decoder;
7374
75+ // / The type of `decodeNextArgument` method.
7476 CanSILFunctionType MethodType;
77+
78+ // / The pointer to `decodeNextArgument` method which
79+ // / could be used to form a call to it.
7580 FunctionPointer MethodPtr;
7681
82+ // / Protocol requirements associated with the generic
83+ // / parameter `Argument` of this decode method.
84+ GenericSignature::RequiredProtocols ProtocolRequirements;
85+
7786 ArgumentDecoderInfo (llvm::Value *decoder, CanSILFunctionType decodeMethodTy,
7887 FunctionPointer decodePtr)
79- : Decoder(decoder), MethodType(decodeMethodTy), MethodPtr(decodePtr) {}
88+ : Decoder(decoder), MethodType(decodeMethodTy), MethodPtr(decodePtr),
89+ ProtocolRequirements (findProtocolRequirements(decodeMethodTy)) {}
8090
8191 CanSILFunctionType getMethodType () const { return MethodType; }
8292
83- CanGenericSignature getGenericSignature () const {
84- return MethodType-> getInvocationGenericSignature () ;
93+ ArrayRef<ProtocolDecl *> getProtocolRequirements () const {
94+ return ProtocolRequirements ;
8595 }
8696
87- GenericSignature::RequiredProtocols getProtocolRequirements () const {
88- auto signature = getGenericSignature ();
97+ // / Form a callee to a decode method - `decodeNextArgument`.
98+ Callee getCallee () const ;
99+
100+ private:
101+ static GenericSignature::RequiredProtocols
102+ findProtocolRequirements (CanSILFunctionType decodeMethodTy) {
103+ auto signature = decodeMethodTy->getInvocationGenericSignature ();
89104 auto genericParams = signature.getGenericParams ();
90105
91- // func decodeNextArgument<Arg : < SerializationRequirement>() throws -> Arg
106+ // func decodeNextArgument<Arg : # SerializationRequirement# >() throws -> Arg
92107 assert (genericParams.size () == 1 );
93108 return signature->getRequiredProtocols (genericParams.front ());
94109 }
95-
96- // / Form a callee to a decode method - `decodeNextArgument`.
97- Callee getCallee () const ;
98110};
99111
100112class DistributedAccessor {
@@ -130,7 +142,7 @@ class DistributedAccessor {
130142 Explosion &arguments);
131143
132144 void lookupWitnessTables (llvm::Value *value,
133- GenericSignature::RequiredProtocols protocols,
145+ ArrayRef<ProtocolDecl *> protocols,
134146 Explosion &witnessTables);
135147
136148 // / Load witness table addresses (if any) from the given buffer
@@ -449,7 +461,7 @@ void DistributedAccessor::decodeArgument(unsigned argumentIdx,
449461}
450462
451463void DistributedAccessor::lookupWitnessTables (
452- llvm::Value *value, GenericSignature::RequiredProtocols protocols,
464+ llvm::Value *value, ArrayRef<ProtocolDecl *> protocols,
453465 Explosion &witnessTables) {
454466 auto conformsToProtocol = IGM.getConformsToProtocolFn ();
455467
0 commit comments