On Tue, 3 Sep 2024 15:44:34 GMT, Maurizio Cimadamore <mcimadam...@openjdk.org> 
wrote:

>> src/java.base/share/classes/jdk/internal/foreign/AbstractMemorySegmentImpl.java
>>  line 642:
>> 
>>> 640:             // 0...0X00
>>> 641:             if (remaining >= 4) {
>>> 642:                 final int v = 
>>> SCOPED_MEMORY_ACCESS.getInt(src.sessionImpl(), 
>>> src.unsafeGetBase(),src.unsafeGetOffset() + srcOffset + offset);
>> 
>> src.sessionImpl() worth being hoisted out once? It's a minor thing eh -same 
>> for `dst` and base/offsets
>
> tried that - and it's mostly a wash. For `unsafeGetBase` some care is 
> required - that method contains a cast to the sharp array type that is 
> backing the segment (if the segment is on-heap). This cast is crucial to 
> inform the `Unsafe` intrinsics on the type of the array being operated on. If 
> `Unsafe` doesn't know that type it falls back to a slower intrinsics. So 
> better to keep that where it is.

thanks for the info . didn't knew about it! 🙏

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20829#discussion_r1742413680

Reply via email to