Skip to content

Commit 3ae5977

Browse files
committed
Rollback open world vtable slot deduplication optimization.
1 parent ee80875 commit 3ae5977

File tree

1 file changed

+0
-33
lines changed

1 file changed

+0
-33
lines changed

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/meta/VTableBuilder.java

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
import com.oracle.svm.core.SubstrateUtil;
4343
import com.oracle.svm.core.hub.RuntimeClassLoading;
4444
import com.oracle.svm.core.imagelayer.ImageLayerBuildingSupport;
45-
import com.oracle.svm.hosted.OpenTypeWorldFeature;
4645
import com.oracle.svm.hosted.imagelayer.LayeredDispatchTableFeature;
4746

4847
import jdk.graal.compiler.debug.Assertions;
@@ -186,22 +185,6 @@ private List<HostedMethod> generateITable(HostedType type) {
186185
return generateDispatchTable(type, List.of());
187186
}
188187

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-
205188
private static void installVTableIndex(HostedMethod hMethod, int index) {
206189
assert hMethod.computedVTableIndex == HostedMethod.MISSING_VTABLE_IDX : hMethod.computedVTableIndex;
207190
hMethod.computedVTableIndex = index;
@@ -213,10 +196,6 @@ private List<HostedMethod> generateDispatchTable(HostedType type, List<HostedMet
213196
// include only methods which will be indirect calls
214197
includeMethod = m -> {
215198
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-
}
220199
if (m.implementations.length > 1) {
221200
return true;
222201
} else {
@@ -230,10 +209,6 @@ private List<HostedMethod> generateDispatchTable(HostedType type, List<HostedMet
230209
} else {
231210
includeMethod = m -> {
232211
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-
}
237212
/*
238213
* We have to use the analysis method's canBeStaticallyBound implementation because
239214
* within HostedMethod we sometimes do additional pruning when operating under the
@@ -293,7 +268,6 @@ private void generateOpenTypeWorldDispatchTable(HostedInstanceClass type, Map<Ho
293268
type.openTypeWorldDispatchTableSlotTargets = aggregatedTable.toArray(HostedMethod[]::new);
294269

295270
boolean[] validTarget = new boolean[aggregatedTable.size()];
296-
Set<HostedMethod> seenResolvedMethods = SubstrateUtil.assertionsEnabled() ? new HashSet<>() : null;
297271
for (int i = 0; i < aggregatedTable.size(); i++) {
298272
HostedMethod method = aggregatedTable.get(i);
299273
/*
@@ -306,13 +280,6 @@ private void generateOpenTypeWorldDispatchTable(HostedInstanceClass type, Map<Ho
306280
if (resolvedMethod != null) {
307281
targetMethod = resolvedMethod;
308282
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-
}
316283
}
317284
}
318285

0 commit comments

Comments
 (0)