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

[TEST_BUG]: JDK-8214799 11u backport broke gc/CriticalNativeStress.java and gc/CriticalNativeArgs.java

    XMLWordPrintable

Details

    • gc

    Description

      When 11u build includes Shenandoah GC. Tests test/hotspot/jtreg/gc/shenandoah/jni/CriticalNativeArgs.java and test/hotspot/jtreg/gc/shenandoah/jni/CriticalNativeStress.java fail with UnsatisfiedLinkError. This happens because the backport of https://bugs.openjdk.org/browse/JDK-8214799 to 11u misses the following changes:

      diff --git a/test/hotspot/jtreg/gc/shenandoah/jni/CriticalNativeArgs.java b/test/hotspot/jtreg/gc/shenandoah/jni/CriticalNativeArgs.java
      index fca66ae07f..2e861b0f1c 100644
      --- a/test/hotspot/jtreg/gc/shenandoah/jni/CriticalNativeArgs.java
      +++ b/test/hotspot/jtreg/gc/shenandoah/jni/CriticalNativeArgs.java
      @@ -37,20 +37,14 @@ package gc.shenandoah.jni;
        * @run main/othervm/native -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:+UnlockExperimentalVMOptions -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive -Xcomp -Xmx51
      2M -XX:+CriticalJNINatives gc.shenandoah.jni.CriticalNativeArgs
        */
       public class CriticalNativeArgs {
      - static {
      - System.loadLibrary("CriticalNative");
      - }
      -
      - static native boolean isNull(int[] a);
      -
           public static void main(String[] args) {
               int[] arr = new int[2];

      - if (isNull(arr)) {
      + if (CriticalNative.isNull(arr)) {
                   throw new RuntimeException("Should not be null");
               }

      - if (!isNull(null)) {
      + if (!CriticalNative.isNull(null)) {
                   throw new RuntimeException("Should be null");
               }
           }
      diff --git a/test/hotspot/jtreg/gc/shenandoah/jni/CriticalNativeStress.java b/test/hotspot/jtreg/gc/shenandoah/jni/CriticalNativeStress.java
      index bb559820ac..27ae22940a 100644
      --- a/test/hotspot/jtreg/gc/shenandoah/jni/CriticalNativeStress.java
      +++ b/test/hotspot/jtreg/gc/shenandoah/jni/CriticalNativeStress.java
      @@ -30,7 +30,7 @@ import gc.shenandoah.jni.CriticalNative;

       /* @test
        * @key randomness
      - * @library /test/lib
      + * @library /test/lib /
        * @requires (os.arch =="x86_64" | os.arch == "amd64" | os.arch=="x86" | os.arch=="i386") & !vm.graal.enabled & vm.gc.Shenandoah
        *
        * @run main/othervm/native -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive -XX:+ShenandoahDegeneratedGC -Xcomp -Xmx512M -XX:+CriticalJNINatives gc.shenandoah.jni.CriticalNativeStress
      @@ -43,18 +43,9 @@ import gc.shenandoah.jni.CriticalNative;
        * @run main/othervm/native -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive -Xcomp -Xmx512M -XX:+CriticalJNINatives gc.shenandoah.jni.CriticalNativeStress
        */
       public class CriticalNativeStress {
      - static {
      - System.loadLibrary("CriticalNative");
      - }
      -
           static final int CYCLES = 50;
           static final int THREAD_PER_CASE = 1;

      - static native long sum1(long[] a);
      -
      - // More than 6 parameters
      - static native long sum2(long a1, int[] a2, int[] a3, long[] a4, int[] a5);
      -
           static long sum(long[] a) {
               long sum = 0;
               for (int index = 0; index < a.length; index++) {
      @@ -93,7 +84,7 @@ public class CriticalNativeStress {
                   create_garbage(index);
               }

      - long native_sum = sum1(arr);
      + long native_sum = CriticalNative.sum1(arr);
               long java_sum = sum(arr);
               if (native_sum != java_sum) {
                   StringBuffer sb = new StringBuffer("Sums do not match: native = ")
      @@ -135,7 +126,7 @@ public class CriticalNativeStress {
                   create_garbage(index);
               }

      - long native_sum = sum2(a1, a2, a3, a4, a5);
      + long native_sum = CriticalNative.sum2(a1, a2, a3, a4, a5);
               long java_sum = a1 + sum(a2) + sum(a3) + sum(a4) + sum(a5);
               if (native_sum != java_sum) {
                   StringBuffer sb = new StringBuffer("Sums do not match: native = ")

      Attachments

        Issue Links

          Activity

            People

              zgu Zhengyu Gu
              eastigeevich Evgeny Astigeevich
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: