33 */ 34 35 import sun.hotspot.WhiteBox; 36 37 import com.oracle.java.testlibrary.Asserts; 38 import com.oracle.java.testlibrary.Platform; 39 40 public class TestCapacityUntilGCWrapAround { 41 private static long MB = 1024 * 1024; 42 private static long GB = 1024 * MB; 43 private static long MAX_UINT = 4 * GB - 1; // On 32-bit platforms 44 45 public static void main(String[] args) { 46 if (Platform.is32bit()) { 47 WhiteBox wb = WhiteBox.getWhiteBox(); 48 49 long before = wb.metaspaceCapacityUntilGC(); 50 long after = wb.incMetaspaceCapacityUntilGC(MAX_UINT); 51 52 Asserts.assertGTE(after, before, 53 String.format("Increasing with MAX_UINT should not cause wrap around: %d < %d", after, before)); 54 Asserts.assertEQ(after, MAX_UINT, 55 String.format("Increasing with MAX_UINT should set Metaspace::_capacityUntilGC to max_uint, not: %d", after)); 56 } 57 } 58 } | 33 */ 34 35 import sun.hotspot.WhiteBox; 36 37 import com.oracle.java.testlibrary.Asserts; 38 import com.oracle.java.testlibrary.Platform; 39 40 public class TestCapacityUntilGCWrapAround { 41 private static long MB = 1024 * 1024; 42 private static long GB = 1024 * MB; 43 private static long MAX_UINT = 4 * GB - 1; // On 32-bit platforms 44 45 public static void main(String[] args) { 46 if (Platform.is32bit()) { 47 WhiteBox wb = WhiteBox.getWhiteBox(); 48 49 long before = wb.metaspaceCapacityUntilGC(); 50 long after = wb.incMetaspaceCapacityUntilGC(MAX_UINT); 51 52 Asserts.assertGTE(after, before, 53 "Increasing with MAX_UINT should not cause wrap around: " + after + " < " + before); 54 Asserts.assertLTE(after, MAX_UINT, 55 "Increasing with MAX_UINT should not cause value larger than MAX_UINT:" + after); 56 } 57 } 58 } |