RFR: 8347408: Create an internal method handle adapter for system calls with errno [v6]

Per Minborg pminborg at openjdk.org
Tue Jan 14 07:37:42 UTC 2025


On Mon, 13 Jan 2025 11:06:36 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> Per Minborg has updated the pull request incrementally with two additional commits since the last revision:
>> 
>>  - Clean up benchmark
>>  - Fix allocation problem in benchmark
>
> src/java.base/share/classes/jdk/internal/foreign/CaptureStateUtil.java line 214:
> 
>> 212:     // Used reflectively by `getAsIntHandle(MemoryLayout layout)`
>> 213:     private static int getStateAsInt(VarHandle handle) {
>> 214:         if (Thread.currentThread().isVirtual() && ContinuationSupport.isSupported()) {
> 
> Shouldn't we pin for the entire duration of the native call + errno retrieval? Otherwise, can't we end up in a situation where we have a back to back native call where the second native call overwrites the errno state of the first?

True. We need to rework the solution a bit as we do not want to pin virtual threads during system calls.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/22391#discussion_r1914364338


More information about the core-libs-dev mailing list