< prev index next >
test/gc/shenandoah/jni/TestJNICritical.java
Print this page
rev 10789 : [backport] Drop Shenandoah from test names
*** 1,7 ****
/*
! * Copyright (c) 2016 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
* published by the Free Software Foundation.
*
--- 1,7 ----
/*
! * Copyright (c) 2016, 2017, 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
* published by the Free Software Foundation.
*
*** 21,39 ****
*
*/
import java.util.Arrays;
! public class ShenandoahJNICritical {
static {
! System.loadLibrary("ShenandoahJNICritical");
}
private static final int NUM_RUNS = 10000;
! private static final int ARRAY_SIZE=10000;
private static int[] a;
private static int[] b;
private static native void copyAtoB(int[] a, int[] b);
public static void main(String[] args) {
a = new int[ARRAY_SIZE];
b = new int[ARRAY_SIZE];
--- 21,40 ----
*
*/
import java.util.Arrays;
! public class TestJNICritical {
static {
! System.loadLibrary("TestJNICritical");
}
private static final int NUM_RUNS = 10000;
! private static final int ARRAY_SIZE = 10000;
private static int[] a;
private static int[] b;
+
private static native void copyAtoB(int[] a, int[] b);
public static void main(String[] args) {
a = new int[ARRAY_SIZE];
b = new int[ARRAY_SIZE];
*** 46,56 ****
int[] a1 = new int[ARRAY_SIZE];
int[] b1 = new int[ARRAY_SIZE];
fillArray(a);
copyAtoB(a, b);
copyAtoB(a1, b1); // Don't optimize out garbage arrays.
! if (! Arrays.equals(a, b)) {
throw new RuntimeException("arrays not equal");
}
}
private static void fillArray(int[] array) {
--- 47,57 ----
int[] a1 = new int[ARRAY_SIZE];
int[] b1 = new int[ARRAY_SIZE];
fillArray(a);
copyAtoB(a, b);
copyAtoB(a1, b1); // Don't optimize out garbage arrays.
! if (!Arrays.equals(a, b)) {
throw new RuntimeException("arrays not equal");
}
}
private static void fillArray(int[] array) {
< prev index next >