Merge

Tue, 30 Sep 2014 08:29:26 +0000

author
brutisso
date
Tue, 30 Sep 2014 08:29:26 +0000
changeset 7220
2d6a3328ec99
parent 7218
6948da6d7c13
parent 7219
8ba0078861d4
child 7221
43ce58b4717b
child 7223
1ff288f0dae4
child 7226
7d68a5b1069d

Merge

     1.1 --- a/src/share/vm/gc_implementation/g1/concurrentG1Refine.cpp	Tue Sep 30 09:44:36 2014 +0200
     1.2 +++ b/src/share/vm/gc_implementation/g1/concurrentG1Refine.cpp	Tue Sep 30 08:29:26 2014 +0000
     1.3 @@ -128,9 +128,7 @@
     1.4  }
     1.5  
     1.6  uint ConcurrentG1Refine::thread_num() {
     1.7 -  uint n_threads = (G1ConcRefinementThreads > 0) ? G1ConcRefinementThreads
     1.8 -                                                : ParallelGCThreads;
     1.9 -  return MAX2<uint>(n_threads, 1);
    1.10 +  return G1ConcRefinementThreads;
    1.11  }
    1.12  
    1.13  void ConcurrentG1Refine::print_worker_threads_on(outputStream* st) const {
     2.1 --- a/src/share/vm/runtime/arguments.cpp	Tue Sep 30 09:44:36 2014 +0200
     2.2 +++ b/src/share/vm/runtime/arguments.cpp	Tue Sep 30 08:29:26 2014 +0000
     2.3 @@ -1646,6 +1646,12 @@
     2.4                       Abstract_VM_Version::parallel_worker_threads());
     2.5    }
     2.6  
     2.7 +#if INCLUDE_ALL_GCS
     2.8 +  if (G1ConcRefinementThreads == 0) {
     2.9 +    FLAG_SET_DEFAULT(G1ConcRefinementThreads, ParallelGCThreads);
    2.10 +  }
    2.11 +#endif
    2.12 +
    2.13    // MarkStackSize will be set (if it hasn't been set by the user)
    2.14    // when concurrent marking is initialized.
    2.15    // Its value will be based upon the number of parallel marking threads.
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/test/gc/arguments/TestG1ConcRefinementThreads.java	Tue Sep 30 08:29:26 2014 +0000
     3.3 @@ -0,0 +1,97 @@
     3.4 +/*
     3.5 +* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
     3.6 +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3.7 +*
     3.8 +* This code is free software; you can redistribute it and/or modify it
     3.9 +* under the terms of the GNU General Public License version 2 only, as
    3.10 +* published by the Free Software Foundation.
    3.11 +*
    3.12 +* This code is distributed in the hope that it will be useful, but WITHOUT
    3.13 +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    3.14 +* FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    3.15 +* version 2 for more details (a copy is included in the LICENSE file that
    3.16 +* accompanied this code).
    3.17 +*
    3.18 +* You should have received a copy of the GNU General Public License version
    3.19 +* 2 along with this work; if not, write to the Free Software Foundation,
    3.20 +* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    3.21 +*
    3.22 +* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    3.23 +* or visit www.oracle.com if you need additional information or have any
    3.24 +* questions.
    3.25 +*/
    3.26 +
    3.27 +/*
    3.28 + * @test TestG1ConcRefinementThreads
    3.29 + * @key gc
    3.30 + * @bug 8047976
    3.31 + * @summary Tests argument processing for G1ConcRefinementThreads
    3.32 + * @library /testlibrary
    3.33 + */
    3.34 +
    3.35 +import com.oracle.java.testlibrary.*;
    3.36 +import java.util.*;
    3.37 +import java.util.regex.*;
    3.38 +
    3.39 +public class TestG1ConcRefinementThreads {
    3.40 +
    3.41 +  static final int AUTO_SELECT_THREADS_COUNT = 0;
    3.42 +  static final int PASSED_THREADS_COUNT = 11;
    3.43 +
    3.44 +  public static void main(String args[]) throws Exception {
    3.45 +    // default case
    3.46 +    runG1ConcRefinementThreadsTest(
    3.47 +        new String[]{}, // automatically selected
    3.48 +        AUTO_SELECT_THREADS_COUNT /* use default setting */);
    3.49 +
    3.50 +    // zero setting case
    3.51 +    runG1ConcRefinementThreadsTest(
    3.52 +        new String[]{"-XX:G1ConcRefinementThreads=0"}, // automatically selected
    3.53 +        AUTO_SELECT_THREADS_COUNT /* set to zero */);
    3.54 +
    3.55 +    // non-zero sestting case
    3.56 +    runG1ConcRefinementThreadsTest(
    3.57 +        new String[]{"-XX:G1ConcRefinementThreads="+Integer.toString(PASSED_THREADS_COUNT)},
    3.58 +        PASSED_THREADS_COUNT);
    3.59 +  }
    3.60 +
    3.61 +  private static void runG1ConcRefinementThreadsTest(String[] passedOpts,
    3.62 +          int expectedValue) throws Exception {
    3.63 +    List<String> vmOpts = new ArrayList<>();
    3.64 +    if (passedOpts.length > 0) {
    3.65 +      Collections.addAll(vmOpts, passedOpts);
    3.66 +    }
    3.67 +    Collections.addAll(vmOpts, "-XX:+UseG1GC", "-XX:+PrintFlagsFinal", "-version");
    3.68 +
    3.69 +    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(vmOpts.toArray(new String[vmOpts.size()]));
    3.70 +    OutputAnalyzer output = new OutputAnalyzer(pb.start());
    3.71 +
    3.72 +    output.shouldHaveExitValue(0);
    3.73 +    String stdout = output.getStdout();
    3.74 +    checkG1ConcRefinementThreadsConsistency(stdout, expectedValue);
    3.75 +  }
    3.76 +
    3.77 +  private static void checkG1ConcRefinementThreadsConsistency(String output, int expectedValue) {
    3.78 +    int actualValue = getIntValue("G1ConcRefinementThreads", output);
    3.79 +
    3.80 +    if (expectedValue == 0) {
    3.81 +      // If expectedValue is automatically selected, set it same as ParallelGCThreads.
    3.82 +      expectedValue = getIntValue("ParallelGCThreads", output);
    3.83 +    }
    3.84 +
    3.85 +    if (expectedValue != actualValue) {
    3.86 +      throw new RuntimeException(
    3.87 +            "Actual G1ConcRefinementThreads(" + Integer.toString(actualValue)
    3.88 +            + ") is not equal to expected value(" + Integer.toString(expectedValue) + ")");
    3.89 +    }
    3.90 +  }
    3.91 +
    3.92 +  public static int getIntValue(String flag, String where) {
    3.93 +    Matcher m = Pattern.compile(flag + "\\s+:?=\\s+\\d+").matcher(where);
    3.94 +    if (!m.find()) {
    3.95 +      throw new RuntimeException("Could not find value for flag " + flag + " in output string");
    3.96 +    }
    3.97 +    String match = m.group();
    3.98 +    return Integer.parseInt(match.substring(match.lastIndexOf(" ") + 1, match.length()));
    3.99 +  }
   3.100 +}

mercurial