Skip to content

Commit f21824a

Browse files
committed
Load all possible annotation values
1 parent 19fae97 commit f21824a

File tree

6 files changed

+798
-452
lines changed

6 files changed

+798
-452
lines changed

substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/heap/ImageLayerLoader.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@
6868
import com.oracle.graal.pointsto.heap.SharedLayerSnapshotCapnProtoSchemaHolder.PersistedConstant;
6969
import com.oracle.graal.pointsto.heap.SharedLayerSnapshotCapnProtoSchemaHolder.PersistedConstant.Object.Relinking.EnumConstant;
7070
import com.oracle.graal.pointsto.heap.SharedLayerSnapshotCapnProtoSchemaHolder.PersistedConstant.Object.Relinking.StringConstant;
71+
import com.oracle.graal.pointsto.heap.SharedLayerSnapshotCapnProtoSchemaHolder.PrimitiveArray;
72+
import com.oracle.graal.pointsto.heap.SharedLayerSnapshotCapnProtoSchemaHolder.PrimitiveValue;
7173
import com.oracle.graal.pointsto.heap.SharedLayerSnapshotCapnProtoSchemaHolder.SharedLayerSnapshot;
7274
import com.oracle.graal.pointsto.heap.value.ValueSupplier;
7375
import com.oracle.graal.pointsto.infrastructure.ResolvedSignature;
@@ -952,7 +954,7 @@ protected void injectIdentityHashCode(Object object, Integer identityHashCode) {
952954
/* The hash code can only be injected in the SVM context. */
953955
}
954956

955-
private static Object getArray(PersistedConstant.PrimitiveData.Reader reader) {
957+
protected static Object getArray(PrimitiveArray.Reader reader) {
956958
return switch (reader.which()) {
957959
case Z -> getBooleans(reader.getZ());
958960
case B -> toArray(reader.getB(), r -> IntStream.range(0, r.size()).collect(() -> new byte[r.size()], (a, i) -> a[i] = r.get(i), combineUnsupported()));
@@ -1019,7 +1021,7 @@ private Object[] getReferencedValues(ImageHeapConstant parentConstant, StructLis
10191021
throw AnalysisError.shouldNotReachHere("This constant was not materialized in the base image.");
10201022
});
10211023
case PRIMITIVE_VALUE -> {
1022-
ConstantReference.PrimitiveValue.Reader pv = constantData.getPrimitiveValue();
1024+
PrimitiveValue.Reader pv = constantData.getPrimitiveValue();
10231025
yield JavaConstant.forPrimitive((char) pv.getTypeChar(), pv.getRawValue());
10241026
}
10251027
default -> throw GraalError.shouldNotReachHere("Unexpected constant reference: " + constantData.which());

substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/heap/ImageLayerWriter.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@
8181
import com.oracle.graal.pointsto.heap.SharedLayerSnapshotCapnProtoSchemaHolder.PersistedConstant;
8282
import com.oracle.graal.pointsto.heap.SharedLayerSnapshotCapnProtoSchemaHolder.PersistedConstant.Object.Relinking.EnumConstant;
8383
import com.oracle.graal.pointsto.heap.SharedLayerSnapshotCapnProtoSchemaHolder.PersistedConstant.Object.Relinking.StringConstant;
84+
import com.oracle.graal.pointsto.heap.SharedLayerSnapshotCapnProtoSchemaHolder.PrimitiveArray;
85+
import com.oracle.graal.pointsto.heap.SharedLayerSnapshotCapnProtoSchemaHolder.PrimitiveValue;
8486
import com.oracle.graal.pointsto.heap.SharedLayerSnapshotCapnProtoSchemaHolder.SharedLayerSnapshot;
8587
import com.oracle.graal.pointsto.infrastructure.OriginalFieldProvider;
8688
import com.oracle.graal.pointsto.meta.AnalysisField;
@@ -699,7 +701,7 @@ protected void persistConstantRelinkingInfo(PersistedConstant.Object.Relinking.B
699701
}
700702
}
701703

702-
private static void persistConstantPrimitiveArray(PersistedConstant.PrimitiveData.Builder builder, JavaKind componentKind, Object array) {
704+
protected static void persistConstantPrimitiveArray(PrimitiveArray.Builder builder, JavaKind componentKind, Object array) {
703705
assert componentKind.toJavaClass().equals(array.getClass().getComponentType());
704706
switch (array) {
705707
case boolean[] a -> persistArray(a, builder::initZ, (b, i) -> b.set(i, a[i]));
@@ -737,7 +739,7 @@ private void persistConstantObjectData(PersistedConstant.Object.Builder builder,
737739
} else if (object == JavaConstant.NULL_POINTER) {
738740
b.setNullPointer(Void.VOID);
739741
} else if (object instanceof PrimitiveConstant pc) {
740-
ConstantReference.PrimitiveValue.Builder pb = b.initPrimitiveValue();
742+
PrimitiveValue.Builder pb = b.initPrimitiveValue();
741743
pb.setTypeChar(NumUtil.safeToUByte(pc.getJavaKind().getTypeChar()));
742744
pb.setRawValue(pc.getRawValue());
743745
} else {

0 commit comments

Comments
 (0)