Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8259636: Check for buffer backed by shared segment kicks in in unexpe…
…cted places

Reviewed-by: sundar, alanb, chegar
  • Loading branch information
mcimadamore committed Jan 12, 2021
1 parent 5f9cd72 commit 17b4db31cbc5c2b4829c2d38b832832b874ae28e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
@@ -203,7 +203,7 @@ class Direct$Type$Buffer$RW$$BO$
{
#if[rw]
super(mark, pos, lim, cap, segment);
address = db.address() + off;
address = ((Buffer)db).address + off;
#if[byte]
cleaner = null;
#end[byte]
@@ -64,7 +64,6 @@
import java.nio.file.StandardOpenOption;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.function.BiConsumer;
@@ -668,6 +667,15 @@ public void buffersAndArraysFromSlices(Supplier<MemorySegment> segmentSupplier)
}
}

@Test(dataProvider="segments")
public void viewsFromSharedSegment(Supplier<MemorySegment> segmentSupplier) {
try (MemorySegment segment = segmentSupplier.get().share()) {
var byteBuffer = segment.asByteBuffer();
byteBuffer.asReadOnlyBuffer();
byteBuffer.slice(0, 8);
}
}

@DataProvider(name = "segments")
public static Object[][] segments() throws Throwable {
return new Object[][] {

1 comment on commit 17b4db3

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on 17b4db3 Jan 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.