Skip to content

Commit

Permalink
8290198: Shenandoah: a few Shenandoah tests failure after JDK-8214799…
Browse files Browse the repository at this point in the history
… 11u backport

Reviewed-by: rkennke
  • Loading branch information
zhengyu123 committed Jul 14, 2022
1 parent c9a7259 commit 9d0b5e5
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 28 deletions.
12 changes: 3 additions & 9 deletions test/hotspot/jtreg/gc/shenandoah/jni/CriticalNativeArgs.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2019, Red Hat, Inc. and/or its affiliates.
* Copyright (c) 2018, 2022, Red Hat, Inc. and/or its affiliates.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
Expand Down Expand Up @@ -37,20 +37,14 @@
* @run main/othervm/native -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:+UnlockExperimentalVMOptions -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive -Xcomp -Xmx512M -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");
}
}
Expand Down
21 changes: 6 additions & 15 deletions test/hotspot/jtreg/gc/shenandoah/jni/CriticalNativeStress.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2019, Red Hat, Inc. and/or its affiliates.
* Copyright (c) 2018, 2022, Red Hat, Inc. and/or its affiliates.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
Expand All @@ -26,11 +26,11 @@
import java.util.Random;
import jdk.test.lib.Utils;

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
Expand All @@ -43,18 +43,9 @@
* @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++) {
Expand Down Expand Up @@ -93,7 +84,7 @@ static void run_test_case1(Random rand) {
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 = ")
Expand Down Expand Up @@ -135,7 +126,7 @@ static void run_test_case2(Random rand) {
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 = ")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2018, Red Hat, Inc. All rights reserved.
* Copyright (c) 2016, 2022, Red Hat, Inc. All rights reserved.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
Expand Down Expand Up @@ -29,6 +29,7 @@
* @test TestGCBasherWithShenandoah
* @key gc
* @key stress
* @library /
* @requires vm.gc.Shenandoah & !vm.graal.enabled
* @requires vm.flavor == "server" & !vm.emulatedClient & !vm.graal.enabled
* @summary Stress the Shenandoah GC by trying to make old objects more likely to be garbage than young objects.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2018, Red Hat, Inc. All rights reserved.
* Copyright (c) 2017, 2022, Red Hat, Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -27,6 +27,7 @@
/*
* @test TestGCLockerWithShenandoah
* @key gc
* @library /
* @requires vm.gc.Shenandoah & !vm.graal.enabled
* @summary Stress Shenandoah's JNI handling by calling GetPrimitiveArrayCritical while concurrently filling up old gen.
*
Expand All @@ -43,6 +44,7 @@
/*
* @test TestGCLockerWithShenandoah
* @key gc
* @library /
* @requires vm.gc.Shenandoah & !vm.graal.enabled
* @summary Stress Shenandoah's JNI handling by calling GetPrimitiveArrayCritical while concurrently filling up old gen.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -77,6 +77,7 @@
* @test TestGCOldWithShenandoah
* @key gc
* @key stress
* @library / /test/lib
* @requires vm.gc.Shenandoah & !vm.graal.enabled
* @summary Stress the GC by trying to make old objects more likely to be garbage than young objects.
*
Expand All @@ -94,6 +95,7 @@
* @test TestGCOldWithShenandoah
* @key gc
* @key stress
* @library / /test/lib
* @requires vm.gc.Shenandoah & !vm.graal.enabled
* @summary Stress the GC by trying to make old objects more likely to be garbage than young objects.
*
Expand Down Expand Up @@ -128,6 +130,7 @@
* @test TestGCOldWithShenandoah
* @key gc
* @key stress
* @library / /test/lib
* @requires vm.gc.Shenandoah & !vm.graal.enabled
* @summary Stress the GC by trying to make old objects more likely to be garbage than young objects.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2018, Red Hat, Inc. All rights reserved.
* Copyright (c) 2017, 2022, Red Hat, Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -28,6 +28,7 @@
* @test TestSystemGCWithShenandoah
* @key gc
* @key stress
* @library /
* @requires vm.gc.Shenandoah & !vm.graal.enabled
* @summary Stress the Shenandoah GC full GC by allocating objects of different lifetimes concurrently with System.gc().
*
Expand Down

1 comment on commit 9d0b5e5

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.