RFR: 8341594: Use Unsafe to coalesce reads in java.util.zip.ZipUtils [v4]

Claes Redestad redestad at openjdk.org
Tue Oct 8 08:18:03 UTC 2024


On Tue, 8 Oct 2024 01:14:32 GMT, Chen Liang <liach at openjdk.org> wrote:

>> src/java.base/share/classes/java/util/zip/ZipUtils.java line 173:
>> 
>>> 171:      * The bytes are assumed to be in Intel (little-endian) byte order.
>>> 172:      */
>>> 173:     public static final int get16(byte[] b, int off) {
>> 
>> Can JIT automatically perform MergeStore here? If JIT can automatically perform MergeStore without using Unsafe, many scenarios will benefit.
>
> Unfortunately we only have merge store for writing to arrays; no merge load when we are reading from arrays.

Yes. As I wrote in the PR description: "An appealing alternative would be to implement a merge load analogue to the merge store optimizations in C2." So it's the opposite of a merge store. I recall @eme64 mentioning somewhere that such an optimization would be possible, if we could show it to be profitable. I think it's reasonable to do this enhancement now, then revert the `Unsafe` stuff if/when there's a merge load optimization that beats it.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/21377#discussion_r1791410504


More information about the core-libs-dev mailing list