42
42
import com .oracle .svm .core .SubstrateUtil ;
43
43
import com .oracle .svm .core .hub .RuntimeClassLoading ;
44
44
import com .oracle .svm .core .imagelayer .ImageLayerBuildingSupport ;
45
- import com .oracle .svm .hosted .OpenTypeWorldFeature ;
46
45
import com .oracle .svm .hosted .imagelayer .LayeredDispatchTableFeature ;
47
46
48
47
import jdk .graal .compiler .debug .Assertions ;
@@ -186,22 +185,6 @@ private List<HostedMethod> generateITable(HostedType type) {
186
185
return generateDispatchTable (type , List .of ());
187
186
}
188
187
189
- /**
190
- * Tries to find an existing parent slot with an identical signature. If successful, this
191
- * method's index can be assigned to the same slot and no new dispatch slot is needed.
192
- */
193
- private static boolean findAndLinkToParentSlot (HostedMethod hMethod , List <HostedMethod > parentSlots ) {
194
- for (int i = 0 ; i < parentSlots .size (); i ++) {
195
- HostedMethod candidate = parentSlots .get (i );
196
- if (OpenTypeWorldFeature .matchingSignature (hMethod , candidate )) {
197
- assert candidate .computedVTableIndex == i : candidate .computedVTableIndex ;
198
- installVTableIndex (hMethod , candidate .computedVTableIndex );
199
- return true ;
200
- }
201
- }
202
- return false ;
203
- }
204
-
205
188
private static void installVTableIndex (HostedMethod hMethod , int index ) {
206
189
assert hMethod .computedVTableIndex == HostedMethod .MISSING_VTABLE_IDX : hMethod .computedVTableIndex ;
207
190
hMethod .computedVTableIndex = index ;
@@ -213,10 +196,6 @@ private List<HostedMethod> generateDispatchTable(HostedType type, List<HostedMet
213
196
// include only methods which will be indirect calls
214
197
includeMethod = m -> {
215
198
assert !m .isConstructor () : Assertions .errorMessage ("Constructors should never be in dispatch tables" , m );
216
- if (findAndLinkToParentSlot (m , parentClassTable )) {
217
- // a prior slot has been found
218
- return false ;
219
- }
220
199
if (m .implementations .length > 1 ) {
221
200
return true ;
222
201
} else {
@@ -230,10 +209,6 @@ private List<HostedMethod> generateDispatchTable(HostedType type, List<HostedMet
230
209
} else {
231
210
includeMethod = m -> {
232
211
assert !m .isConstructor () : Assertions .errorMessage ("Constructors should never be in dispatch tables" , m );
233
- if (findAndLinkToParentSlot (m , parentClassTable )) {
234
- // a prior slot has been found
235
- return false ;
236
- }
237
212
/*
238
213
* We have to use the analysis method's canBeStaticallyBound implementation because
239
214
* within HostedMethod we sometimes do additional pruning when operating under the
@@ -293,7 +268,6 @@ private void generateOpenTypeWorldDispatchTable(HostedInstanceClass type, Map<Ho
293
268
type .openTypeWorldDispatchTableSlotTargets = aggregatedTable .toArray (HostedMethod []::new );
294
269
295
270
boolean [] validTarget = new boolean [aggregatedTable .size ()];
296
- Set <HostedMethod > seenResolvedMethods = SubstrateUtil .assertionsEnabled () ? new HashSet <>() : null ;
297
271
for (int i = 0 ; i < aggregatedTable .size (); i ++) {
298
272
HostedMethod method = aggregatedTable .get (i );
299
273
/*
@@ -306,13 +280,6 @@ private void generateOpenTypeWorldDispatchTable(HostedInstanceClass type, Map<Ho
306
280
if (resolvedMethod != null ) {
307
281
targetMethod = resolvedMethod ;
308
282
validTarget [i ] = true ;
309
- if (seenResolvedMethods != null && i < classTableMethods .size ()) {
310
- /*
311
- * Check that each resolved method within the class table is unique
312
- */
313
- var added = seenResolvedMethods .add (resolvedMethod );
314
- assert added : Assertions .errorMessage ("Multiple slots with same resolution method" , resolvedMethod );
315
- }
316
283
}
317
284
}
318
285
0 commit comments