RFR: 8365017: The SegmentBulkOperations::copy method can be improved using overlaps [v4]

Roger Riggs rriggs at openjdk.org
Fri Aug 8 16:07:11 UTC 2025


On Fri, 8 Aug 2025 13:25:27 GMT, Per Minborg <pminborg at openjdk.org> wrote:

>> This PR proposes to use overlapping memory areas in `SegmentBulkOperations::copy`, similar to what is proposed for `SegmentBulkOperations::fill` in https://github.com/openjdk/jdk/pull/25383.
>> 
>> This PR passes `tier1`, `tier2`, and `tier3`testing on multiple platforms.
>
> Per Minborg has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Update copyright year

src/java.base/share/classes/jdk/internal/foreign/AbstractMemorySegmentImpl.java line 266:

> 264: 
> 265:             // The below computation is a branchless equivalent to
> 266:             // `return (thisStart < thatEnd && thisEnd > thatStart)?1:0;`. Here is how:

It would be pretty cool if C2 could do the optimization of branch-less computations like these.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26672#discussion_r2263379446


More information about the core-libs-dev mailing list