|
24 | 24 | */
|
25 | 25 | package com.oracle.svm.hosted.classinitialization;
|
26 | 26 |
|
| 27 | +import java.lang.annotation.Annotation; |
27 | 28 | import java.util.Collection;
|
28 | 29 | import java.util.Collections;
|
29 | 30 | import java.util.HashMap;
|
|
36 | 37 | import com.oracle.graal.pointsto.meta.AnalysisMethod;
|
37 | 38 | import com.oracle.graal.pointsto.meta.AnalysisType;
|
38 | 39 | import com.oracle.graal.pointsto.meta.AnalysisUniverse;
|
| 40 | +import com.oracle.svm.core.annotate.Delete; |
| 41 | +import com.oracle.svm.core.annotate.Substitute; |
39 | 42 | import com.oracle.svm.core.classinitialization.EnsureClassInitializedNode;
|
40 | 43 | import com.oracle.svm.hosted.SVMHost;
|
41 | 44 | import com.oracle.svm.hosted.phases.SubstrateClassInitializationPlugin;
|
42 | 45 | import com.oracle.svm.hosted.substitute.SubstitutionMethod;
|
| 46 | +import com.oracle.svm.hosted.substitute.SubstitutionType; |
| 47 | +import jdk.vm.ci.meta.ResolvedJavaType; |
43 | 48 |
|
44 | 49 | /**
|
45 | 50 | * Keeps a type-hierarchy dependency graph for {@link AnalysisType}s from {@code universe}. Each
|
@@ -216,7 +221,18 @@ private boolean isInvokeUnsafeIterative(InvokeTypeFlow i) {
|
216 | 221 | }
|
217 | 222 |
|
218 | 223 | private void addInitializer(AnalysisType t) {
|
219 |
| - types.put(t, initialTypeInitializerSafety(t)); |
| 224 | + ResolvedJavaType rt = t.getWrappedWithoutResolve(); |
| 225 | + boolean isSubstituted = false; |
| 226 | + if (rt instanceof SubstitutionType) { |
| 227 | + SubstitutionType substitutionType = (SubstitutionType) rt; |
| 228 | + for (Annotation annotation : substitutionType.getAnnotations()) { |
| 229 | + if (annotation instanceof Substitute || annotation instanceof Delete) { |
| 230 | + isSubstituted = true; |
| 231 | + break; |
| 232 | + } |
| 233 | + } |
| 234 | + } |
| 235 | + types.put(t, isSubstituted ? Safety.UNSAFE :initialTypeInitializerSafety(t)); |
220 | 236 | dependencies.put(t, new HashSet<>());
|
221 | 237 | }
|
222 | 238 |
|
|
0 commit comments