Skip to content
Permalink
Browse files
8256746: gc/CriticalNativeArgs.java fails without -XX:-CriticalJNINat…
…ives

Reviewed-by: kbarrett, coleenp, rkennke
  • Loading branch information
shipilev committed Nov 23, 2020
1 parent aac5c2a commit d9ae0db699e82e43b28a8b08ed8bbade9dca48fd
Showing 2 changed files with 44 additions and 10 deletions.
@@ -32,7 +32,12 @@
* @requires os.arch =="x86_64" | os.arch == "amd64" | os.arch=="x86" | os.arch=="i386"
* @requires vm.gc.Epsilon
* @summary test argument unpacking nmethod wrapper of critical native method
* @run main/othervm/native -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC -Xcomp -Xmx256M -XX:+CriticalJNINatives gc.CriticalNativeArgs
* @run main/othervm/native -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC -Xcomp -Xmx256M
* -XX:-CriticalJNINatives
* gc.CriticalNativeArgs
* @run main/othervm/native -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC -Xcomp -Xmx256M
* -XX:+CriticalJNINatives
* gc.CriticalNativeArgs
*/

/*
@@ -42,14 +47,38 @@
* @requires os.arch =="x86_64" | os.arch == "amd64" | os.arch=="x86" | os.arch=="i386"
* @requires vm.gc.Shenandoah
* @summary test argument unpacking nmethod wrapper of critical native method
* @run main/othervm/native -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive -XX:+ShenandoahDegeneratedGC -Xcomp -Xmx512M -XX:+CriticalJNINatives gc.CriticalNativeArgs
* @run main/othervm/native -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive -XX:-ShenandoahDegeneratedGC -Xcomp -Xmx512M -XX:+CriticalJNINatives gc.CriticalNativeArgs
*
* @run main/othervm/native -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive -Xcomp -Xmx512M -XX:+CriticalJNINatives gc.CriticalNativeArgs
* @run main/othervm/native -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xcomp -Xmx512M
* -XX:+UseShenandoahGC
* -XX:-CriticalJNINatives
* gc.CriticalNativeArgs
* @run main/othervm/native -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xcomp -Xmx512M
* -XX:+UseShenandoahGC
* -XX:+CriticalJNINatives
* gc.CriticalNativeArgs
*
* @run main/othervm/native -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -Xcomp -Xmx256M -XX:+CriticalJNINatives gc.CriticalNativeArgs
* @run main/othervm/native -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:+UnlockExperimentalVMOptions -XX:ShenandoahGCMode=iu -Xcomp -Xmx512M -XX:+CriticalJNINatives gc.CriticalNativeArgs
* @run main/othervm/native -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:+UnlockExperimentalVMOptions -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive -Xcomp -Xmx512M -XX:+CriticalJNINatives gc.CriticalNativeArgs
* @run main/othervm/native -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xcomp -Xmx512M
* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive -XX:+ShenandoahDegeneratedGC
* -XX:+CriticalJNINatives
* gc.CriticalNativeArgs
* @run main/othervm/native -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xcomp -Xmx512M
* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive -XX:-ShenandoahDegeneratedGC
* -XX:+CriticalJNINatives
* gc.CriticalNativeArgs
*
* @run main/othervm/native -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xcomp -Xmx512M
* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive
* -XX:+CriticalJNINatives
* gc.CriticalNativeArgs
*
* @run main/othervm/native -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xcomp -Xmx512M
* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu
* -XX:+CriticalJNINatives
* gc.CriticalNativeArgs
* @run main/othervm/native -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xcomp -Xmx512M
* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive
* -XX:+CriticalJNINatives
* gc.CriticalNativeArgs
*/

/*
@@ -58,7 +87,12 @@
* @library /
* @requires os.arch =="x86_64" | os.arch == "amd64" | os.arch=="x86" | os.arch=="i386" | os.arch=="ppc64" | os.arch=="ppc64le" | os.arch=="s390x"
* @summary test argument unpacking nmethod wrapper of critical native method
* @run main/othervm/native -Xcomp -Xmx512M -XX:+CriticalJNINatives gc.CriticalNativeArgs
* @run main/othervm/native -Xcomp -Xmx512M
* -XX:-CriticalJNINatives
* gc.CriticalNativeArgs
* @run main/othervm/native -Xcomp -Xmx512M
* -XX:+CriticalJNINatives
* gc.CriticalNativeArgs
*/
public class CriticalNativeArgs {
public static void main(String[] args) {
@@ -120,10 +120,10 @@ JNIEXPORT jboolean JNICALL JavaCritical_gc_CriticalNative_isNull

JNIEXPORT jboolean JNICALL Java_gc_CriticalNative_isNull
(JNIEnv *env, jclass jclazz, jintArray a) {
jboolean is_null;
if (a == NULL) return JNI_TRUE;
jsize len = (*env)->GetArrayLength(env, a);
jint* arr = (jint*)(*env)->GetPrimitiveArrayCritical(env, a, 0);
is_null = (arr == NULL) && (len == 0);
jboolean is_null = (arr == NULL) && (len == 0);
(*env)->ReleasePrimitiveArrayCritical(env, a, arr, 0);
return is_null;
}

1 comment on commit d9ae0db

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on d9ae0db Nov 23, 2020

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.