mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8254162: Implementation of Foreign-Memory Access API (Third Incubator)
Reviewed-by: erikj, psandoz, alanb
This commit is contained in:
parent
c6ab0fdb15
commit
3e70aac5cc
82 changed files with 6038 additions and 2837 deletions
|
@ -31,6 +31,7 @@ import java.util.Objects;
|
|||
|
||||
import jdk.internal.access.foreign.MemorySegmentProxy;
|
||||
import jdk.internal.access.foreign.UnmapperProxy;
|
||||
import jdk.internal.misc.ScopedMemoryAccess;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -87,6 +88,8 @@ public abstract class MappedByteBuffer
|
|||
// determines the behavior of force operations.
|
||||
private final boolean isSync;
|
||||
|
||||
static final ScopedMemoryAccess SCOPED_MEMORY_ACCESS = ScopedMemoryAccess.getScopedMemoryAccess();
|
||||
|
||||
// This should only be invoked by the DirectByteBuffer constructors
|
||||
//
|
||||
MappedByteBuffer(int mark, int pos, int lim, int cap, // package-private
|
||||
|
@ -173,7 +176,7 @@ public abstract class MappedByteBuffer
|
|||
if (fd == null) {
|
||||
return true;
|
||||
}
|
||||
return MappedMemoryUtils.isLoaded(address, isSync, capacity());
|
||||
return SCOPED_MEMORY_ACCESS.isLoaded(scope(), address, isSync, capacity());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -191,7 +194,7 @@ public abstract class MappedByteBuffer
|
|||
return this;
|
||||
}
|
||||
try {
|
||||
MappedMemoryUtils.load(address, isSync, capacity());
|
||||
SCOPED_MEMORY_ACCESS.load(scope(), address, isSync, capacity());
|
||||
} finally {
|
||||
Reference.reachabilityFence(this);
|
||||
}
|
||||
|
@ -280,7 +283,7 @@ public abstract class MappedByteBuffer
|
|||
if ((address != 0) && (limit != 0)) {
|
||||
// check inputs
|
||||
Objects.checkFromIndexSize(index, length, limit);
|
||||
MappedMemoryUtils.force(fd, address, isSync, index, length);
|
||||
SCOPED_MEMORY_ACCESS.force(scope(), fd, address, isSync, index, length);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue