-
Notifications
You must be signed in to change notification settings - Fork 168
8383559: [lworld] Autobox cache removal causes performance regression with Renaissance benchmarks #2390
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8383559: [lworld] Autobox cache removal causes performance regression with Renaissance benchmarks #2390
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,6 +28,7 @@ | |
| import jdk.internal.misc.CDS; | ||
| import jdk.internal.misc.PreviewFeatures; | ||
| import jdk.internal.value.DeserializeConstructor; | ||
| import jdk.internal.value.ValueClass; | ||
| import jdk.internal.vm.annotation.AOTSafeClassInitializer; | ||
| import jdk.internal.vm.annotation.IntrinsicCandidate; | ||
| import jdk.internal.vm.annotation.Stable; | ||
|
|
@@ -123,25 +124,28 @@ private ByteCache() {} | |
| static Byte[] archivedCache; | ||
|
|
||
| static { | ||
| if (!PreviewFeatures.isEnabled()) { | ||
| final int size = -(-128) + 127 + 1; | ||
|
|
||
| // Load and use the archived cache if it exists | ||
| CDS.initializeFromArchive(ByteCache.class); | ||
| if (archivedCache == null) { | ||
| Byte[] c = new Byte[size]; | ||
| byte value = (byte)-128; | ||
| for(int i = 0; i < size; i++) { | ||
| c[i] = new Byte(value++); | ||
| } | ||
| archivedCache = c; | ||
| final int size = -(-128) + 127 + 1; | ||
|
|
||
| // Load and use the archived cache if it exists | ||
| CDS.initializeFromArchive(ByteCache.class); | ||
| if (archivedCache == null) { | ||
| Byte[] c = newCacheArray(size); | ||
| byte value = (byte)-128; | ||
| for(int i = 0; i < size; i++) { | ||
| c[i] = new Byte(value++); | ||
| } | ||
| cache = archivedCache; | ||
| assert cache.length == size; | ||
| } else { | ||
| cache = null; | ||
| assert archivedCache == null; | ||
| archivedCache = c; | ||
| } | ||
| cache = archivedCache; | ||
| assert cache.length == size; | ||
| } | ||
|
|
||
| private static Byte[] newCacheArray(int size) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we need this - we should be able to revert to mainline code. The only code I think that need any update would be the old
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
@liach That's not possible because |
||
| // ValueClass.newReferenceArray requires a value class component. | ||
| if (PreviewFeatures.isEnabled()) { | ||
| return (Byte[]) ValueClass.newReferenceArray(Byte.class, size); | ||
| } | ||
| return new Byte[size]; | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -171,13 +175,9 @@ private ByteCache() {} | |
| * @since 1.5 | ||
| */ | ||
| @IntrinsicCandidate | ||
| @DeserializeConstructor | ||
| public static Byte valueOf(byte b) { | ||
| if (!PreviewFeatures.isEnabled()) { | ||
| final int offset = 128; | ||
| return ByteCache.cache[(int) b + offset]; | ||
| } | ||
| return new Byte(b); | ||
| final int offset = 128; | ||
| return ByteCache.cache[(int) b + offset]; | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -378,6 +378,7 @@ public static Byte decode(String nm) throws NumberFormatException { | |
| * likely to yield significantly better space and time performance. | ||
| */ | ||
| @Deprecated(since="9") | ||
| @DeserializeConstructor | ||
| public Byte(byte value) { | ||
| this.value = value; | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.