Skip to content

Commit a91c407

Browse files
committed
Enable archivedCache for the box classes even when PreviewFeatures.isEnabled()==true
1 parent 88b9e2f commit a91c407

5 files changed

Lines changed: 13 additions & 25 deletions

File tree

src/java.base/share/classes/java/lang/Byte.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,7 @@ private ByteCache() {}
127127
final int size = -(-128) + 127 + 1;
128128

129129
// Load and use the archived cache if it exists
130-
if (!PreviewFeatures.isEnabled()) {
131-
CDS.initializeFromArchive(ByteCache.class);
132-
}
130+
CDS.initializeFromArchive(ByteCache.class);
133131
if (archivedCache == null) {
134132
Byte[] c = newCacheArray(size);
135133
byte value = (byte)-128;

src/java.base/share/classes/java/lang/Character.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9439,9 +9439,7 @@ private CharacterCache(){}
94399439
int size = 127 + 1;
94409440

94419441
// Load and use the archived cache if it exists
9442-
if (!PreviewFeatures.isEnabled()) {
9443-
CDS.initializeFromArchive(CharacterCache.class);
9444-
}
9442+
CDS.initializeFromArchive(CharacterCache.class);
94459443
if (archivedCache == null) {
94469444
Character[] c = newCacheArray(size);
94479445
for (int i = 0; i < size; i++) {

src/java.base/share/classes/java/lang/Integer.java

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -935,22 +935,18 @@ private static void runtimeSetup() {
935935
high = h;
936936

937937
Integer[] precomputed = null;
938-
if (!PreviewFeatures.isEnabled()) {
939-
if (cache != null) {
940-
// IntegerCache has been AOT-initialized.
941-
precomputed = cache;
942-
} else {
943-
// Legacy CDS archive support (to be deprecated):
944-
// Load IntegerCache.archivedCache from archive, if possible
945-
CDS.initializeFromArchive(IntegerCache.class);
946-
precomputed = archivedCache;
947-
}
938+
if (cache != null) {
939+
// IntegerCache has been AOT-initialized.
940+
precomputed = cache;
941+
} else {
942+
// Legacy CDS archive support (to be deprecated):
943+
// Load IntegerCache.archivedCache from archive, if possible
944+
CDS.initializeFromArchive(IntegerCache.class);
945+
precomputed = archivedCache;
948946
}
949947

950948
cache = loadOrInitializeCache(precomputed);
951-
if (!PreviewFeatures.isEnabled()) {
952-
archivedCache = cache; // Legacy CDS archive support (to be deprecated)
953-
}
949+
archivedCache = cache; // Legacy CDS archive support (to be deprecated)
954950
// range [-128, 127] must be interned (JLS7 5.1.7)
955951
assert IntegerCache.high >= 127;
956952
}

src/java.base/share/classes/java/lang/Long.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -937,9 +937,7 @@ private LongCache() {}
937937
int size = -(-128) + 127 + 1;
938938

939939
// Load and use the archived cache if it exists
940-
if (!PreviewFeatures.isEnabled()) {
941-
CDS.initializeFromArchive(LongCache.class);
942-
}
940+
CDS.initializeFromArchive(LongCache.class);
943941
if (archivedCache == null) {
944942
Long[] c = newCacheArray(size);
945943
long value = -128;

src/java.base/share/classes/java/lang/Short.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,9 +254,7 @@ private ShortCache() {}
254254
int size = -(-128) + 127 + 1;
255255

256256
// Load and use the archived cache if it exists
257-
if (!PreviewFeatures.isEnabled()) {
258-
CDS.initializeFromArchive(ShortCache.class);
259-
}
257+
CDS.initializeFromArchive(ShortCache.class);
260258
if (archivedCache == null) {
261259
Short[] c = newCacheArray(size);
262260
short value = -128;

0 commit comments

Comments
 (0)