Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8304986

Upcall stubs should support capureCallState

XMLWordPrintable

      We have the captureCallState option for downcall handles to capture thread-local state that can be over written by the VM.

      For instance, a native function can set errno, and then before the caller can read it, some Java code executes where the VM internally ends up overwriting the errno value by making its own API call.

      A similar situation can occur for upcalls: if during an upcall errno needs to be set, this can not be done reliably using conventional means, since there is other non-user/VM code that executes before returning to native which might overwrite the errno value set by the callback again.

      We need to add support for captureCallState or a similar option for upcalls. The upcall method would receive a leading MemorySegment parameter into which the captured value (e.g. errno) should be written.

            jvernee Jorn Vernee
            jvernee Jorn Vernee
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: