hotspot/test/gc/TestCardTablePageCommits.java
author erikj
Fri, 26 Jun 2015 10:09:55 +0200
changeset 33929 b6f2e71b26c5
parent 30604 b8d532cb6420
child 36576 8bd19bf60177
permissions -rw-r--r--
8087329: Introduce VERSION_IS_GA Reviewed-by: ihse
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
/*
29678
dd2f3932c21e 8075586: Add @modules as needed to the open hotspot tests
ykantser
parents: 28026
diff changeset
     2
* Copyright (c) 2014, 2015, 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
3694b71eef6c 8059066: CardTableModRefBS might commit the same page twice
ehelin
parents:
diff changeset
    34
 * @library /testlibrary
29678
dd2f3932c21e 8075586: Add @modules as needed to the open hotspot tests
ykantser
parents: 28026
diff changeset
    35
 * @modules java.base/sun.misc
dd2f3932c21e 8075586: Add @modules as needed to the open hotspot tests
ykantser
parents: 28026
diff changeset
    36
 *          java.management
28026
3694b71eef6c 8059066: CardTableModRefBS might commit the same page twice
ehelin
parents:
diff changeset
    37
 * @run driver TestCardTablePageCommits
3694b71eef6c 8059066: CardTableModRefBS might commit the same page twice
ehelin
parents:
diff changeset
    38
 */
3694b71eef6c 8059066: CardTableModRefBS might commit the same page twice
ehelin
parents:
diff changeset
    39
public class TestCardTablePageCommits {
3694b71eef6c 8059066: CardTableModRefBS might commit the same page twice
ehelin
parents:
diff changeset
    40
    public static void main(String args[]) throws Exception {
3694b71eef6c 8059066: CardTableModRefBS might commit the same page twice
ehelin
parents:
diff changeset
    41
        // 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
    42
        // 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
    43
        // 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
    44
        String Xmx = Platform.isSparc() ? "-Xmx8m" : "-Xmx4m";
3694b71eef6c 8059066: CardTableModRefBS might commit the same page twice
ehelin
parents:
diff changeset
    45
3694b71eef6c 8059066: CardTableModRefBS might commit the same page twice
ehelin
parents:
diff changeset
    46
        String[] opts = {Xmx, "-XX:NativeMemoryTracking=detail", "-XX:+UseParallelGC", "-version"};
3694b71eef6c 8059066: CardTableModRefBS might commit the same page twice
ehelin
parents:
diff changeset
    47
        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(opts);
3694b71eef6c 8059066: CardTableModRefBS might commit the same page twice
ehelin
parents:
diff changeset
    48
        OutputAnalyzer output = new OutputAnalyzer(pb.start());
3694b71eef6c 8059066: CardTableModRefBS might commit the same page twice
ehelin
parents:
diff changeset
    49
        output.shouldHaveExitValue(0);
3694b71eef6c 8059066: CardTableModRefBS might commit the same page twice
ehelin
parents:
diff changeset
    50
    }
3694b71eef6c 8059066: CardTableModRefBS might commit the same page twice
ehelin
parents:
diff changeset
    51
}