annotate test/gc/metaspace/TestCapacityUntilGCWrapAround.java @ 21784:f4e1d958f1c3

[AMD64] Create AMD64 specific address nodes.
author Roland Schatz <roland.schatz@oracle.com>
date Mon, 08 Jun 2015 19:19:45 +0200
parents b509b7ff561c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
20540
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
1 /*
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
4 *
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
7 * published by the Free Software Foundation.
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
8 *
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
13 * accompanied this code).
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
14 *
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
18 *
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
21 * questions.
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
22 */
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
23
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
24 /*
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
25 * @test
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
26 * @key gc
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
27 * @bug 8049831
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
28 * @library /testlibrary /testlibrary/whitebox
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
29 * @build TestCapacityUntilGCWrapAround
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
30 * @run main ClassFileInstaller sun.hotspot.WhiteBox
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
31 * sun.hotspot.WhiteBox$WhiteBoxPermission
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
32 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI TestCapacityUntilGCWrapAround
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
33 */
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
34
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
35 import sun.hotspot.WhiteBox;
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
36
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
37 import com.oracle.java.testlibrary.Asserts;
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
38 import com.oracle.java.testlibrary.Platform;
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
39
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
40 public class TestCapacityUntilGCWrapAround {
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
41 private static long MB = 1024 * 1024;
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
42 private static long GB = 1024 * MB;
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
43 private static long MAX_UINT = 4 * GB - 1; // On 32-bit platforms
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
44
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
45 public static void main(String[] args) {
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
46 if (Platform.is32bit()) {
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
47 WhiteBox wb = WhiteBox.getWhiteBox();
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
48
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
49 long before = wb.metaspaceCapacityUntilGC();
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
50 // Now force possible overflow of capacity_until_GC.
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
51 long after = wb.incMetaspaceCapacityUntilGC(MAX_UINT);
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
52
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
53 Asserts.assertGTE(after, before,
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
54 "Increasing with MAX_UINT should not cause wrap around: " + after + " < " + before);
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
55 Asserts.assertLTE(after, MAX_UINT,
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
56 "Increasing with MAX_UINT should not cause value larger than MAX_UINT:" + after);
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
57 }
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
58 }
b509b7ff561c 8049599: MetaspaceGC::_capacity_until_GC can overflow
ehelin
parents:
diff changeset
59 }