@@ -100,7 +100,7 @@ class PolymorphicConvention {
100
100
101
101
FulfillmentMap Fulfillments;
102
102
103
- bool ForPartialApplyForwarder ;
103
+ bool ConsiderParameterSources ;
104
104
105
105
GenericSignature::ConformsToArray getConformsTo (Type t) {
106
106
return Generics->getConformsTo (t);
@@ -113,7 +113,7 @@ class PolymorphicConvention {
113
113
}
114
114
115
115
public:
116
- PolymorphicConvention (IRGenModule &IGM, CanSILFunctionType fnType, bool forPartialApplyForwarder );
116
+ PolymorphicConvention (IRGenModule &IGM, CanSILFunctionType fnType, bool considerParameterSources );
117
117
118
118
ArrayRef<MetadataSource> getSources () const { return Sources; }
119
119
@@ -181,9 +181,9 @@ class PolymorphicConvention {
181
181
182
182
PolymorphicConvention::PolymorphicConvention (IRGenModule &IGM,
183
183
CanSILFunctionType fnType,
184
- bool forPartialApplyForwarder = false )
184
+ bool considerParameterSources = true )
185
185
: IGM(IGM), M(*IGM.getSwiftModule()), FnType(fnType),
186
- ForPartialApplyForwarder(forPartialApplyForwarder ) {
186
+ ConsiderParameterSources(considerParameterSources ) {
187
187
initGenerics ();
188
188
189
189
auto rep = fnType->getRepresentation ();
@@ -221,10 +221,12 @@ PolymorphicConvention::PolymorphicConvention(IRGenModule &IGM,
221
221
considerParameter (params[selfIndex], selfIndex, true );
222
222
}
223
223
224
- // Now consider the rest of the parameters.
225
- for (auto index : indices (params)) {
226
- if (index != selfIndex)
227
- considerParameter (params[index], index, false );
224
+ if (ConsiderParameterSources) {
225
+ // Now consider the rest of the parameters.
226
+ for (auto index : indices (params)) {
227
+ if (index != selfIndex)
228
+ considerParameter (params[index], index, false );
229
+ }
228
230
}
229
231
}
230
232
}
@@ -388,10 +390,10 @@ void PolymorphicConvention::considerParameter(SILParameterInfo param,
388
390
case ParameterConvention::Direct_Owned:
389
391
case ParameterConvention::Direct_Unowned:
390
392
case ParameterConvention::Direct_Guaranteed:
391
- // Don't consider ClassPointer source for partial_apply forwader.
393
+ // Don't consider ClassPointer source and Metadata source for partial_apply forwader with non fixed layout .
392
394
// If not, we may end up with missing TypeMetadata for a type dependent generic parameter
393
395
// while generating code for destructor of HeapLayout.
394
- if (ForPartialApplyForwarder ) return ;
396
+ if (!ConsiderParameterSources ) return ;
395
397
// Classes are sources of metadata.
396
398
if (type->getClassOrBoundGenericClass ()) {
397
399
considerNewTypeSource (MetadataSource::Kind::ClassPointer,
@@ -2991,14 +2993,16 @@ NecessaryBindings::forFunctionInvocations(IRGenModule &IGM,
2991
2993
NecessaryBindings
2992
2994
NecessaryBindings::forPartialApplyForwarder (IRGenModule &IGM,
2993
2995
CanSILFunctionType origType,
2994
- SubstitutionMap subs) {
2996
+ SubstitutionMap subs,
2997
+ bool considerParameterSources) {
2995
2998
return computeBindings (IGM, origType, subs,
2996
- true /* forPartialApplyForwarder*/ );
2999
+ true /* forPartialApplyForwarder*/ ,
3000
+ considerParameterSources);
2997
3001
}
2998
3002
2999
3003
NecessaryBindings NecessaryBindings::computeBindings (
3000
3004
IRGenModule &IGM, CanSILFunctionType origType, SubstitutionMap subs,
3001
- bool forPartialApplyForwarder) {
3005
+ bool forPartialApplyForwarder, bool considerParameterSources ) {
3002
3006
3003
3007
NecessaryBindings bindings;
3004
3008
bindings.forPartialApply = forPartialApplyForwarder;
@@ -3008,7 +3012,7 @@ NecessaryBindings NecessaryBindings::computeBindings(
3008
3012
return bindings;
3009
3013
3010
3014
// Figure out what we're actually required to pass:
3011
- PolymorphicConvention convention (IGM, origType, forPartialApplyForwarder );
3015
+ PolymorphicConvention convention (IGM, origType, considerParameterSources );
3012
3016
3013
3017
// - unfulfilled requirements
3014
3018
convention.enumerateUnfulfilledRequirements (
0 commit comments