< prev index next >
test/compiler/gcbarriers/PreserveFPRegistersTest.java
Print this page
*** 23,40 ****
*/
/**
* @test
* @bug 8148175
! * @run main/othervm/timeout=300 -XX:+UseG1GC -Xbatch -Xmx128m PreserveFPRegistersTest
*/
public class PreserveFPRegistersTest {
public static void main(String... args) throws InterruptedException {
new PreserveFPRegistersTest().go();
}
public final Object[][] storage;
/**
* Number of objects per region.
*/
--- 23,48 ----
*/
/**
* @test
* @bug 8148175
! * @requires vm.gc=="G1" | vm.gc=="null"
! * @library /testlibrary /testlibrary/whitebox
! * @run main/bootclasspath/othervm -Xbatch -XX:+UnlockDiagnosticVMOptions
! * -XX:+WhiteBoxAPI -Xmx300m -XX:+UseG1GC PreserveFPRegistersTest
*/
+
+ import sun.hotspot.WhiteBox;
+
public class PreserveFPRegistersTest {
public static void main(String... args) throws InterruptedException {
new PreserveFPRegistersTest().go();
}
+ private static WhiteBox wb = WhiteBox.getWhiteBox();
+
public final Object[][] storage;
/**
* Number of objects per region.
*/
*** 49,71 ****
* How many regions involved into testing.
*/
public final int regionCount;
PreserveFPRegistersTest() {
! long regionSize = 1_000_000; //WB.g1RegionSize();
!
Runtime rt = Runtime.getRuntime();
long used = rt.totalMemory() - rt.freeMemory();
long totalFree = rt.maxMemory() - used;
regionCount = (int) ( (totalFree / regionSize) * 0.9);
! int refSize = 4;
!
N = (int) ((regionSize / K ) / refSize) - 5;
storage = new Object[regionCount * K][];
for (int i = 0; i < storage.length; i++) {
storage[i] = new Object[N];
}
}
public void go() throws InterruptedException {
final float FINAL = getValue();
--- 57,93 ----
* How many regions involved into testing.
*/
public final int regionCount;
PreserveFPRegistersTest() {
! long regionSize = wb.g1RegionSize();
Runtime rt = Runtime.getRuntime();
long used = rt.totalMemory() - rt.freeMemory();
long totalFree = rt.maxMemory() - used;
regionCount = (int) ( (totalFree / regionSize) * 0.9);
! int refSize = wb.getHeapOopSize();
N = (int) ((regionSize / K ) / refSize) - 5;
+
+ System.out.println("%% Memory");
+ System.out.println("%% used : " + used / 1024 + "M");
+ System.out.println("%% available : " + totalFree / 1024 + "M");
+ System.out.println("%% G1 Region Size: " + regionSize / 1024 + "M");
+ System.out.println("%% region count : " + regionCount);
+
+ System.out.println("%% Objects storage");
+ System.out.println("%% N (array length) : " + N);
+ System.out.println("%% K (objects in regions): " + K);
+ System.out.println("%% Reference size : " + refSize);
+
+ try {
storage = new Object[regionCount * K][];
for (int i = 0; i < storage.length; i++) {
storage[i] = new Object[N];
}
+ } catch(OutOfMemoryError e) {
+ throw new AssertionError("Test Failed with unexpected OutOfMemoryError exception");
+ }
}
public void go() throws InterruptedException {
final float FINAL = getValue();
< prev index next >