Skip to content

Commit 88403fd

Browse files
[GR-68824] Remove the default availability for @UnknownObjectField and @UnknownPrimitiveField.
PullRequest: graal/21882
2 parents d9910dd + f943756 commit 88403fd

File tree

9 files changed

+23
-21
lines changed

9 files changed

+23
-21
lines changed

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/debug/SubstrateDebugTypeEntrySupport.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import org.graalvm.nativeimage.Platforms;
3333

3434
import com.oracle.objectfile.debugentry.TypeEntry;
35+
import com.oracle.svm.core.BuildPhaseProvider.AfterAnalysis;
3536
import com.oracle.svm.core.heap.UnknownObjectField;
3637

3738
import jdk.graal.compiler.api.replacements.Fold;
@@ -42,7 +43,7 @@ public class SubstrateDebugTypeEntrySupport {
4243
* debug info generation. We can't get ElementInfo at run-time, but we can reuse the type
4344
* entries produced during the native image build for run-time debug info generation.
4445
*/
45-
@UnknownObjectField(fullyQualifiedTypes = {"java.util.HashMap", "java.util.ImmutableCollections$MapN", "java.util.ImmutableCollections$Map1"}) //
46+
@UnknownObjectField(availability = AfterAnalysis.class, fullyQualifiedTypes = {"java.util.HashMap", "java.util.ImmutableCollections$MapN", "java.util.ImmutableCollections$Map1"}) //
4647
private Map<Long, TypeEntry> typeEntryMap = new HashMap<>();
4748

4849
@Fold

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/heap/UnknownObjectField.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@
3333
import org.graalvm.nativeimage.Platform;
3434
import org.graalvm.nativeimage.Platforms;
3535

36-
import com.oracle.svm.core.BuildPhaseProvider.AfterAnalysis;
37-
3836
/**
3937
* For fields with this annotation no static analysis is done.
4038
*
@@ -65,5 +63,5 @@
6563
*/
6664
boolean canBeNull() default false;
6765

68-
Class<? extends BooleanSupplier> availability() default AfterAnalysis.class;
66+
Class<? extends BooleanSupplier> availability();
6967
}

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/heap/UnknownPrimitiveField.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@
3333
import org.graalvm.nativeimage.Platform;
3434
import org.graalvm.nativeimage.Platforms;
3535

36-
import com.oracle.svm.core.BuildPhaseProvider.AfterAnalysis;
37-
3836
/**
3937
* For fields with this annotation no static analysis is done.
4038
*
@@ -46,5 +44,5 @@
4644
@Target(ElementType.FIELD)
4745
@Platforms(Platform.HOSTED_ONLY.class)
4846
public @interface UnknownPrimitiveField {
49-
Class<? extends BooleanSupplier> availability() default AfterAnalysis.class;
47+
Class<? extends BooleanSupplier> availability();
5048
}

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/DynamicHubCompanion.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public final class DynamicHubCompanion {
112112
* Back link to the SubstrateType used by the substrate meta access. Only used for the subset of
113113
* types for which a SubstrateType exists.
114114
*/
115-
@UnknownObjectField(fullyQualifiedTypes = "com.oracle.svm.graal.meta.SubstrateType", canBeNull = true) //
115+
@UnknownObjectField(availability = BuildPhaseProvider.AfterAnalysis.class, fullyQualifiedTypes = "com.oracle.svm.graal.meta.SubstrateType", canBeNull = true) //
116116
@Stable SharedType metaType;
117117

118118
/**

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/resources/CompressedGlobTrie/GlobTrieNode.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import org.graalvm.nativeimage.Platform;
3535
import org.graalvm.nativeimage.Platforms;
3636

37+
import com.oracle.svm.core.BuildPhaseProvider.AfterAnalysis;
3738
import com.oracle.svm.core.SubstrateUtil;
3839
import com.oracle.svm.core.heap.UnknownObjectField;
3940
import com.oracle.svm.core.heap.UnknownPrimitiveField;
@@ -42,11 +43,11 @@
4243
public class GlobTrieNode<C> {
4344

4445
private String content;
45-
@UnknownObjectField(fullyQualifiedTypes = {"java.util.HashMap", "java.util.ImmutableCollections$MapN", "java.util.ImmutableCollections$Map1"}) //
46+
@UnknownObjectField(availability = AfterAnalysis.class, fullyQualifiedTypes = {"java.util.HashMap", "java.util.ImmutableCollections$MapN", "java.util.ImmutableCollections$Map1"}) //
4647
private Map<String, GlobTrieNode<C>> children;
47-
@UnknownPrimitiveField //
48+
@UnknownPrimitiveField(availability = AfterAnalysis.class) //
4849
private boolean isLeaf;
49-
@UnknownPrimitiveField //
50+
@UnknownPrimitiveField(availability = AfterAnalysis.class) //
5051
private boolean isNewLevel;
5152

5253
/*

substratevm/src/com.oracle.svm.graal/src/com/oracle/svm/graal/TruffleRuntimeCompilationSupport.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import org.graalvm.nativeimage.hosted.Feature.FeatureAccess;
3939

4040
import com.oracle.graal.pointsto.meta.AnalysisUniverse;
41+
import com.oracle.svm.core.BuildPhaseProvider.AfterAnalysis;
4142
import com.oracle.svm.core.config.ConfigurationValues;
4243
import com.oracle.svm.core.graal.code.SubstrateBackend;
4344
import com.oracle.svm.core.graal.code.SubstrateBackendFactory;
@@ -97,11 +98,11 @@ public class TruffleRuntimeCompilationSupport {
9798
* not prematurely constant folded we must mark them as unknown fields.
9899
*/
99100

100-
@UnknownObjectField private SubstrateMethod[] methodsToCompile;
101-
@UnknownObjectField private byte[] graphEncoding;
102-
@UnknownObjectField private Object[] graphObjects;
103-
@UnknownObjectField private NodeClassMap graphNodeTypes;
104-
@UnknownPrimitiveField private int graphNodeTypesSize;
101+
@UnknownObjectField(availability = AfterAnalysis.class) private SubstrateMethod[] methodsToCompile;
102+
@UnknownObjectField(availability = AfterAnalysis.class) private byte[] graphEncoding;
103+
@UnknownObjectField(availability = AfterAnalysis.class) private Object[] graphObjects;
104+
@UnknownObjectField(availability = AfterAnalysis.class) private NodeClassMap graphNodeTypes;
105+
@UnknownPrimitiveField(availability = AfterAnalysis.class) private int graphNodeTypesSize;
105106

106107
protected Function<Providers, SubstrateBackend> runtimeBackendProvider;
107108

substratevm/src/com.oracle.svm.graal/src/com/oracle/svm/graal/meta/SubstrateField.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434

3535
import com.oracle.graal.pointsto.infrastructure.OriginalFieldProvider;
3636
import com.oracle.graal.pointsto.meta.AnalysisField;
37+
import com.oracle.svm.core.BuildPhaseProvider.AfterAnalysis;
3738
import com.oracle.svm.core.BuildPhaseProvider.AfterCompilation;
3839
import com.oracle.svm.core.heap.UnknownObjectField;
3940
import com.oracle.svm.core.heap.UnknownPrimitiveField;
@@ -52,8 +53,8 @@ public class SubstrateField implements SharedField {
5253

5354
protected static final SubstrateField[] EMPTY_ARRAY = new SubstrateField[0];
5455

55-
@UnknownObjectField SubstrateType type;
56-
@UnknownObjectField SubstrateType declaringClass;
56+
@UnknownObjectField(availability = AfterAnalysis.class) SubstrateType type;
57+
@UnknownObjectField(availability = AfterAnalysis.class) SubstrateType declaringClass;
5758
private final String name;
5859
private final int modifiers;
5960
private int hashCode;

substratevm/src/com.oracle.svm.graal/src/com/oracle/svm/graal/meta/SubstrateType.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import org.graalvm.nativeimage.Platforms;
3232
import org.graalvm.word.WordBase;
3333

34+
import com.oracle.svm.core.BuildPhaseProvider.AfterAnalysis;
3435
import com.oracle.svm.core.config.ConfigurationValues;
3536
import com.oracle.svm.core.heap.UnknownObjectField;
3637
import com.oracle.svm.core.hub.DynamicHub;
@@ -57,10 +58,10 @@ public class SubstrateType implements SharedType {
5758
* If it is not known if the type has an instance field (because the type metadata was created
5859
* at image runtime), it is null.
5960
*/
60-
@UnknownObjectField(canBeNull = true)//
61+
@UnknownObjectField(availability = AfterAnalysis.class, canBeNull = true)//
6162
SubstrateField[] rawAllInstanceFields;
6263

63-
@UnknownObjectField(canBeNull = true)//
64+
@UnknownObjectField(availability = AfterAnalysis.class, canBeNull = true)//
6465
protected DynamicHub uniqueConcreteImplementation;
6566

6667
public SubstrateType(JavaKind kind, DynamicHub hub) {

substratevm/src/com.oracle.svm.interpreter.metadata/src/com/oracle/svm/interpreter/metadata/InterpreterConstantPool.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import org.graalvm.nativeimage.Platform;
3232
import org.graalvm.nativeimage.Platforms;
3333

34+
import com.oracle.svm.core.BuildPhaseProvider.AfterAnalysis;
3435
import com.oracle.svm.core.heap.UnknownObjectField;
3536
import com.oracle.svm.core.util.VMError;
3637
import com.oracle.svm.espresso.classfile.ConstantPool;
@@ -60,7 +61,7 @@ public class InterpreterConstantPool extends ConstantPool implements jdk.vm.ci.m
6061
final ParserConstantPool parserConstantPool;
6162

6263
// Assigned after analysis.
63-
@UnknownObjectField(types = Object[].class) protected Object[] cachedEntries;
64+
@UnknownObjectField(availability = AfterAnalysis.class, types = Object[].class) protected Object[] cachedEntries;
6465

6566
Object objAt(int cpi) {
6667
if (cpi == 0) {

0 commit comments

Comments
 (0)