mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8304265: Implementation of Foreign Function and Memory API (Third Preview)
Co-authored-by: Maurizio Cimadamore <mcimadamore@openjdk.org> Co-authored-by: Jorn Vernee <jvernee@openjdk.org> Co-authored-by: Paul Sandoz <psandoz@openjdk.org> Co-authored-by: Feilong Jiang <fjiang@openjdk.org> Co-authored-by: Per Minborg <pminborg@openjdk.org> Reviewed-by: erikj, jvernee, vlivanov, psandoz
This commit is contained in:
parent
41d58533ac
commit
cbccc4c817
267 changed files with 6947 additions and 8029 deletions
|
@ -30,7 +30,7 @@ import java.io.FileDescriptor;
|
|||
import java.io.IOException;
|
||||
import java.io.UncheckedIOException;
|
||||
import java.lang.foreign.MemorySegment;
|
||||
import java.lang.foreign.SegmentScope;
|
||||
import java.lang.foreign.Arena;
|
||||
import java.lang.ref.Cleaner.Cleanable;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.MappedByteBuffer;
|
||||
|
@ -1206,12 +1206,12 @@ public class FileChannelImpl
|
|||
|
||||
@Override
|
||||
public MemorySegment map(MapMode mode, long offset, long size,
|
||||
SegmentScope session)
|
||||
Arena arena)
|
||||
throws IOException
|
||||
{
|
||||
Objects.requireNonNull(mode,"Mode is null");
|
||||
Objects.requireNonNull(session, "Session is null");
|
||||
MemorySessionImpl sessionImpl = (MemorySessionImpl) session;
|
||||
Objects.requireNonNull(arena, "Arena is null");
|
||||
MemorySessionImpl sessionImpl = MemorySessionImpl.toMemorySession(arena);
|
||||
sessionImpl.checkValidState();
|
||||
if (offset < 0)
|
||||
throw new IllegalArgumentException("Requested bytes offset must be >= 0.");
|
||||
|
@ -1228,7 +1228,7 @@ public class FileChannelImpl
|
|||
if (unmapper != null) {
|
||||
AbstractMemorySegmentImpl segment =
|
||||
new MappedMemorySegmentImpl(unmapper.address(), unmapper, size,
|
||||
readOnly, session);
|
||||
readOnly, sessionImpl);
|
||||
MemorySessionImpl.ResourceList.ResourceCleanup resource =
|
||||
new MemorySessionImpl.ResourceList.ResourceCleanup() {
|
||||
@Override
|
||||
|
@ -1239,7 +1239,7 @@ public class FileChannelImpl
|
|||
sessionImpl.addOrCleanupIfFail(resource);
|
||||
return segment;
|
||||
} else {
|
||||
return new MappedMemorySegmentImpl.EmptyMappedMemorySegmentImpl(readOnly, sessionImpl);
|
||||
return new MappedMemorySegmentImpl(0, null, 0, readOnly, sessionImpl);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue