Skip to content

Commit 23d32c0

Browse files
committed
Remove PersistedAnalysisType.isInitializedAtBuildTime. It is redundant.
1 parent 8b37cb6 commit 23d32c0

File tree

6 files changed

+47
-67
lines changed

6 files changed

+47
-67
lines changed

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

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ public class BaseLayerType extends BaseLayerElement implements ResolvedJavaType,
5656
private final boolean isInterface;
5757
private final boolean isEnum;
5858
private final boolean isInitialized;
59-
private final boolean isInitializedAtBuildTime;
6059
private final boolean isLinked;
6160
private final String sourceFileName;
6261
private final ResolvedJavaType enclosingType;
@@ -67,7 +66,7 @@ public class BaseLayerType extends BaseLayerElement implements ResolvedJavaType,
6766
private ResolvedJavaField[] instanceFields;
6867
private ResolvedJavaField[] instanceFieldsWithSuper;
6968

70-
public BaseLayerType(String name, int baseLayerId, int modifiers, boolean isInterface, boolean isEnum, boolean isInitialized, boolean initializedAtBuildTime, boolean isLinked,
69+
public BaseLayerType(String name, int baseLayerId, int modifiers, boolean isInterface, boolean isEnum, boolean isInitialized, boolean isLinked,
7170
String sourceFileName, ResolvedJavaType enclosingType, ResolvedJavaType componentType, ResolvedJavaType superClass, ResolvedJavaType[] interfaces, ResolvedJavaType objectType,
7271
Annotation[] annotations) {
7372
super(annotations);
@@ -77,7 +76,6 @@ public BaseLayerType(String name, int baseLayerId, int modifiers, boolean isInte
7776
this.isInterface = isInterface;
7877
this.isEnum = isEnum;
7978
this.isInitialized = isInitialized;
80-
this.isInitializedAtBuildTime = initializedAtBuildTime;
8179
this.isLinked = isLinked;
8280
this.sourceFileName = sourceFileName;
8381
this.enclosingType = enclosingType;
@@ -341,8 +339,4 @@ public ResolvedJavaType unwrapTowardsOriginalType() {
341339
public int getBaseLayerId() {
342340
return baseLayerId;
343341
}
344-
345-
public boolean initializedAtBuildTime() {
346-
return isInitializedAtBuildTime;
347-
}
348342
}

substratevm/src/com.oracle.svm.hosted/resources/SharedLayerSnapshotCapnProtoSchema.capnp

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -22,34 +22,33 @@ struct PersistedAnalysisType {
2222
isInterface @7 :Bool;
2323
isEnum @8 :Bool;
2424
isInitialized @9 :Bool;
25-
isInitializedAtBuildTime @10 :Bool;
26-
isLinked @11 :Bool;
27-
sourceFileName @12 :Text;
28-
enclosingTypeId @13 :TypeId;
29-
componentTypeId @14 :TypeId;
30-
superClassTypeId @15 :TypeId;
31-
isInstantiated @16 :Bool;
32-
isUnsafeAllocated @17 :Bool;
33-
isReachable @18 :Bool;
34-
interfaces @19 :List(TypeId);
35-
instanceFieldIds @20 :List(FieldId);
36-
instanceFieldIdsWithSuper @21 :List(FieldId);
37-
staticFieldIds @22 :List(FieldId);
38-
annotationList @23 :List(Annotation);
39-
classInitializationInfo @24 :ClassInitializationInfo;
40-
hasArrayType @25 :Bool;
41-
subTypes @26 :List(TypeId);
42-
isAnySubtypeInstantiated @27 :Bool;
25+
isLinked @10 :Bool;
26+
sourceFileName @11 :Text;
27+
enclosingTypeId @12 :TypeId;
28+
componentTypeId @13 :TypeId;
29+
superClassTypeId @14 :TypeId;
30+
isInstantiated @15 :Bool;
31+
isUnsafeAllocated @16 :Bool;
32+
isReachable @17 :Bool;
33+
interfaces @18 :List(TypeId);
34+
instanceFieldIds @19 :List(FieldId);
35+
instanceFieldIdsWithSuper @20 :List(FieldId);
36+
staticFieldIds @21 :List(FieldId);
37+
annotationList @22 :List(Annotation);
38+
classInitializationInfo @23 :ClassInitializationInfo;
39+
hasArrayType @24 :Bool;
40+
subTypes @25 :List(TypeId);
41+
isAnySubtypeInstantiated @26 :Bool;
4342
wrappedType :union {
44-
none @28 :Void; # default
43+
none @27 :Void; # default
4544
serializationGenerated :group {
46-
rawDeclaringClass @29 :Text;
47-
rawTargetConstructor @30 :Text;
45+
rawDeclaringClass @28 :Text;
46+
rawTargetConstructor @29 :Text;
4847
}
4948
lambda :group {
50-
capturingClass @31 :Text;
49+
capturingClass @30 :Text;
5150
}
52-
proxyType @32 :Void;
51+
proxyType @31 :Void;
5352
}
5453
}
5554

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/classinitialization/ClassInitializationSupport.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ Set<Class<?>> classesWithKind(InitKind kind) {
226226
*/
227227
public boolean maybeInitializeAtBuildTime(ResolvedJavaType type) {
228228
if (type instanceof AnalysisType analysisType && analysisType.getWrapped() instanceof BaseLayerType baseLayerType) {
229-
return baseLayerType.initializedAtBuildTime();
229+
return baseLayerType.isInitialized();
230230
}
231231
return maybeInitializeAtBuildTime(OriginalClassProvider.getJavaClass(type));
232232
}

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/imagelayer/SVMImageLayerLoader.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@
5454
import java.util.stream.Stream;
5555
import java.util.stream.StreamSupport;
5656

57-
import jdk.graal.compiler.api.replacements.SnippetReflectionProvider;
58-
import jdk.graal.compiler.nodes.NodeClassMap;
5957
import org.graalvm.nativeimage.AnnotationAccess;
6058
import org.graalvm.nativeimage.ImageSingletons;
6159
import org.graalvm.nativeimage.c.function.CEntryPoint;
@@ -132,6 +130,7 @@
132130
import com.oracle.svm.util.LogUtils;
133131
import com.oracle.svm.util.ReflectionUtil;
134132

133+
import jdk.graal.compiler.api.replacements.SnippetReflectionProvider;
135134
import jdk.graal.compiler.core.common.NumUtil;
136135
import jdk.graal.compiler.core.common.SuppressFBWarnings;
137136
import jdk.graal.compiler.debug.GraalError;
@@ -141,6 +140,7 @@
141140
import jdk.graal.compiler.java.BytecodeParser;
142141
import jdk.graal.compiler.nodes.ConstantNode;
143142
import jdk.graal.compiler.nodes.EncodedGraph;
143+
import jdk.graal.compiler.nodes.NodeClassMap;
144144
import jdk.graal.compiler.nodes.StructuredGraph;
145145
import jdk.graal.compiler.options.OptionValues;
146146
import jdk.graal.compiler.replacements.nodes.MethodHandleNode;
@@ -603,7 +603,7 @@ private BaseLayerType getBaseLayerType(PersistedAnalysisType.Reader td, int tid,
603603
ResolvedJavaType objectType = universe.getOriginalMetaAccess().lookupJavaType(Object.class);
604604
Annotation[] annotations = getAnnotations(td.getAnnotationList());
605605

606-
return new BaseLayerType(className, tid, td.getModifiers(), td.getIsInterface(), td.getIsEnum(), td.getIsInitialized(), td.getIsInitializedAtBuildTime(), td.getIsLinked(), sourceFileName,
606+
return new BaseLayerType(className, tid, td.getModifiers(), td.getIsInterface(), td.getIsEnum(), td.getIsInitialized(), td.getIsLinked(), sourceFileName,
607607
enclosingType, componentType, superClass, interfaces, objectType, annotations);
608608
});
609609
}

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/imagelayer/SVMImageLayerWriter.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,6 @@
6767
import java.util.stream.IntStream;
6868
import java.util.stream.Stream;
6969

70-
import jdk.graal.compiler.graph.NodeClass;
71-
import jdk.graal.compiler.nodes.GraphEncoder;
7270
import org.graalvm.collections.EconomicMap;
7371
import org.graalvm.collections.MapCursor;
7472
import org.graalvm.nativeimage.AnnotationAccess;
@@ -169,8 +167,10 @@
169167
import jdk.graal.compiler.core.common.NumUtil;
170168
import jdk.graal.compiler.debug.Assertions;
171169
import jdk.graal.compiler.debug.GraalError;
170+
import jdk.graal.compiler.graph.NodeClass;
172171
import jdk.graal.compiler.java.LambdaUtils;
173172
import jdk.graal.compiler.nodes.EncodedGraph;
173+
import jdk.graal.compiler.nodes.GraphEncoder;
174174
import jdk.graal.compiler.nodes.NodeClassMap;
175175
import jdk.graal.compiler.nodes.spi.IdentityHashCodeProvider;
176176
import jdk.graal.compiler.util.ObjectCopier;
@@ -433,8 +433,6 @@ private void persistType(AnalysisType type, Supplier<PersistedAnalysisType.Build
433433
builder.setHubIdentityHashCode(System.identityHashCode(hub));
434434
builder.setHasArrayType(hub.getArrayHub() != null);
435435

436-
builder.setIsInitializedAtBuildTime(ClassInitializationSupport.singleton().maybeInitializeAtBuildTime(type));
437-
438436
ClassInitializationInfo info = hub.getClassInitializationInfo();
439437
if (info != null) {
440438
Builder b = builder.initClassInitializationInfo();

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/imagelayer/SharedLayerSnapshotCapnProtoSchemaHolder.java

Lines changed: 18 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -168,18 +168,11 @@ public final void setIsInitialized(boolean value) {
168168
_setBooleanField(98, value);
169169
}
170170

171-
public final boolean getIsInitializedAtBuildTime() {
172-
return _getBooleanField(99);
173-
}
174-
public final void setIsInitializedAtBuildTime(boolean value) {
175-
_setBooleanField(99, value);
176-
}
177-
178171
public final boolean getIsLinked() {
179-
return _getBooleanField(100);
172+
return _getBooleanField(99);
180173
}
181174
public final void setIsLinked(boolean value) {
182-
_setBooleanField(100, value);
175+
_setBooleanField(99, value);
183176
}
184177

185178
public final boolean hasSourceFileName() {
@@ -219,24 +212,24 @@ public final void setSuperClassTypeId(int value) {
219212
}
220213

221214
public final boolean getIsInstantiated() {
222-
return _getBooleanField(101);
215+
return _getBooleanField(100);
223216
}
224217
public final void setIsInstantiated(boolean value) {
225-
_setBooleanField(101, value);
218+
_setBooleanField(100, value);
226219
}
227220

228221
public final boolean getIsUnsafeAllocated() {
229-
return _getBooleanField(102);
222+
return _getBooleanField(101);
230223
}
231224
public final void setIsUnsafeAllocated(boolean value) {
232-
_setBooleanField(102, value);
225+
_setBooleanField(101, value);
233226
}
234227

235228
public final boolean getIsReachable() {
236-
return _getBooleanField(103);
229+
return _getBooleanField(102);
237230
}
238231
public final void setIsReachable(boolean value) {
239-
_setBooleanField(103, value);
232+
_setBooleanField(102, value);
240233
}
241234

242235
public final boolean hasInterfaces() {
@@ -309,10 +302,10 @@ public final com.oracle.svm.hosted.imagelayer.SharedLayerSnapshotCapnProtoSchema
309302
return _initPointerField(com.oracle.svm.hosted.imagelayer.SharedLayerSnapshotCapnProtoSchemaHolder.ClassInitializationInfo.factory,10, 0);
310303
}
311304
public final boolean getHasArrayType() {
312-
return _getBooleanField(104);
305+
return _getBooleanField(103);
313306
}
314307
public final void setHasArrayType(boolean value) {
315-
_setBooleanField(104, value);
308+
_setBooleanField(103, value);
316309
}
317310

318311
public final boolean hasSubTypes() {
@@ -328,10 +321,10 @@ public final com.oracle.svm.shaded.org.capnproto.PrimitiveList.Int.Builder initS
328321
return _initPointerField(com.oracle.svm.shaded.org.capnproto.PrimitiveList.Int.factory, 11, size);
329322
}
330323
public final boolean getIsAnySubtypeInstantiated() {
331-
return _getBooleanField(105);
324+
return _getBooleanField(104);
332325
}
333326
public final void setIsAnySubtypeInstantiated(boolean value) {
334-
_setBooleanField(105, value);
327+
_setBooleanField(104, value);
335328
}
336329

337330
public final WrappedType.Builder getWrappedType() {
@@ -403,12 +396,8 @@ public final boolean getIsInitialized() {
403396
return _getBooleanField(98);
404397
}
405398

406-
public final boolean getIsInitializedAtBuildTime() {
407-
return _getBooleanField(99);
408-
}
409-
410399
public final boolean getIsLinked() {
411-
return _getBooleanField(100);
400+
return _getBooleanField(99);
412401
}
413402

414403
public boolean hasSourceFileName() {
@@ -431,15 +420,15 @@ public final int getSuperClassTypeId() {
431420
}
432421

433422
public final boolean getIsInstantiated() {
434-
return _getBooleanField(101);
423+
return _getBooleanField(100);
435424
}
436425

437426
public final boolean getIsUnsafeAllocated() {
438-
return _getBooleanField(102);
427+
return _getBooleanField(101);
439428
}
440429

441430
public final boolean getIsReachable() {
442-
return _getBooleanField(103);
431+
return _getBooleanField(102);
443432
}
444433

445434
public final boolean hasInterfaces() {
@@ -485,7 +474,7 @@ public com.oracle.svm.hosted.imagelayer.SharedLayerSnapshotCapnProtoSchemaHolder
485474
}
486475

487476
public final boolean getHasArrayType() {
488-
return _getBooleanField(104);
477+
return _getBooleanField(103);
489478
}
490479

491480
public final boolean hasSubTypes() {
@@ -496,7 +485,7 @@ public final com.oracle.svm.shaded.org.capnproto.PrimitiveList.Int.Reader getSub
496485
}
497486

498487
public final boolean getIsAnySubtypeInstantiated() {
499-
return _getBooleanField(105);
488+
return _getBooleanField(104);
500489
}
501490

502491
public WrappedType.Reader getWrappedType() {

0 commit comments

Comments
 (0)