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
|
@ -29,6 +29,7 @@ import jdk.internal.access.JavaNioAccess;
|
|||
import jdk.internal.access.SharedSecrets;
|
||||
import jdk.internal.access.foreign.MemorySegmentProxy;
|
||||
import jdk.internal.access.foreign.UnmapperProxy;
|
||||
import jdk.internal.misc.ScopedMemoryAccess;
|
||||
import jdk.internal.misc.Unsafe;
|
||||
import jdk.internal.misc.VM.BufferPool;
|
||||
import jdk.internal.vm.annotation.ForceInline;
|
||||
|
@ -193,6 +194,8 @@ public abstract class Buffer {
|
|||
// Cached unsafe-access object
|
||||
static final Unsafe UNSAFE = Unsafe.getUnsafe();
|
||||
|
||||
static final ScopedMemoryAccess SCOPED_MEMORY_ACCESS = ScopedMemoryAccess.getScopedMemoryAccess();
|
||||
|
||||
/**
|
||||
* The characteristics of Spliterators that traverse and split elements
|
||||
* maintained in Buffers.
|
||||
|
@ -754,9 +757,18 @@ public abstract class Buffer {
|
|||
}
|
||||
|
||||
@ForceInline
|
||||
final void checkSegment() {
|
||||
final ScopedMemoryAccess.Scope scope() {
|
||||
if (segment != null) {
|
||||
segment.checkValidState();
|
||||
return segment.scope();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
final void checkScope() {
|
||||
ScopedMemoryAccess.Scope scope = scope();
|
||||
if (scope != null) {
|
||||
scope.checkValidState();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -827,6 +839,21 @@ public abstract class Buffer {
|
|||
public boolean isLoaded(long address, boolean isSync, long size) {
|
||||
return MappedMemoryUtils.isLoaded(address, isSync, size);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reserveMemory(long size, long cap) {
|
||||
Bits.reserveMemory(size, cap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unreserveMemory(long size, long cap) {
|
||||
Bits.unreserveMemory(size, cap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int pageSize() {
|
||||
return Bits.pageSize();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue