Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recognize Unsafe.copyMemory0 in JDK11 #10366

Merged
merged 2 commits into from Sep 16, 2020

Commits on Sep 16, 2020

  1. Recognize Unsafe.copyMemory0 in JDK11

    OpenJ9 contains the optimization that recognizes the JNI call
    sun/misc/Unsafe.copyMemory and transforms it to System.arrayCopy calls,
    which is inlined and optimized on most of the platform. Due to
    implementation changes in JDK11 we can not apply this optimization to
    sun/misc/Unsafe.copyMemory method which in Java 11 acts as a java
    wrapper that calls the implementation of copyMemory method from
    jdk/internal/misc/Unsafe class. This implementation contains additional
    changes to check range for the source and destination (in case of
    illegal access throws RuntimeException) before calling the
    actual JNI method jdk/internal/misc/Unsafe.copyMemory0 which can be
    transformed to System.arrayCopy call. Due to this behavioural changes,
    when compiling method that calls Unsafe.copyMemory, we need to make sure
    that optimizer is exposed to JNI call Unsafe.copyMemory0 and that call
    is recognized same way as JNI call sun/misc/Unsafe.copyMemory is
    recognized in Java 8 to optimize it further.
    
    Signed-off-by: Rahil Shah <rahil@ca.ibm.com>
    r30shah committed Sep 16, 2020
    Configuration menu
    Copy the full SHA
    c230754 View commit details
    Browse the repository at this point in the history
  2. Move transformUnsafeCopyMemoryCall in OpenJ9

    Transformation from Unsafe.copyMemory to System.arrayCopy was Java
    specific transformation. This commit moves the transformation to OpenJ9.
    
    Signed-off-by: Rahil Shah <rahil@ca.ibm.com>
    r30shah committed Sep 16, 2020
    Configuration menu
    Copy the full SHA
    c8663fc View commit details
    Browse the repository at this point in the history