mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 23:34:52 +02:00
8264774: Implementation of Foreign Function and Memory API (Incubator)
Co-authored-by: Paul Sandoz <psandoz@openjdk.org> Co-authored-by: Jorn Vernee <jvernee@openjdk.org> Co-authored-by: Vladimir Ivanov <vlivanov@openjdk.org> Co-authored-by: Athijegannathan Sundararajan <sundar@openjdk.org> Co-authored-by: Chris Hegarty <chegar@openjdk.org> Reviewed-by: psandoz, chegar, mchung, vlivanov
This commit is contained in:
parent
71425ddfb4
commit
a223189b06
219 changed files with 10936 additions and 5695 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2021, 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
|
||||
|
@ -400,6 +400,7 @@ class WindowsAsynchronousSocketChannelImpl
|
|||
|
||||
// set by run method
|
||||
private ByteBuffer[] shadow;
|
||||
private Runnable scopeHandleReleasers;
|
||||
|
||||
ReadTask(ByteBuffer[] bufs,
|
||||
boolean scatteringRead,
|
||||
|
@ -416,6 +417,7 @@ class WindowsAsynchronousSocketChannelImpl
|
|||
* it substitutes non-direct buffers with direct buffers.
|
||||
*/
|
||||
void prepareBuffers() {
|
||||
scopeHandleReleasers = IOUtil.acquireScopes(bufs);
|
||||
shadow = new ByteBuffer[numBufs];
|
||||
long address = readBufferArray;
|
||||
for (int i=0; i<numBufs; i++) {
|
||||
|
@ -429,10 +431,10 @@ class WindowsAsynchronousSocketChannelImpl
|
|||
// substitute with direct buffer
|
||||
ByteBuffer bb = Util.getTemporaryDirectBuffer(rem);
|
||||
shadow[i] = bb;
|
||||
a = ((DirectBuffer)bb).address();
|
||||
a = IOUtil.bufferAddress(bb);
|
||||
} else {
|
||||
shadow[i] = dst;
|
||||
a = ((DirectBuffer)dst).address() + pos;
|
||||
a = IOUtil.bufferAddress(dst) + pos;
|
||||
}
|
||||
unsafe.putAddress(address + OFFSETOF_BUF, a);
|
||||
unsafe.putInt(address + OFFSETOF_LEN, rem);
|
||||
|
@ -490,6 +492,7 @@ class WindowsAsynchronousSocketChannelImpl
|
|||
Util.releaseTemporaryDirectBuffer(shadow[i]);
|
||||
}
|
||||
}
|
||||
IOUtil.releaseScopes(scopeHandleReleasers);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -671,6 +674,7 @@ class WindowsAsynchronousSocketChannelImpl
|
|||
|
||||
// set by run method
|
||||
private ByteBuffer[] shadow;
|
||||
private Runnable scopeHandleReleasers;
|
||||
|
||||
WriteTask(ByteBuffer[] bufs,
|
||||
boolean gatheringWrite,
|
||||
|
@ -687,6 +691,7 @@ class WindowsAsynchronousSocketChannelImpl
|
|||
* it substitutes non-direct buffers with direct buffers.
|
||||
*/
|
||||
void prepareBuffers() {
|
||||
scopeHandleReleasers = IOUtil.acquireScopes(bufs);
|
||||
shadow = new ByteBuffer[numBufs];
|
||||
long address = writeBufferArray;
|
||||
for (int i=0; i<numBufs; i++) {
|
||||
|
@ -703,10 +708,10 @@ class WindowsAsynchronousSocketChannelImpl
|
|||
bb.flip();
|
||||
src.position(pos); // leave heap buffer untouched for now
|
||||
shadow[i] = bb;
|
||||
a = ((DirectBuffer)bb).address();
|
||||
a = IOUtil.bufferAddress(bb);
|
||||
} else {
|
||||
shadow[i] = src;
|
||||
a = ((DirectBuffer)src).address() + pos;
|
||||
a = IOUtil.bufferAddress(src) + pos;
|
||||
}
|
||||
unsafe.putAddress(address + OFFSETOF_BUF, a);
|
||||
unsafe.putInt(address + OFFSETOF_LEN, rem);
|
||||
|
@ -754,6 +759,7 @@ class WindowsAsynchronousSocketChannelImpl
|
|||
Util.releaseTemporaryDirectBuffer(shadow[i]);
|
||||
}
|
||||
}
|
||||
IOUtil.releaseScopes(scopeHandleReleasers);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue