mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8282191: Implementation of Foreign Function & Memory API (Preview)
Reviewed-by: erikj, jvernee, psandoz, dholmes, mchung
This commit is contained in:
parent
3be394e160
commit
2c5d136260
303 changed files with 33474 additions and 9186 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -27,10 +27,10 @@ package java.nio;
|
|||
|
||||
import java.io.FileDescriptor;
|
||||
import java.io.UncheckedIOException;
|
||||
import java.lang.foreign.MemorySegment;
|
||||
import java.lang.ref.Reference;
|
||||
import java.util.Objects;
|
||||
|
||||
import jdk.internal.access.foreign.MemorySegmentProxy;
|
||||
import jdk.internal.access.foreign.UnmapperProxy;
|
||||
import jdk.internal.misc.ScopedMemoryAccess;
|
||||
import jdk.internal.misc.Unsafe;
|
||||
|
@ -96,20 +96,20 @@ public abstract sealed class MappedByteBuffer
|
|||
// This should only be invoked by the DirectByteBuffer constructors
|
||||
//
|
||||
MappedByteBuffer(int mark, int pos, int lim, int cap, // package-private
|
||||
FileDescriptor fd, boolean isSync, MemorySegmentProxy segment) {
|
||||
FileDescriptor fd, boolean isSync, MemorySegment segment) {
|
||||
super(mark, pos, lim, cap, segment);
|
||||
this.fd = fd;
|
||||
this.isSync = isSync;
|
||||
}
|
||||
|
||||
MappedByteBuffer(int mark, int pos, int lim, int cap, // package-private
|
||||
boolean isSync, MemorySegmentProxy segment) {
|
||||
boolean isSync, MemorySegment segment) {
|
||||
super(mark, pos, lim, cap, segment);
|
||||
this.fd = null;
|
||||
this.isSync = isSync;
|
||||
}
|
||||
|
||||
MappedByteBuffer(int mark, int pos, int lim, int cap, MemorySegmentProxy segment) { // package-private
|
||||
MappedByteBuffer(int mark, int pos, int lim, int cap, MemorySegment segment) { // package-private
|
||||
super(mark, pos, lim, cap, segment);
|
||||
this.fd = null;
|
||||
this.isSync = false;
|
||||
|
@ -189,7 +189,7 @@ public abstract sealed class MappedByteBuffer
|
|||
if (fd == null) {
|
||||
return true;
|
||||
}
|
||||
return SCOPED_MEMORY_ACCESS.isLoaded(scope(), address, isSync, capacity());
|
||||
return SCOPED_MEMORY_ACCESS.isLoaded(session(), address, isSync, capacity());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -207,7 +207,7 @@ public abstract sealed class MappedByteBuffer
|
|||
return this;
|
||||
}
|
||||
try {
|
||||
SCOPED_MEMORY_ACCESS.load(scope(), address, isSync, capacity());
|
||||
SCOPED_MEMORY_ACCESS.load(session(), address, isSync, capacity());
|
||||
} finally {
|
||||
Reference.reachabilityFence(this);
|
||||
}
|
||||
|
@ -307,7 +307,7 @@ public abstract sealed class MappedByteBuffer
|
|||
if ((address != 0) && (capacity != 0)) {
|
||||
// check inputs
|
||||
Objects.checkFromIndexSize(index, length, capacity);
|
||||
SCOPED_MEMORY_ACCESS.force(scope(), fd, address, isSync, index, length);
|
||||
SCOPED_MEMORY_ACCESS.force(session(), fd, address, isSync, index, length);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue