On Fri, 4 Sep 2026 14:03:34 GMT, Per Minborg <[email protected]> wrote:

> This PR proposes to fix a bug in the `MemorySegment::asOverlapingSlice` which 
> incorrectly computes the size of the overlapping region. 
> 
> A parameterized test is also proposed via this PR
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

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

> 246:     public final Optional<MemorySegment> 
> asOverlappingSlice(MemorySegment other) {
> 247:         final AbstractMemorySegmentImpl that = 
> (AbstractMemorySegmentImpl)Objects.requireNonNull(other);
> 248:         if (unsafeGetBase() == that.unsafeGetBase()) { // both either 
> native or the same heap segment

Why was `overlaps` inlined here, and then not even removed?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/32707#discussion_r3934986081

Reply via email to