On Tue, 20 May 2025 16:10:07 GMT, Per Minborg <pminb...@openjdk.org> wrote:

>> This PR proposes to use  `JavaNioAccess::getBufferAdress` rather than 
>> `DirectBuffer::address` so that `Buffer` instances backed by MemorySegment 
>> instances can be used in classes that were not covered by 
>> https://github.com/openjdk/jdk/pull/25321
>> 
>> This PR passes tier1, tier2, and tier3 tests on multiple platforms and 
>> configurations.
>
> Per Minborg has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Update after comments

src/java.base/share/classes/com/sun/crypto/provider/GaloisCounterMode.java line 
952:

> 950:                 // through a byte[] to get to the combined intrinsic
> 951:                 if (NIO_ACCESS.getBufferAddress(src) - srcaddr + 
> src.position() >=
> 952:                         NIO_ACCESS.getBufferAddress(dst) - dstaddr + 
> dst.position()) {

Suggestion:

                if (NIO_ACCESS.getBufferAddress(src) - srcaddr + src.position() 
>=
                    NIO_ACCESS.getBufferAddress(dst) - dstaddr + 
dst.position()) {

Here you can use the same alignment style as before

src/java.base/share/classes/com/sun/crypto/provider/GaloisCounterMode.java line 
1607:

> 1605:                             Unsafe.getUnsafe().setMemory(
> 1606:                                     NIO_ACCESS.getBufferAddress(dst),
> 1607:                                 len + dst.position(), (byte) 0);

Suggestion:

                                NIO_ACCESS.getBufferAddress(dst),
                                len + dst.position(), (byte) 0);

Alignment

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25324#discussion_r2098987037
PR Review Comment: https://git.openjdk.org/jdk/pull/25324#discussion_r2098988459

Reply via email to