Skip to content

Commit 25d78ee

Browse files
committed
fixup: computedVTableIndex
1 parent 59c90b2 commit 25d78ee

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,13 @@ public final class HostedMethod extends HostedElement implements SharedMethod, W
9595
private final ConstantPool constantPool;
9696
private final ExceptionHandler[] handlers;
9797
/**
98-
* Contains the index of the method within the appropriate table.
98+
* Contains the index of the method computed by {@link VTableBuilder}.
9999
*
100100
* Within the closed type world, there exists a single table which describes all methods.
101101
* However, within the open type world, each type and interface has a unique table, so this
102102
* index is relative to the start of the appropriate table.
103103
*/
104-
int vtableIndex = MISSING_VTABLE_IDX;
104+
int computedVTableIndex = MISSING_VTABLE_IDX;
105105

106106
/**
107107
* When using the open type world we must differentiate between this method's vtable index and
@@ -404,12 +404,12 @@ void finalizeVTableIndex(boolean closedTypeWorld) {
404404
* In the closed type word we do not have a different indirectCallTarget, so the
405405
* vtableIndex is always the original vtable index.
406406
*/
407-
indirectCallVTableIndex = vtableIndex;
407+
indirectCallVTableIndex = computedVTableIndex;
408408
} else {
409409
/*
410410
* In the open type word we must use the vtable index from the indirect call target.
411411
*/
412-
indirectCallVTableIndex = indirectCallTarget.vtableIndex;
412+
indirectCallVTableIndex = indirectCallTarget.computedVTableIndex;
413413
}
414414
}
415415

@@ -676,7 +676,6 @@ public HostedMethod getOrCreateMultiMethod(MultiMethodKey key) {
676676
return (HostedMethod) multiMethodMap.computeIfAbsent(key, (k) -> {
677677
HostedMethod newMultiMethod = create0(wrapped, holder, signature, constantPool, handlers, k, multiMethodMap, localVariableTable);
678678
newMultiMethod.implementations = implementations;
679-
newMultiMethod.vtableIndex = vtableIndex;
680679
return newMultiMethod;
681680
});
682681
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,8 @@ private List<HostedMethod> generateDispatchTable(HostedType type, int startingIn
215215
int index = startingIndex;
216216
for (HostedMethod typeMethod : table) {
217217
assert typeMethod.getDeclaringClass().equals(type) : typeMethod;
218-
assert typeMethod.vtableIndex == HostedMethod.MISSING_VTABLE_IDX : typeMethod.vtableIndex;
219-
typeMethod.vtableIndex = index;
218+
assert typeMethod.computedVTableIndex == HostedMethod.MISSING_VTABLE_IDX : typeMethod.computedVTableIndex;
219+
typeMethod.computedVTableIndex = index;
220220
index++;
221221
}
222222

@@ -502,7 +502,7 @@ private void assignImplementations(HostedType type, Map<HostedType, ArrayList<Ho
502502
* assignments into account.
503503
*/
504504
int slot = findSlot(method, vtablesMap, usedSlotsMap, vtablesSlots);
505-
method.vtableIndex = slot;
505+
method.computedVTableIndex = slot;
506506

507507
/* Assign the vtable slot for the type and all subtypes. */
508508
assignImplementations(method.getDeclaringClass(), method, slot, vtablesMap);
@@ -529,7 +529,7 @@ private void assignImplementations(HostedType type, HostedMethod method, int slo
529529
assert vtable.get(slot) == null;
530530
vtable.set(slot, resolvedMethod);
531531
}
532-
resolvedMethod.vtableIndex = slot;
532+
resolvedMethod.computedVTableIndex = slot;
533533
}
534534
}
535535

0 commit comments

Comments
 (0)