mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 03:58:21 +00:00
8374862: assert(false) failed: Attempting to acquire lock MDOExtraData_lock/nosafepoint-1 out of order with lock tty_lock/tty -- possible deadlock (running with -XX:+Verbose -XX:+WizardMode -XX:+PrintDeoptimizationDetails)
Reviewed-by: dholmes, dlong
This commit is contained in:
parent
fa20391e73
commit
6f6966b28b
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2026, 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
|
||||
@ -192,18 +192,20 @@ void BytecodeTracer::trace_interpreter(const methodHandle& method, address bcp,
|
||||
}
|
||||
#endif
|
||||
|
||||
void BytecodeTracer::print_method_codes(const methodHandle& method, int from, int to, outputStream* st, int flags) {
|
||||
void BytecodeTracer::print_method_codes(const methodHandle& method, int from, int to, outputStream* st, int flags, bool buffered) {
|
||||
BytecodePrinter method_printer(flags);
|
||||
BytecodeStream s(method);
|
||||
s.set_interval(from, to);
|
||||
|
||||
// Keep output to st coherent: collect all lines and print at once.
|
||||
ResourceMark rm;
|
||||
stringStream ss;
|
||||
outputStream* out = buffered ? &ss : st;
|
||||
while (s.next() >= 0) {
|
||||
method_printer.trace(method, s.bcp(), &ss);
|
||||
method_printer.trace(method, s.bcp(), out);
|
||||
}
|
||||
if (buffered) {
|
||||
st->print("%s", ss.as_string());
|
||||
}
|
||||
st->print("%s", ss.as_string());
|
||||
}
|
||||
|
||||
void BytecodePrinter::print_constant(int cp_index, outputStream* st) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2026, 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
|
||||
@ -39,7 +39,7 @@ class BytecodeClosure;
|
||||
class BytecodeTracer: AllStatic {
|
||||
public:
|
||||
NOT_PRODUCT(static void trace_interpreter(const methodHandle& method, address bcp, uintptr_t tos, uintptr_t tos2, outputStream* st = tty);)
|
||||
static void print_method_codes(const methodHandle& method, int from, int to, outputStream* st, int flags);
|
||||
static void print_method_codes(const methodHandle& method, int from, int to, outputStream* st, int flags, bool buffered = true);
|
||||
};
|
||||
|
||||
#endif // SHARE_INTERPRETER_BYTECODETRACER_HPP
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2026, 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
|
||||
@ -1898,15 +1898,15 @@ void Method::print_name(outputStream* st) const {
|
||||
#endif // !PRODUCT || INCLUDE_JVMTI
|
||||
|
||||
|
||||
void Method::print_codes_on(outputStream* st, int flags) const {
|
||||
print_codes_on(0, code_size(), st, flags);
|
||||
void Method::print_codes_on(outputStream* st, int flags, bool buffered) const {
|
||||
print_codes_on(0, code_size(), st, flags, buffered);
|
||||
}
|
||||
|
||||
void Method::print_codes_on(int from, int to, outputStream* st, int flags) const {
|
||||
void Method::print_codes_on(int from, int to, outputStream* st, int flags, bool buffered) const {
|
||||
Thread *thread = Thread::current();
|
||||
ResourceMark rm(thread);
|
||||
methodHandle mh (thread, (Method*)this);
|
||||
BytecodeTracer::print_method_codes(mh, from, to, st, flags);
|
||||
BytecodeTracer::print_method_codes(mh, from, to, st, flags, buffered);
|
||||
}
|
||||
|
||||
CompressedLineNumberReadStream::CompressedLineNumberReadStream(u_char* buffer) : CompressedReadStream(buffer) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2026, 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
|
||||
@ -466,8 +466,8 @@ public:
|
||||
|
||||
// prints byte codes
|
||||
void print_codes(int flags = 0) const { print_codes_on(tty, flags); }
|
||||
void print_codes_on(outputStream* st, int flags = 0) const;
|
||||
void print_codes_on(int from, int to, outputStream* st, int flags = 0) const;
|
||||
void print_codes_on(outputStream* st, int flags = 0, bool buffered = true) const;
|
||||
void print_codes_on(int from, int to, outputStream* st, int flags = 0, bool buffered = true) const;
|
||||
|
||||
// method parameters
|
||||
bool has_method_parameters() const
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2026, 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
|
||||
@ -491,6 +491,15 @@ void vframeArrayElement::unpack_on_stack(int caller_actual_parameters,
|
||||
|
||||
#ifndef PRODUCT
|
||||
if (PrintDeoptimizationDetails) {
|
||||
const bool print_codes = WizardMode && Verbose;
|
||||
ResourceMark rm(thread);
|
||||
stringStream codes_ss;
|
||||
if (print_codes) {
|
||||
// print_codes_on() may acquire MDOExtraData_lock (rank nosafepoint-1).
|
||||
// To keep the lock acquisition order correct, call it before taking tty_lock.
|
||||
// Avoid double buffering: set buffered=false.
|
||||
method()->print_codes_on(&codes_ss, 0, false);
|
||||
}
|
||||
ttyLocker ttyl;
|
||||
tty->print_cr("[%d. Interpreted Frame]", ++unpack_counter);
|
||||
iframe()->print_on(tty);
|
||||
@ -500,7 +509,9 @@ void vframeArrayElement::unpack_on_stack(int caller_actual_parameters,
|
||||
RegisterMap::WalkContinuation::skip);
|
||||
vframe* f = vframe::new_vframe(iframe(), &map, thread);
|
||||
f->print();
|
||||
if (WizardMode && Verbose) method()->print_codes();
|
||||
if (print_codes) {
|
||||
tty->print("%s", codes_ss.as_string());
|
||||
}
|
||||
tty->cr();
|
||||
}
|
||||
#endif // !PRODUCT
|
||||
|
||||
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright (c) 2026, 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
|
||||
* @bug 8374862
|
||||
* @summary Regression test for -XX:+Verbose -XX:+WizardMode -XX:+PrintDeoptimizationDetails crash
|
||||
* @requires vm.debug
|
||||
* @run main/othervm -XX:+Verbose -XX:+WizardMode -XX:+PrintDeoptimizationDetails compiler.uncommontrap.TestDeoptDetailsLockRank
|
||||
*/
|
||||
|
||||
package compiler.uncommontrap;
|
||||
|
||||
public class TestDeoptDetailsLockRank {
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println("passed");
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user