|
39 | 39 | import java.util.concurrent.ConcurrentHashMap;
|
40 | 40 | import java.util.function.BiFunction;
|
41 | 41 |
|
| 42 | +import com.oracle.graal.pointsto.meta.BaseLayerType; |
42 | 43 | import com.oracle.svm.core.SubstrateOptions;
|
43 | 44 | import com.oracle.svm.core.graal.snippets.OpenTypeWorldSnippets;
|
44 | 45 | import com.oracle.svm.core.hub.DynamicHubSupport;
|
45 | 46 | import com.oracle.svm.core.util.VMError;
|
46 | 47 | import com.oracle.svm.hosted.OpenTypeWorldFeature;
|
47 | 48 |
|
48 | 49 | import jdk.graal.compiler.core.common.calc.UnsignedMath;
|
| 50 | +import jdk.graal.compiler.debug.Assertions; |
49 | 51 |
|
50 | 52 | /**
|
51 | 53 | * This class assigns each type an id, determines stamp metadata, and generates the information
|
@@ -1894,10 +1896,16 @@ private void computeClassDisplay(int typeID) {
|
1894 | 1896 |
|
1895 | 1897 | private void computeClassDisplay(int[] parent, int typeID) {
|
1896 | 1898 | assert classDisplay == null;
|
| 1899 | + assert Arrays.stream(parent).noneMatch(id -> id == typeID) : Assertions.errorMessage("Redundant entry in class display", Arrays.toString(parent), typeID); |
1897 | 1900 | classDisplay = new int[parent.length + 1];
|
1898 | 1901 | System.arraycopy(parent, 0, classDisplay, 0, parent.length);
|
1899 | 1902 | classDisplay[parent.length] = typeID;
|
1900 | 1903 | }
|
| 1904 | + |
| 1905 | + private void copyClassDisplay(int[] display) { |
| 1906 | + assert classDisplay == null; |
| 1907 | + classDisplay = display; |
| 1908 | + } |
1901 | 1909 | }
|
1902 | 1910 |
|
1903 | 1911 | public void calculateOpenTypeWorldTypeMetadata() {
|
@@ -1937,11 +1945,7 @@ public void calculateOpenTypeWorldTypeMetadata() {
|
1937 | 1945 | dimension--;
|
1938 | 1946 | displayType = objectType.getArrayClass(dimension);
|
1939 | 1947 | }
|
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); |
1945 | 1949 | }
|
1946 | 1950 |
|
1947 | 1951 | if (isInterface(type)) {
|
@@ -1997,9 +2001,10 @@ static String printTypeInfo(HostedType type) {
|
1997 | 2001 |
|
1998 | 2002 | static boolean compareTypeIDResults(List<HostedType> types) {
|
1999 | 2003 | if (!SubstrateOptions.DisableTypeIdResultVerification.getValue()) {
|
| 2004 | + List<HostedType> nonBaseLayerTypes = types.stream().filter(t -> !(t.getWrapped().getWrapped() instanceof BaseLayerType)).toList(); |
2000 | 2005 | 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) { |
2003 | 2008 | boolean hostedCheck = superType.isAssignableFrom(checkedType);
|
2004 | 2009 | boolean runtimeCheck = runtimeIsAssignableFrom(superType, checkedType);
|
2005 | 2010 | boolean checksMatch = hostedCheck == runtimeCheck;
|
|
0 commit comments