RFR: 8343188: Investigate ways to simplify MemorySegment::ofBuffer [v5]

ExE Boss duke at openjdk.org
Thu Oct 31 19:10:32 UTC 2024


On Thu, 31 Oct 2024 17:20:11 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> Per Minborg 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 12 additional commits since the last revision:
>> 
>>  - Update comments
>>  - Merge branch 'master' into optimize-ms-ofbuffer
>>  - Rename method
>>  - Rename method
>>  - Fix issue in scaleFactor()
>>  - Update from comments and add benchmark
>>  - Remove switch rake and move factories to Buffer impls
>>  - Clean up generated code
>>  - Revert changes
>>  - Remove unused imports
>>  - ... and 2 more: https://git.openjdk.org/jdk/compare/e65f8164...e6b03e8b
>
> src/java.base/share/classes/jdk/internal/foreign/AbstractMemorySegmentImpl.java line 526:
> 
>> 524:         final Object base = NIO_ACCESS.getBufferBase(b);
>> 525:         return (base == null)
>> 526:                 ? nativeSegment(b, offset, length)
> 
> why not calling the other "heapSegment" ?

Because heap segments don’t have to be backed by an array.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21764#discussion_r1825042527


More information about the core-libs-dev mailing list