提交 92c402f0 编写于 作者: T tschatzl

8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails...

8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
Summary: The initialization for the remembered set summary data structures used the wrong thread count, i.e. number of worker threads instead of number of refinement threads.
Reviewed-by: brutisso
上级 0847e662
...@@ -83,7 +83,9 @@ G1RemSet::G1RemSet(G1CollectedHeap* g1, CardTableModRefBS* ct_bs) ...@@ -83,7 +83,9 @@ G1RemSet::G1RemSet(G1CollectedHeap* g1, CardTableModRefBS* ct_bs)
for (uint i = 0; i < n_workers(); i++) { for (uint i = 0; i < n_workers(); i++) {
_cset_rs_update_cl[i] = NULL; _cset_rs_update_cl[i] = NULL;
} }
_prev_period_summary.initialize(this, n_workers()); if (G1SummarizeRSetStats) {
_prev_period_summary.initialize(this);
}
} }
G1RemSet::~G1RemSet() { G1RemSet::~G1RemSet() {
...@@ -728,7 +730,7 @@ bool G1RemSet::refine_card(jbyte* card_ptr, int worker_i, ...@@ -728,7 +730,7 @@ bool G1RemSet::refine_card(jbyte* card_ptr, int worker_i,
void G1RemSet::print_periodic_summary_info(const char* header) { void G1RemSet::print_periodic_summary_info(const char* header) {
G1RemSetSummary current; G1RemSetSummary current;
current.initialize(this, n_workers()); current.initialize(this);
_prev_period_summary.subtract_from(&current); _prev_period_summary.subtract_from(&current);
print_summary_info(&_prev_period_summary, header); print_summary_info(&_prev_period_summary, header);
...@@ -738,7 +740,7 @@ void G1RemSet::print_periodic_summary_info(const char* header) { ...@@ -738,7 +740,7 @@ void G1RemSet::print_periodic_summary_info(const char* header) {
void G1RemSet::print_summary_info() { void G1RemSet::print_summary_info() {
G1RemSetSummary current; G1RemSetSummary current;
current.initialize(this, n_workers()); current.initialize(this);
print_summary_info(&current, " Cumulative RS summary"); print_summary_info(&current, " Cumulative RS summary");
} }
......
...@@ -77,12 +77,12 @@ double G1RemSetSummary::rs_thread_vtime(uint thread) const { ...@@ -77,12 +77,12 @@ double G1RemSetSummary::rs_thread_vtime(uint thread) const {
return _rs_threads_vtimes[thread]; return _rs_threads_vtimes[thread];
} }
void G1RemSetSummary::initialize(G1RemSet* remset, uint num_workers) { void G1RemSetSummary::initialize(G1RemSet* remset) {
assert(_rs_threads_vtimes == NULL, "just checking"); assert(_rs_threads_vtimes == NULL, "just checking");
assert(remset != NULL, "just checking"); assert(remset != NULL, "just checking");
_remset = remset; _remset = remset;
_num_vtimes = num_workers; _num_vtimes = ConcurrentG1Refine::thread_num();
_rs_threads_vtimes = NEW_C_HEAP_ARRAY(double, _num_vtimes, mtGC); _rs_threads_vtimes = NEW_C_HEAP_ARRAY(double, _num_vtimes, mtGC);
memset(_rs_threads_vtimes, 0, sizeof(double) * _num_vtimes); memset(_rs_threads_vtimes, 0, sizeof(double) * _num_vtimes);
......
...@@ -84,7 +84,7 @@ public: ...@@ -84,7 +84,7 @@ public:
void subtract_from(G1RemSetSummary* other); void subtract_from(G1RemSetSummary* other);
// initialize and get the first sampling // initialize and get the first sampling
void initialize(G1RemSet* remset, uint num_workers); void initialize(G1RemSet* remset);
void print_on(outputStream* out); void print_on(outputStream* out);
......
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test TestSummarizeRSetStatsThreads
* @bug 8025441
* @summary Ensure that various values of worker threads/concurrent
* refinement threads do not crash the VM.
* @key gc
* @library /testlibrary
*/
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.oracle.java.testlibrary.ProcessTools;
import com.oracle.java.testlibrary.OutputAnalyzer;
public class TestSummarizeRSetStatsThreads {
private static void runTest(int refinementThreads, int workerThreads) throws Exception {
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
"-XX:+UnlockDiagnosticVMOptions",
"-XX:+G1SummarizeRSetStats",
"-XX:G1ConcRefinementThreads=" + refinementThreads,
"-XX:ParallelGCThreads=" + workerThreads,
"-version");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
// check output to contain the string "Concurrent RS threads times (s)" followed by
// the correct number of values in the next line.
// a zero in refinement thread numbers indicates that the value in ParallelGCThreads should be used.
// Additionally use at least one thread.
int expectedNumRefinementThreads = refinementThreads == 0 ? workerThreads : refinementThreads;
expectedNumRefinementThreads = Math.max(1, expectedNumRefinementThreads);
// create the pattern made up of n copies of a floating point number pattern
String numberPattern = String.format("%0" + expectedNumRefinementThreads + "d", 0)
.replace("0", "\\s+\\d+\\.\\d+");
String pattern = "Concurrent RS threads times \\(s\\)$" + numberPattern + "$";
Matcher m = Pattern.compile(pattern, Pattern.MULTILINE).matcher(output.getStdout());
if (!m.find()) {
throw new Exception("Could not find correct output for concurrent RS threads times in stdout," +
" should match the pattern \"" + pattern + "\", but stdout is \n" + output.getStdout());
}
output.shouldHaveExitValue(0);
}
public static void main(String[] args) throws Exception {
if (!TestSummarizeRSetStatsTools.testingG1GC()) {
return;
}
// different valid combinations of number of refinement and gc worker threads
runTest(0, 0);
runTest(0, 5);
runTest(5, 0);
runTest(10, 10);
runTest(1, 2);
runTest(4, 3);
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册