Re: RFR: 8343019: Primitive caches must use boxed instances from the archive [v5]

2024-10-31 Thread Aleksey Shipilev
On Thu, 31 Oct 2024 07:48:40 GMT, Aleksey Shipilev wrote: >> This is forked from >> [JDK-8342642](https://bugs.openjdk.org/browse/JDK-8342642) and filed as a >> general issue for archived boxed Integer cache when it's recreated at >> runtime. In short, current code drops the entire primitive c

Re: RFR: 8343019: Primitive caches must use boxed instances from the archive [v5]

2024-10-31 Thread Jiangli Zhou
On Thu, 31 Oct 2024 07:48:40 GMT, Aleksey Shipilev wrote: >> This is forked from >> [JDK-8342642](https://bugs.openjdk.org/browse/JDK-8342642) and filed as a >> general issue for archived boxed Integer cache when it's recreated at >> runtime. In short, current code drops the entire primitive c

Re: RFR: 8343019: Primitive caches must use boxed instances from the archive [v5]

2024-10-31 Thread Jiangli Zhou
On Thu, 31 Oct 2024 07:32:01 GMT, Aleksey Shipilev wrote: >> The runtime cache would only store the additional boxed Integers not in the >> archived cache, without affecting the archived boxed Integers. Something >> like the following would work (I didn't test all corner cases): >> >> >>

Re: RFR: 8343019: Primitive caches must use boxed instances from the archive [v4]

2024-10-31 Thread Aleksey Shipilev
On Wed, 30 Oct 2024 19:07:50 GMT, Jiangli Zhou wrote: >> I don't think I understand. The whole point is to make sure the runtime >> cache instances are the same as archive cache instances, right? Using both >> archived and runtime caches leads to identity inconsistencies: if we `==` >> compare

Re: RFR: 8343019: Primitive caches must use boxed instances from the archive [v4]

2024-10-31 Thread Aleksey Shipilev
On Wed, 30 Oct 2024 18:08:16 GMT, Ioi Lam wrote: >> Aleksey Shipilev has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Change InternalErrors to asserts > > src/java.base/share/classes/java/lang/Integer.java line 966: > >> 964:

Re: RFR: 8343019: Primitive caches must use boxed instances from the archive [v5]

2024-10-31 Thread Aleksey Shipilev
> This is forked from > [JDK-8342642](https://bugs.openjdk.org/browse/JDK-8342642) and filed as a > general issue for archived boxed Integer cache when it's recreated at > runtime. In short, current code drops the entire primitive cache when the CDS > archived version of the cache is too short.

Re: RFR: 8343019: Primitive caches must use boxed instances from the archive

2024-10-30 Thread Jiangli Zhou
On Tue, 29 Oct 2024 11:58:44 GMT, Aleksey Shipilev wrote: > Second problem is the behavior for boxed Integers outside [-128; 127] range. > JLS 5.1.7 has no provisions about the identity of these boxes: neither a > guarantee they would be cached, nor a guarantee that they would _not_ be > cache

Re: RFR: 8343019: Primitive caches must use boxed instances from the archive [v4]

2024-10-30 Thread Jiangli Zhou
On Tue, 29 Oct 2024 13:04:18 GMT, Aleksey Shipilev wrote: >> src/java.base/share/classes/java/lang/Integer.java line 964: >> >>> 962: Integer[] c = new Integer[size]; >>> 963: int j = low; >>> 964: // Use all cached values from the archive to avoid

Re: RFR: 8343019: Primitive caches must use boxed instances from the archive [v4]

2024-10-30 Thread Ioi Lam
On Wed, 30 Oct 2024 10:07:22 GMT, Aleksey Shipilev wrote: >> This is forked from >> [JDK-8342642](https://bugs.openjdk.org/browse/JDK-8342642) and filed as a >> general issue for archived boxed Integer cache when it's recreated at >> runtime. In short, current code drops the entire primitive c

Re: RFR: 8343019: Primitive caches must use boxed instances from the archive [v4]

2024-10-30 Thread Aleksey Shipilev
On Tue, 29 Oct 2024 12:55:32 GMT, Aleksey Shipilev wrote: >> src/java.base/share/classes/java/lang/Byte.java line 128: >> >>> 126: } >>> 127: archivedCache = c; >>> 128: } else if (archivedCache.length != size) { >> >> The `else` case for the non-int

Re: RFR: 8343019: Primitive caches must use boxed instances from the archive [v3]

2024-10-30 Thread Aleksey Shipilev
> This is forked from > [JDK-8342642](https://bugs.openjdk.org/browse/JDK-8342642) and filed as a > general issue for archived boxed Integer cache when it's recreated at > runtime. In short, current code drops the entire primitive cache when the CDS > archived version of the cache is too short.

Re: RFR: 8343019: Primitive caches must use boxed instances from the archive [v4]

2024-10-30 Thread Aleksey Shipilev
> This is forked from > [JDK-8342642](https://bugs.openjdk.org/browse/JDK-8342642) and filed as a > general issue for archived boxed Integer cache when it's recreated at > runtime. In short, current code drops the entire primitive cache when the CDS > archived version of the cache is too short.

Re: RFR: 8343019: Primitive caches must use boxed instances from the archive [v2]

2024-10-30 Thread Aleksey Shipilev
On Tue, 29 Oct 2024 13:12:56 GMT, Aleksey Shipilev wrote: >> This is forked from >> [JDK-8342642](https://bugs.openjdk.org/browse/JDK-8342642) and filed as a >> general issue for archived boxed Integer cache when it's recreated at >> runtime. In short, current code drops the entire primitive c

Re: RFR: 8343019: Primitive caches must use boxed instances from the archive [v2]

2024-10-29 Thread Vladimir Ivanov
On Tue, 29 Oct 2024 13:12:56 GMT, Aleksey Shipilev wrote: >> This is forked from >> [JDK-8342642](https://bugs.openjdk.org/browse/JDK-8342642) and filed as a >> general issue for archived boxed Integer cache when it's recreated at >> runtime. In short, current code drops the entire primitive c

Re: RFR: 8343019: Primitive caches must use boxed instances from the archive

2024-10-29 Thread Aleksey Shipilev
On Mon, 28 Oct 2024 22:54:34 GMT, Vladimir Ivanov wrote: >> This is forked from >> [JDK-8342642](https://bugs.openjdk.org/browse/JDK-8342642) and filed as a >> general issue for archived boxed Integer cache when it's recreated at >> runtime. In short, current code drops the entire primitive ca

Re: RFR: 8343019: Primitive caches must use boxed instances from the archive [v2]

2024-10-29 Thread Aleksey Shipilev
> This is forked from > [JDK-8342642](https://bugs.openjdk.org/browse/JDK-8342642) and filed as a > general issue for archived boxed Integer cache when it's recreated at > runtime. In short, current code drops the entire primitive cache when the CDS > archived version of the cache is too short.

Re: RFR: 8343019: Primitive caches must use boxed instances from the archive [v2]

2024-10-29 Thread Aleksey Shipilev
On Mon, 28 Oct 2024 22:36:44 GMT, Jiangli Zhou wrote: >> Aleksey Shipilev has updated the pull request with a new target base due to >> a merge or a rebase. The incremental webrev excludes the unrelated changes >> brought in by the merge/rebase. The pull request contains four additional >> com

Re: RFR: 8343019: Primitive caches must use boxed instances from the archive

2024-10-29 Thread Aleksey Shipilev
On Mon, 28 Oct 2024 22:28:34 GMT, Jiangli Zhou wrote: >> This is forked from >> [JDK-8342642](https://bugs.openjdk.org/browse/JDK-8342642) and filed as a >> general issue for archived boxed Integer cache when it's recreated at >> runtime. In short, current code drops the entire primitive cache

Re: RFR: 8343019: Primitive caches must use boxed instances from the archive

2024-10-29 Thread Aleksey Shipilev
On Mon, 28 Oct 2024 23:15:54 GMT, Vladimir Ivanov wrote: > I have mixed feelings about proposed fix. It does look like an improvement > over current behavior, but does it really address the root cause of the > problem? I think it does. It is important to separate two problems here: one of JLS

Re: RFR: 8343019: Primitive caches must use boxed instances from the archive

2024-10-28 Thread Jiangli Zhou
On Mon, 28 Oct 2024 23:15:54 GMT, Vladimir Ivanov wrote: > As an example, if `IntegerCache.high` is set to `1` during archiving, then > `ModuleLoaderMap.PLATFORM_LOADER_INDEX=1` ends up pointing to archived > instance and `ModuleLoaderMap.APP_LOADER_INDEX=2` points to non-archived > instance w

Re: RFR: 8343019: Primitive caches must use boxed instances from the archive

2024-10-28 Thread Vladimir Ivanov
On Mon, 28 Oct 2024 10:16:40 GMT, Aleksey Shipilev wrote: > This is forked from > [JDK-8342642](https://bugs.openjdk.org/browse/JDK-8342642) and filed as a > general issue for archived boxed Integer cache when it's recreated at > runtime. In short, current code drops the entire primitive cache

Re: RFR: 8343019: Primitive caches must use boxed instances from the archive

2024-10-28 Thread Vladimir Ivanov
On Mon, 28 Oct 2024 10:16:40 GMT, Aleksey Shipilev wrote: > This is forked from > [JDK-8342642](https://bugs.openjdk.org/browse/JDK-8342642) and filed as a > general issue for archived boxed Integer cache when it's recreated at > runtime. In short, current code drops the entire primitive cache

Re: RFR: 8343019: Primitive caches must use boxed instances from the archive

2024-10-28 Thread Jiangli Zhou
On Mon, 28 Oct 2024 10:16:40 GMT, Aleksey Shipilev wrote: > This is forked from > [JDK-8342642](https://bugs.openjdk.org/browse/JDK-8342642) and filed as a > general issue for archived boxed Integer cache when it's recreated at > runtime. In short, current code drops the entire primitive cache

Re: RFR: 8343019: Primitive caches must use boxed instances from the archive

2024-10-28 Thread Ioi Lam
On Mon, 28 Oct 2024 10:16:40 GMT, Aleksey Shipilev wrote: > This is forked from > [JDK-8342642](https://bugs.openjdk.org/browse/JDK-8342642) and filed as a > general issue for archived boxed Integer cache when it's recreated at > runtime. In short, current code drops the entire primitive cache