hotspot/test/gc/TestCardTablePageCommits.java
author sjohanss
Thu, 24 Mar 2016 10:49:08 +0100
changeset 37244 9b8f2dc281ad
parent 36576 8bd19bf60177
child 36851 03e2f4d0a421
permissions -rw-r--r--
8151460: Metaspace counters can have inconsistent values Reviewed-by: jmasa, pliden
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
28026
3694b71eef6c 8059066: CardTableModRefBS might commit the same page twice
ehelin
parents:
diff changeset
     1
/*
36576
8bd19bf60177 8078673: Update TEST.groups for recent GC tests
drwhite
parents: 30604
diff changeset
     2
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
28026
3694b71eef6c 8059066: CardTableModRefBS might commit the same page twice
ehelin
parents:
diff changeset
     3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3694b71eef6c 8059066: CardTableModRefBS might commit the same page twice
ehelin
parents:
diff changeset
     4
*
3694b71eef6c 8059066: CardTableModRefBS might commit the same page twice
ehelin
parents:
diff changeset
     5
* This code is free software; you can redistribute it and/or modify it
3694b71eef6c 8059066: CardTableModRefBS might commit the same page twice
ehelin
parents:
diff changeset
     6
* under the terms of the GNU General Public License version 2 only, as
3694b71eef6c 8059066: CardTableModRefBS might commit the same page twice
ehelin
parents:
diff changeset
     7
* published by the Free Software Foundation.
3694b71eef6c 8059066: CardTableModRefBS might commit the same page twice
ehelin
parents:
diff changeset
     8
*
3694b71eef6c 8059066: CardTableModRefBS might commit the same page twice
ehelin
parents:
diff changeset
     9
* This code is distributed in the hope that it will be useful, but WITHOUT
3694b71eef6c 8059066: CardTableModRefBS might commit the same page twice
ehelin
parents:
diff changeset
    10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3694b71eef6c 8059066: CardTableModRefBS might commit the same page twice
ehelin
parents:
diff changeset
    11
* FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
3694b71eef6c 8059066: CardTableModRefBS might commit the same page twice
ehelin
parents:
diff changeset
    12
* version 2 for more details (a copy is included in the LICENSE file that
3694b71eef6c 8059066: CardTableModRefBS might commit the same page twice
ehelin
parents:
diff changeset
    13
* accompanied this code).
3694b71eef6c 8059066: CardTableModRefBS might commit the same page twice
ehelin
parents:
diff changeset
    14
*
3694b71eef6c 8059066: CardTableModRefBS might commit the same page twice
ehelin
parents:
diff changeset
    15
* You should have received a copy of the GNU General Public License version
3694b71eef6c 8059066: CardTableModRefBS might commit the same page twice
ehelin
parents:
diff changeset
    16
* 2 along with this work; if not, write to the Free Software Foundation,
3694b71eef6c 8059066: CardTableModRefBS might commit the same page twice
ehelin
parents:
diff changeset
    17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
3694b71eef6c 8059066: CardTableModRefBS might commit the same page twice
ehelin
parents:
diff changeset
    18
*
3694b71eef6c 8059066: CardTableModRefBS might commit the same page twice
ehelin
parents:
diff changeset
    19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
3694b71eef6c 8059066: CardTableModRefBS might commit the same page twice
ehelin
parents:
diff changeset
    20
* or visit www.oracle.com if you need additional information or have any
3694b71eef6c 8059066: CardTableModRefBS might commit the same page twice
ehelin
parents:
diff changeset
    21
* questions.
3694b71eef6c 8059066: CardTableModRefBS might commit the same page twice
ehelin
parents:
diff changeset
    22
*/
3694b71eef6c 8059066: CardTableModRefBS might commit the same page twice
ehelin
parents:
diff changeset
    23
30604
b8d532cb6420 8067013: Rename the com.oracle.java.testlibary package
ykantser
parents: 29678
diff changeset
    24
import jdk.test.lib.JDKToolFinder;
b8d532cb6420 8067013: Rename the com.oracle.java.testlibary package
ykantser
parents: 29678
diff changeset
    25
import jdk.test.lib.OutputAnalyzer;
b8d532cb6420 8067013: Rename the com.oracle.java.testlibary package
ykantser
parents: 29678
diff changeset
    26
import jdk.test.lib.ProcessTools;
b8d532cb6420 8067013: Rename the com.oracle.java.testlibary package
ykantser
parents: 29678
diff changeset
    27
import jdk.test.lib.Platform;
28026
3694b71eef6c 8059066: CardTableModRefBS might commit the same page twice
ehelin
parents:
diff changeset
    28
3694b71eef6c 8059066: CardTableModRefBS might commit the same page twice
ehelin
parents:
diff changeset
    29
/*
3694b71eef6c 8059066: CardTableModRefBS might commit the same page twice
ehelin
parents:
diff changeset
    30
 * @test TestCardTablePageCommits
3694b71eef6c 8059066: CardTableModRefBS might commit the same page twice
ehelin
parents:
diff changeset
    31
 * @key gc
3694b71eef6c 8059066: CardTableModRefBS might commit the same page twice
ehelin
parents:
diff changeset
    32
 * @bug 8059066
3694b71eef6c 8059066: CardTableModRefBS might commit the same page twice
ehelin
parents:
diff changeset
    33
 * @summary Tests that the card table does not commit the same page twice
36576
8bd19bf60177 8078673: Update TEST.groups for recent GC tests
drwhite
parents: 30604
diff changeset
    34
 * @requires vm.gc=="Parallel" | vm.gc=="null"
28026
3694b71eef6c 8059066: CardTableModRefBS might commit the same page twice
ehelin
parents:
diff changeset
    35
 * @library /testlibrary
29678
dd2f3932c21e 8075586: Add @modules as needed to the open hotspot tests
ykantser
parents: 28026
diff changeset
    36
 * @modules java.base/sun.misc
dd2f3932c21e 8075586: Add @modules as needed to the open hotspot tests
ykantser
parents: 28026
diff changeset
    37
 *          java.management
28026
3694b71eef6c 8059066: CardTableModRefBS might commit the same page twice
ehelin
parents:
diff changeset
    38
 * @run driver TestCardTablePageCommits
3694b71eef6c 8059066: CardTableModRefBS might commit the same page twice
ehelin
parents:
diff changeset
    39
 */
3694b71eef6c 8059066: CardTableModRefBS might commit the same page twice
ehelin
parents:
diff changeset
    40
public class TestCardTablePageCommits {
3694b71eef6c 8059066: CardTableModRefBS might commit the same page twice
ehelin
parents:
diff changeset
    41
    public static void main(String args[]) throws Exception {
3694b71eef6c 8059066: CardTableModRefBS might commit the same page twice
ehelin
parents:
diff changeset
    42
        // The test is run with a small heap to make sure all pages in the card
3694b71eef6c 8059066: CardTableModRefBS might commit the same page twice
ehelin
parents:
diff changeset
    43
        // table gets committed. Need 8 MB heap to trigger the bug on SPARC
3694b71eef6c 8059066: CardTableModRefBS might commit the same page twice
ehelin
parents:
diff changeset
    44
        // because of 8kB pages, assume 4 KB pages for all other CPUs.
3694b71eef6c 8059066: CardTableModRefBS might commit the same page twice
ehelin
parents:
diff changeset
    45
        String Xmx = Platform.isSparc() ? "-Xmx8m" : "-Xmx4m";
3694b71eef6c 8059066: CardTableModRefBS might commit the same page twice
ehelin
parents:
diff changeset
    46
3694b71eef6c 8059066: CardTableModRefBS might commit the same page twice
ehelin
parents:
diff changeset
    47
        String[] opts = {Xmx, "-XX:NativeMemoryTracking=detail", "-XX:+UseParallelGC", "-version"};
3694b71eef6c 8059066: CardTableModRefBS might commit the same page twice
ehelin
parents:
diff changeset
    48
        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(opts);
3694b71eef6c 8059066: CardTableModRefBS might commit the same page twice
ehelin
parents:
diff changeset
    49
        OutputAnalyzer output = new OutputAnalyzer(pb.start());
3694b71eef6c 8059066: CardTableModRefBS might commit the same page twice
ehelin
parents:
diff changeset
    50
        output.shouldHaveExitValue(0);
3694b71eef6c 8059066: CardTableModRefBS might commit the same page twice
ehelin
parents:
diff changeset
    51
    }
3694b71eef6c 8059066: CardTableModRefBS might commit the same page twice
ehelin
parents:
diff changeset
    52
}