Skip to content

Commit e4889ae

Browse files
committed
[GR-66724] Copy interface class displays from object parent type.
PullRequest: graal/21374
2 parents f90fb09 + 2a5d16a commit e4889ae

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/meta/AnalysisType.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ public TypeState getAssignableTypes(boolean includeNull) {
493493
}
494494

495495
public static boolean verifyAssignableTypes(BigBang bb) {
496-
List<AnalysisType> allTypes = bb.getUniverse().getTypes();
496+
List<AnalysisType> allTypes = bb.getUniverse().getTypes().stream().filter(t -> !(t.getWrapped() instanceof BaseLayerType)).toList();
497497

498498
Set<String> mismatchedAssignableResults = ConcurrentHashMap.newKeySet();
499499
allTypes.parallelStream().filter(t -> t.instantiatedTypes != null).forEach(t1 -> {

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

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,15 @@
3939
import java.util.concurrent.ConcurrentHashMap;
4040
import java.util.function.BiFunction;
4141

42+
import com.oracle.graal.pointsto.meta.BaseLayerType;
4243
import com.oracle.svm.core.SubstrateOptions;
4344
import com.oracle.svm.core.graal.snippets.OpenTypeWorldSnippets;
4445
import com.oracle.svm.core.hub.DynamicHubSupport;
4546
import com.oracle.svm.core.util.VMError;
4647
import com.oracle.svm.hosted.OpenTypeWorldFeature;
4748

4849
import jdk.graal.compiler.core.common.calc.UnsignedMath;
50+
import jdk.graal.compiler.debug.Assertions;
4951

5052
/**
5153
* This class assigns each type an id, determines stamp metadata, and generates the information
@@ -1894,10 +1896,16 @@ private void computeClassDisplay(int typeID) {
18941896

18951897
private void computeClassDisplay(int[] parent, int typeID) {
18961898
assert classDisplay == null;
1899+
assert Arrays.stream(parent).noneMatch(id -> id == typeID) : Assertions.errorMessage("Redundant entry in class display", Arrays.toString(parent), typeID);
18971900
classDisplay = new int[parent.length + 1];
18981901
System.arraycopy(parent, 0, classDisplay, 0, parent.length);
18991902
classDisplay[parent.length] = typeID;
19001903
}
1904+
1905+
private void copyClassDisplay(int[] display) {
1906+
assert classDisplay == null;
1907+
classDisplay = display;
1908+
}
19011909
}
19021910

19031911
public void calculateOpenTypeWorldTypeMetadata() {
@@ -1937,11 +1945,7 @@ public void calculateOpenTypeWorldTypeMetadata() {
19371945
dimension--;
19381946
displayType = objectType.getArrayClass(dimension);
19391947
}
1940-
if (displayType.getArrayDimension() == 0) {
1941-
info.computeClassDisplay(displayType.getTypeID());
1942-
} else {
1943-
info.computeClassDisplay(getTypeInfo.apply(displayType, false).classDisplay, displayType.getTypeID());
1944-
}
1948+
info.copyClassDisplay(getTypeInfo.apply(displayType, false).classDisplay);
19451949
}
19461950

19471951
if (isInterface(type)) {
@@ -1997,9 +2001,10 @@ static String printTypeInfo(HostedType type) {
19972001

19982002
static boolean compareTypeIDResults(List<HostedType> types) {
19992003
if (!SubstrateOptions.DisableTypeIdResultVerification.getValue()) {
2004+
List<HostedType> nonBaseLayerTypes = types.stream().filter(t -> !(t.getWrapped().getWrapped() instanceof BaseLayerType)).toList();
20002005
Set<String> mismatchedTypes = ConcurrentHashMap.newKeySet();
2001-
types.parallelStream().forEach(superType -> {
2002-
for (HostedType checkedType : types) {
2006+
nonBaseLayerTypes.parallelStream().forEach(superType -> {
2007+
for (HostedType checkedType : nonBaseLayerTypes) {
20032008
boolean hostedCheck = superType.isAssignableFrom(checkedType);
20042009
boolean runtimeCheck = runtimeIsAssignableFrom(superType, checkedType);
20052010
boolean checksMatch = hostedCheck == runtimeCheck;

0 commit comments

Comments
 (0)