@@ -69,32 +69,44 @@ llvm::Value *irgen::emitDistributedActorInitializeRemote(
69
69
namespace {
70
70
71
71
struct ArgumentDecoderInfo {
72
+ // / The instance of the decoder this information belongs to.
72
73
llvm::Value *Decoder;
73
74
75
+ // / The type of `decodeNextArgument` method.
74
76
CanSILFunctionType MethodType;
77
+
78
+ // / The pointer to `decodeNextArgument` method which
79
+ // / could be used to form a call to it.
75
80
FunctionPointer MethodPtr;
76
81
82
+ // / Protocol requirements associated with the generic
83
+ // / parameter `Argument` of this decode method.
84
+ GenericSignature::RequiredProtocols ProtocolRequirements;
85
+
77
86
ArgumentDecoderInfo (llvm::Value *decoder, CanSILFunctionType decodeMethodTy,
78
87
FunctionPointer decodePtr)
79
- : Decoder(decoder), MethodType(decodeMethodTy), MethodPtr(decodePtr) {}
88
+ : Decoder(decoder), MethodType(decodeMethodTy), MethodPtr(decodePtr),
89
+ ProtocolRequirements (findProtocolRequirements(decodeMethodTy)) {}
80
90
81
91
CanSILFunctionType getMethodType () const { return MethodType; }
82
92
83
- CanGenericSignature getGenericSignature () const {
84
- return MethodType-> getInvocationGenericSignature () ;
93
+ ArrayRef<ProtocolDecl *> getProtocolRequirements () const {
94
+ return ProtocolRequirements ;
85
95
}
86
96
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 ();
89
104
auto genericParams = signature.getGenericParams ();
90
105
91
- // func decodeNextArgument<Arg : < SerializationRequirement>() throws -> Arg
106
+ // func decodeNextArgument<Arg : # SerializationRequirement# >() throws -> Arg
92
107
assert (genericParams.size () == 1 );
93
108
return signature->getRequiredProtocols (genericParams.front ());
94
109
}
95
-
96
- // / Form a callee to a decode method - `decodeNextArgument`.
97
- Callee getCallee () const ;
98
110
};
99
111
100
112
class DistributedAccessor {
@@ -130,7 +142,7 @@ class DistributedAccessor {
130
142
Explosion &arguments);
131
143
132
144
void lookupWitnessTables (llvm::Value *value,
133
- GenericSignature::RequiredProtocols protocols,
145
+ ArrayRef<ProtocolDecl *> protocols,
134
146
Explosion &witnessTables);
135
147
136
148
// / Load witness table addresses (if any) from the given buffer
@@ -449,7 +461,7 @@ void DistributedAccessor::decodeArgument(unsigned argumentIdx,
449
461
}
450
462
451
463
void DistributedAccessor::lookupWitnessTables (
452
- llvm::Value *value, GenericSignature::RequiredProtocols protocols,
464
+ llvm::Value *value, ArrayRef<ProtocolDecl *> protocols,
453
465
Explosion &witnessTables) {
454
466
auto conformsToProtocol = IGM.getConformsToProtocolFn ();
455
467
0 commit comments