Skip to content

Commit 4fb41f2

Browse files
committed
8230943: False deadlock detection with -XX:+CIPrintCompileQueue after JDK-8163511
Reviewed-by: dholmes, thartmann
1 parent 788b241 commit 4fb41f2

File tree

2 files changed

+47
-2
lines changed

2 files changed

+47
-2
lines changed

src/hotspot/share/compiler/compileBroker.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -557,8 +557,14 @@ void CompileQueue::print(outputStream* st) {
557557
}
558558

559559
void CompileQueue::print_tty() {
560-
ttyLocker ttyl;
561-
print(tty);
560+
ResourceMark rm;
561+
stringStream ss;
562+
// Dump the compile queue into a buffer before locking the tty
563+
print(&ss);
564+
{
565+
ttyLocker ttyl;
566+
tty->print("%s", ss.as_string());
567+
}
562568
}
563569

564570
CompilerCounters::CompilerCounters() {
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* Copyright (c) 2019, Loongson Technology Co. Ltd. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation.
8+
*
9+
* This code is distributed in the hope that it will be useful, but WITHOUT
10+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
* version 2 for more details (a copy is included in the LICENSE file that
13+
* accompanied this code).
14+
*
15+
* You should have received a copy of the GNU General Public License version
16+
* 2 along with this work; if not, write to the Free Software Foundation,
17+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18+
*
19+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20+
* or visit www.oracle.com if you need additional information or have any
21+
* questions.
22+
*/
23+
24+
/*
25+
* @test
26+
* @bug 8230943
27+
* @summary possible deadlock was detected when ran with -XX:+CIPrintCompileQueue
28+
* @run main/othervm -Xcomp -XX:+UnlockDiagnosticVMOptions -XX:+CIPrintCompileQueue
29+
* compiler.print.PrintCompileQueue
30+
*
31+
*/
32+
33+
package compiler.print;
34+
35+
public class PrintCompileQueue {
36+
public static void main(String[] args) {
37+
System.out.println("Passed");
38+
}
39+
}

0 commit comments

Comments
 (0)