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

Add Panama feature to pass heap segments to native code

    Details

    • Type: Enhancement
    • Status: New
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: repo-panama
    • Fix Version/s: None
    • Component/s: tools
    • Labels:

      Description


      The HotSpot JVM currently has feature for native calls that passes elements of a primitive array to a native function if it finds an entry point for that native function that is prefixed with JavaCritical_.[1]

      No JDK code currently uses this feature since it is not officially supported, but it may be used in some experimental and external code to improve performance.

      We would like to deprecate this feature, but recognize that this may be a useful optimization for performance of native calls. [2]

      A suggested Panama replacement could be code that adds a "pin" method to MemorySegment (see comment), or some other marker, that avoids the copy to native memory then calls the function as a trivial function, like:
                      func_trivial = abi.downcallHandle(addr, mt, fd.withAttribute(FunctionDescriptor.TRIVIAL_ATTRIBUTE_NAME, true));

      [1] https://stackoverflow.com/questions/48730135/how-to-get-javacritical-to-really-work-on-jni

      [2] https://bugs.openjdk.java.net/browse/JDK-8233343

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                coleenp Coleen Phillimore
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated: