@@ -106,10 +106,7 @@ private struct VTableSpecializer {
106
106
}
107
107
108
108
/// Specializes a witness table of `conformance` for the concrete type of the conformance.
109
- func specializeWitnessTable( for conformance: Conformance ,
110
- _ context: ModulePassContext ,
111
- _ notifyNewWitnessTable: ( WitnessTable ) -> ( ) )
112
- {
109
+ func specializeWitnessTable( for conformance: Conformance , _ context: ModulePassContext ) {
113
110
if let existingSpecialization = context. lookupWitnessTable ( for: conformance) ,
114
111
existingSpecialization. isSpecialized
115
112
{
@@ -125,7 +122,7 @@ func specializeWitnessTable(for conformance: Conformance,
125
122
let baseConf = conformance. isInherited ? conformance. inheritedConformance: conformance
126
123
if !baseConf. isSpecialized {
127
124
var visited = Set < Conformance > ( )
128
- specializeDefaultMethods ( for: conformance, visited: & visited, context, notifyNewWitnessTable )
125
+ specializeDefaultMethods ( for: conformance, visited: & visited, context)
129
126
return
130
127
}
131
128
@@ -158,7 +155,7 @@ func specializeWitnessTable(for conformance: Conformance,
158
155
let baseConf = context. getSpecializedConformance ( of: witness,
159
156
for: conformance. type,
160
157
substitutions: conformance. specializedSubstitutions)
161
- specializeWitnessTable ( for: baseConf, context, notifyNewWitnessTable )
158
+ specializeWitnessTable ( for: baseConf, context)
162
159
return . baseProtocol( requirement: requirement, witness: baseConf)
163
160
case . associatedType( let requirement, let witness) :
164
161
let substType = witness. subst ( with: conformance. specializedSubstitutions)
@@ -169,15 +166,14 @@ func specializeWitnessTable(for conformance: Conformance,
169
166
let concreteAssociateConf = conformance. getAssociatedConformance ( ofAssociatedType: requirement. rawType,
170
167
to: assocConf. protocol)
171
168
if concreteAssociateConf. isSpecialized {
172
- specializeWitnessTable ( for: concreteAssociateConf, context, notifyNewWitnessTable )
169
+ specializeWitnessTable ( for: concreteAssociateConf, context)
173
170
}
174
171
return . associatedConformance( requirement: requirement,
175
172
witness: concreteAssociateConf)
176
173
}
177
174
}
178
- let newWT = context. createSpecializedWitnessTable ( entries: newEntries, conformance: conformance,
179
- linkage: . shared, serialized: false )
180
- notifyNewWitnessTable ( newWT)
175
+ context. createSpecializedWitnessTable ( entries: newEntries, conformance: conformance,
176
+ linkage: . shared, serialized: false )
181
177
}
182
178
183
179
/// Specializes the default methods of a non-generic witness table.
@@ -186,8 +182,7 @@ func specializeWitnessTable(for conformance: Conformance,
186
182
/// specialize inherited conformances so that the concrete self type is correct, even for derived classes.
187
183
private func specializeDefaultMethods( for conformance: Conformance ,
188
184
visited: inout Set < Conformance > ,
189
- _ context: ModulePassContext ,
190
- _ notifyNewWitnessTable: ( WitnessTable ) -> ( ) )
185
+ _ context: ModulePassContext )
191
186
{
192
187
// Avoid infinite recursion, which may happen if an associated conformance is the conformance itself.
193
188
guard visited. insert ( conformance) . inserted,
@@ -224,21 +219,20 @@ private func specializeDefaultMethods(for conformance: Conformance,
224
219
specialized = true
225
220
return . method( requirement: requirement, witness: specializedMethod)
226
221
case . baseProtocol( _, let witness) :
227
- specializeDefaultMethods ( for: witness, visited: & visited, context, notifyNewWitnessTable )
222
+ specializeDefaultMethods ( for: witness, visited: & visited, context)
228
223
return origEntry
229
224
case . associatedType:
230
225
return origEntry
231
226
case . associatedConformance( _, let assocConf) :
232
- specializeDefaultMethods ( for: assocConf, visited: & visited, context, notifyNewWitnessTable )
227
+ specializeDefaultMethods ( for: assocConf, visited: & visited, context)
233
228
return origEntry
234
229
}
235
230
}
236
231
// If the witness table does not contain any default methods, there is no need to create a
237
232
// specialized witness table.
238
233
if specialized {
239
- let newWT = context. createSpecializedWitnessTable ( entries: newEntries, conformance: conformance,
240
- linkage: . shared, serialized: false )
241
- notifyNewWitnessTable ( newWT)
234
+ context. createSpecializedWitnessTable ( entries: newEntries, conformance: conformance,
235
+ linkage: . shared, serialized: false )
242
236
}
243
237
}
244
238
0 commit comments