test/gc/g1/TestPrintRegionRememberedSetInfo.java

Mon, 28 Jul 2014 15:06:38 -0700

author
fzhinkin
date
Mon, 28 Jul 2014 15:06:38 -0700
changeset 6997
dbb05f6d93c4
parent 5458
e3c8767c5cf8
child 6876
710a3c8b516e
permissions
-rw-r--r--

8051344: JVM crashed in Compile::start() during method parsing w/ UseRTMDeopt turned on
Summary: call rtm_deopt() only if there were no compilation bailouts before.
Reviewed-by: kvn

tschatzl@5122 1 /*
tschatzl@5122 2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
tschatzl@5122 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
tschatzl@5122 4 *
tschatzl@5122 5 * This code is free software; you can redistribute it and/or modify it
tschatzl@5122 6 * under the terms of the GNU General Public License version 2 only, as
tschatzl@5122 7 * published by the Free Software Foundation.
tschatzl@5122 8 *
tschatzl@5122 9 * This code is distributed in the hope that it will be useful, but WITHOUT
tschatzl@5122 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
tschatzl@5122 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
tschatzl@5122 12 * version 2 for more details (a copy is included in the LICENSE file that
tschatzl@5122 13 * accompanied this code).
tschatzl@5122 14 *
tschatzl@5122 15 * You should have received a copy of the GNU General Public License version
tschatzl@5122 16 * 2 along with this work; if not, write to the Free Software Foundation,
tschatzl@5122 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
tschatzl@5122 18 *
tschatzl@5122 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
tschatzl@5122 20 * or visit www.oracle.com if you need additional information or have any
tschatzl@5122 21 * questions.
tschatzl@5122 22 */
tschatzl@5122 23
tschatzl@5122 24 /**
tschatzl@5122 25 * @test TestPrintRegionRememberedSetInfo
tschatzl@5122 26 * @key gc
tschatzl@5122 27 * @bug 8014240
tschatzl@5122 28 * @summary Test output of G1PrintRegionRememberedSetInfo
tschatzl@5122 29 * @library /testlibrary
tschatzl@5458 30 * @run main TestPrintRegionRememberedSetInfo
tschatzl@5122 31 * @author thomas.schatzl@oracle.com
tschatzl@5122 32 */
tschatzl@5122 33
tschatzl@5122 34 import com.oracle.java.testlibrary.*;
tschatzl@5122 35 import java.lang.Thread;
tschatzl@5122 36 import java.util.ArrayList;
tschatzl@5122 37 import java.util.Arrays;
tschatzl@5122 38
tschatzl@5122 39 class RunAndWaitForMarking {
tschatzl@5122 40 public static void main(String[] args) {
tschatzl@5122 41 System.gc();
tschatzl@5122 42 try {
tschatzl@5122 43 Thread.sleep(200);
tschatzl@5122 44 } catch (InterruptedException e) {
tschatzl@5122 45 }
tschatzl@5122 46 }
tschatzl@5122 47 }
tschatzl@5122 48
tschatzl@5122 49 public class TestPrintRegionRememberedSetInfo {
tschatzl@5122 50
tschatzl@5122 51 public static String runTest(String arg) throws Exception {
tschatzl@5122 52 ArrayList<String> finalargs = new ArrayList<String>();
tschatzl@5122 53 String[] defaultArgs = new String[] {
tschatzl@5122 54 "-XX:+UseG1GC",
tschatzl@5122 55 "-Xmx10m",
tschatzl@5122 56 "-XX:+ExplicitGCInvokesConcurrent",
tschatzl@5122 57 "-XX:+UnlockDiagnosticVMOptions",
tschatzl@5122 58 "-XX:+G1PrintRegionLivenessInfo",
tschatzl@5122 59 "-XX:G1HeapRegionSize=1M",
tschatzl@5122 60 "-XX:InitiatingHeapOccupancyPercent=0",
tschatzl@5122 61 };
tschatzl@5122 62
tschatzl@5122 63 finalargs.addAll(Arrays.asList(defaultArgs));
tschatzl@5122 64 finalargs.add(arg);
tschatzl@5122 65
tschatzl@5122 66 finalargs.add(RunAndWaitForMarking.class.getName());
tschatzl@5122 67
tschatzl@5122 68 ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
tschatzl@5122 69 finalargs.toArray(new String[0]));
tschatzl@5122 70 OutputAnalyzer output = new OutputAnalyzer(pb.start());
tschatzl@5122 71 output.shouldHaveExitValue(0);
tschatzl@5122 72
tschatzl@5122 73 String result = output.getStdout();
tschatzl@5122 74 return result;
tschatzl@5122 75 }
tschatzl@5122 76
tschatzl@5122 77 public static void main(String[] args) throws Exception {
tschatzl@5122 78 String result;
tschatzl@5122 79
tschatzl@5122 80 result = runTest("-XX:+G1PrintRegionLivenessInfo");
tschatzl@5122 81 // check that we got region statistics output
tschatzl@5122 82 if (result.indexOf("PHASE") == -1) {
tschatzl@5122 83 throw new RuntimeException("Unexpected output from -XX:+PrintRegionLivenessInfo found.");
tschatzl@5122 84 }
tschatzl@5122 85
tschatzl@5122 86 result = runTest("-XX:-G1PrintRegionLivenessInfo");
tschatzl@5122 87 if (result.indexOf("remset") != -1) {
tschatzl@5122 88 throw new RuntimeException("Should find remembered set information in output.");
tschatzl@5122 89 }
tschatzl@5122 90 }
tschatzl@5122 91 }
tschatzl@5122 92

mercurial