diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/debug/SubstrateDebugTypeEntrySupport.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/debug/SubstrateDebugTypeEntrySupport.java index de86af17f4fa..0e1f33a79178 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/debug/SubstrateDebugTypeEntrySupport.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/debug/SubstrateDebugTypeEntrySupport.java @@ -32,6 +32,7 @@ import org.graalvm.nativeimage.Platforms; import com.oracle.objectfile.debugentry.TypeEntry; +import com.oracle.svm.core.BuildPhaseProvider.AfterAnalysis; import com.oracle.svm.core.heap.UnknownObjectField; import jdk.graal.compiler.api.replacements.Fold; @@ -42,7 +43,7 @@ public class SubstrateDebugTypeEntrySupport { * debug info generation. We can't get ElementInfo at run-time, but we can reuse the type * entries produced during the native image build for run-time debug info generation. */ - @UnknownObjectField(fullyQualifiedTypes = {"java.util.HashMap", "java.util.ImmutableCollections$MapN", "java.util.ImmutableCollections$Map1"}) // + @UnknownObjectField(availability = AfterAnalysis.class, fullyQualifiedTypes = {"java.util.HashMap", "java.util.ImmutableCollections$MapN", "java.util.ImmutableCollections$Map1"}) // private Map typeEntryMap = new HashMap<>(); @Fold diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/heap/UnknownObjectField.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/heap/UnknownObjectField.java index 5da2dbbdb46e..ddd2c96da9fe 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/heap/UnknownObjectField.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/heap/UnknownObjectField.java @@ -33,8 +33,6 @@ import org.graalvm.nativeimage.Platform; import org.graalvm.nativeimage.Platforms; -import com.oracle.svm.core.BuildPhaseProvider.AfterAnalysis; - /** * For fields with this annotation no static analysis is done. * @@ -65,5 +63,5 @@ */ boolean canBeNull() default false; - Class availability() default AfterAnalysis.class; + Class availability(); } diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/heap/UnknownPrimitiveField.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/heap/UnknownPrimitiveField.java index bd24dfaa4126..14c8e61f6a61 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/heap/UnknownPrimitiveField.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/heap/UnknownPrimitiveField.java @@ -33,8 +33,6 @@ import org.graalvm.nativeimage.Platform; import org.graalvm.nativeimage.Platforms; -import com.oracle.svm.core.BuildPhaseProvider.AfterAnalysis; - /** * For fields with this annotation no static analysis is done. * @@ -46,5 +44,5 @@ @Target(ElementType.FIELD) @Platforms(Platform.HOSTED_ONLY.class) public @interface UnknownPrimitiveField { - Class availability() default AfterAnalysis.class; + Class availability(); } diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/DynamicHubCompanion.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/DynamicHubCompanion.java index e92b0cc63cbf..4e5313df18c6 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/DynamicHubCompanion.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/DynamicHubCompanion.java @@ -112,7 +112,7 @@ public final class DynamicHubCompanion { * Back link to the SubstrateType used by the substrate meta access. Only used for the subset of * types for which a SubstrateType exists. */ - @UnknownObjectField(fullyQualifiedTypes = "com.oracle.svm.graal.meta.SubstrateType", canBeNull = true) // + @UnknownObjectField(availability = BuildPhaseProvider.AfterAnalysis.class, fullyQualifiedTypes = "com.oracle.svm.graal.meta.SubstrateType", canBeNull = true) // @Stable SharedType metaType; /** diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/resources/CompressedGlobTrie/GlobTrieNode.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/resources/CompressedGlobTrie/GlobTrieNode.java index 0b555b60e6fc..f7767c4b2de2 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/resources/CompressedGlobTrie/GlobTrieNode.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/resources/CompressedGlobTrie/GlobTrieNode.java @@ -34,6 +34,7 @@ import org.graalvm.nativeimage.Platform; import org.graalvm.nativeimage.Platforms; +import com.oracle.svm.core.BuildPhaseProvider.AfterAnalysis; import com.oracle.svm.core.SubstrateUtil; import com.oracle.svm.core.heap.UnknownObjectField; import com.oracle.svm.core.heap.UnknownPrimitiveField; @@ -42,11 +43,11 @@ public class GlobTrieNode { private String content; - @UnknownObjectField(fullyQualifiedTypes = {"java.util.HashMap", "java.util.ImmutableCollections$MapN", "java.util.ImmutableCollections$Map1"}) // + @UnknownObjectField(availability = AfterAnalysis.class, fullyQualifiedTypes = {"java.util.HashMap", "java.util.ImmutableCollections$MapN", "java.util.ImmutableCollections$Map1"}) // private Map> children; - @UnknownPrimitiveField // + @UnknownPrimitiveField(availability = AfterAnalysis.class) // private boolean isLeaf; - @UnknownPrimitiveField // + @UnknownPrimitiveField(availability = AfterAnalysis.class) // private boolean isNewLevel; /* diff --git a/substratevm/src/com.oracle.svm.graal/src/com/oracle/svm/graal/TruffleRuntimeCompilationSupport.java b/substratevm/src/com.oracle.svm.graal/src/com/oracle/svm/graal/TruffleRuntimeCompilationSupport.java index 71503d59e7cb..6250997d0d8c 100644 --- a/substratevm/src/com.oracle.svm.graal/src/com/oracle/svm/graal/TruffleRuntimeCompilationSupport.java +++ b/substratevm/src/com.oracle.svm.graal/src/com/oracle/svm/graal/TruffleRuntimeCompilationSupport.java @@ -38,6 +38,7 @@ import org.graalvm.nativeimage.hosted.Feature.FeatureAccess; import com.oracle.graal.pointsto.meta.AnalysisUniverse; +import com.oracle.svm.core.BuildPhaseProvider.AfterAnalysis; import com.oracle.svm.core.config.ConfigurationValues; import com.oracle.svm.core.graal.code.SubstrateBackend; import com.oracle.svm.core.graal.code.SubstrateBackendFactory; @@ -97,11 +98,11 @@ public class TruffleRuntimeCompilationSupport { * not prematurely constant folded we must mark them as unknown fields. */ - @UnknownObjectField private SubstrateMethod[] methodsToCompile; - @UnknownObjectField private byte[] graphEncoding; - @UnknownObjectField private Object[] graphObjects; - @UnknownObjectField private NodeClassMap graphNodeTypes; - @UnknownPrimitiveField private int graphNodeTypesSize; + @UnknownObjectField(availability = AfterAnalysis.class) private SubstrateMethod[] methodsToCompile; + @UnknownObjectField(availability = AfterAnalysis.class) private byte[] graphEncoding; + @UnknownObjectField(availability = AfterAnalysis.class) private Object[] graphObjects; + @UnknownObjectField(availability = AfterAnalysis.class) private NodeClassMap graphNodeTypes; + @UnknownPrimitiveField(availability = AfterAnalysis.class) private int graphNodeTypesSize; protected Function runtimeBackendProvider; diff --git a/substratevm/src/com.oracle.svm.graal/src/com/oracle/svm/graal/meta/SubstrateField.java b/substratevm/src/com.oracle.svm.graal/src/com/oracle/svm/graal/meta/SubstrateField.java index 8df6916bc09f..e5cde4459a2f 100644 --- a/substratevm/src/com.oracle.svm.graal/src/com/oracle/svm/graal/meta/SubstrateField.java +++ b/substratevm/src/com.oracle.svm.graal/src/com/oracle/svm/graal/meta/SubstrateField.java @@ -34,6 +34,7 @@ import com.oracle.graal.pointsto.infrastructure.OriginalFieldProvider; import com.oracle.graal.pointsto.meta.AnalysisField; +import com.oracle.svm.core.BuildPhaseProvider.AfterAnalysis; import com.oracle.svm.core.BuildPhaseProvider.AfterCompilation; import com.oracle.svm.core.heap.UnknownObjectField; import com.oracle.svm.core.heap.UnknownPrimitiveField; @@ -52,8 +53,8 @@ public class SubstrateField implements SharedField { protected static final SubstrateField[] EMPTY_ARRAY = new SubstrateField[0]; - @UnknownObjectField SubstrateType type; - @UnknownObjectField SubstrateType declaringClass; + @UnknownObjectField(availability = AfterAnalysis.class) SubstrateType type; + @UnknownObjectField(availability = AfterAnalysis.class) SubstrateType declaringClass; private final String name; private final int modifiers; private int hashCode; diff --git a/substratevm/src/com.oracle.svm.graal/src/com/oracle/svm/graal/meta/SubstrateType.java b/substratevm/src/com.oracle.svm.graal/src/com/oracle/svm/graal/meta/SubstrateType.java index b2f7d8d39047..a6d59cf7001d 100644 --- a/substratevm/src/com.oracle.svm.graal/src/com/oracle/svm/graal/meta/SubstrateType.java +++ b/substratevm/src/com.oracle.svm.graal/src/com/oracle/svm/graal/meta/SubstrateType.java @@ -31,6 +31,7 @@ import org.graalvm.nativeimage.Platforms; import org.graalvm.word.WordBase; +import com.oracle.svm.core.BuildPhaseProvider.AfterAnalysis; import com.oracle.svm.core.config.ConfigurationValues; import com.oracle.svm.core.heap.UnknownObjectField; import com.oracle.svm.core.hub.DynamicHub; @@ -57,10 +58,10 @@ public class SubstrateType implements SharedType { * If it is not known if the type has an instance field (because the type metadata was created * at image runtime), it is null. */ - @UnknownObjectField(canBeNull = true)// + @UnknownObjectField(availability = AfterAnalysis.class, canBeNull = true)// SubstrateField[] rawAllInstanceFields; - @UnknownObjectField(canBeNull = true)// + @UnknownObjectField(availability = AfterAnalysis.class, canBeNull = true)// protected DynamicHub uniqueConcreteImplementation; public SubstrateType(JavaKind kind, DynamicHub hub) { diff --git a/substratevm/src/com.oracle.svm.interpreter.metadata/src/com/oracle/svm/interpreter/metadata/InterpreterConstantPool.java b/substratevm/src/com.oracle.svm.interpreter.metadata/src/com/oracle/svm/interpreter/metadata/InterpreterConstantPool.java index 0d7e7c4b6fd2..873b8567ccd8 100644 --- a/substratevm/src/com.oracle.svm.interpreter.metadata/src/com/oracle/svm/interpreter/metadata/InterpreterConstantPool.java +++ b/substratevm/src/com.oracle.svm.interpreter.metadata/src/com/oracle/svm/interpreter/metadata/InterpreterConstantPool.java @@ -31,6 +31,7 @@ import org.graalvm.nativeimage.Platform; import org.graalvm.nativeimage.Platforms; +import com.oracle.svm.core.BuildPhaseProvider.AfterAnalysis; import com.oracle.svm.core.heap.UnknownObjectField; import com.oracle.svm.core.util.VMError; import com.oracle.svm.espresso.classfile.ConstantPool; @@ -60,7 +61,7 @@ public class InterpreterConstantPool extends ConstantPool implements jdk.vm.ci.m final ParserConstantPool parserConstantPool; // Assigned after analysis. - @UnknownObjectField(types = Object[].class) protected Object[] cachedEntries; + @UnknownObjectField(availability = AfterAnalysis.class, types = Object[].class) protected Object[] cachedEntries; Object objAt(int cpi) { if (cpi == 0) {