Skip to content

Commit 3455fa9

Browse files
author
Vladimir Ivanov
committed
8256050: JVM crashes with -XX:+PrintDeoptimizationDetails
Reviewed-by: kvn, dcubed
1 parent e6df13e commit 3455fa9

File tree

7 files changed

+31
-15
lines changed

7 files changed

+31
-15
lines changed

src/hotspot/share/oops/instanceKlass.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3607,9 +3607,19 @@ void InstanceKlass::oop_print_value_on(oop obj, outputStream* st) {
36073607
st->print(" = ");
36083608
vmtarget->print_value_on(st);
36093609
} else {
3610-
java_lang_invoke_MemberName::clazz(obj)->print_value_on(st);
3610+
oop clazz = java_lang_invoke_MemberName::clazz(obj);
3611+
oop name = java_lang_invoke_MemberName::name(obj);
3612+
if (clazz != NULL) {
3613+
clazz->print_value_on(st);
3614+
} else {
3615+
st->print("NULL");
3616+
}
36113617
st->print(".");
3612-
java_lang_invoke_MemberName::name(obj)->print_value_on(st);
3618+
if (name != NULL) {
3619+
name->print_value_on(st);
3620+
} else {
3621+
st->print("NULL");
3622+
}
36133623
}
36143624
}
36153625
}

src/hotspot/share/oops/markWord.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,19 @@
2828
#include "runtime/objectMonitor.hpp"
2929
#include "utilities/ostream.hpp"
3030

31-
void markWord::print_on(outputStream* st) const {
31+
void markWord::print_on(outputStream* st, bool print_monitor_info) const {
3232
if (is_marked()) { // last bits = 11
3333
st->print(" marked(" INTPTR_FORMAT ")", value());
3434
} else if (has_monitor()) { // last bits = 10
3535
// have to check has_monitor() before is_locked()
3636
st->print(" monitor(" INTPTR_FORMAT ")=", value());
37-
ObjectMonitor* mon = monitor();
38-
if (mon == NULL) {
39-
st->print("NULL (this should never be seen!)");
40-
} else {
41-
mon->print_on(st);
37+
if (print_monitor_info) {
38+
ObjectMonitor* mon = monitor();
39+
if (mon == NULL) {
40+
st->print("NULL (this should never be seen!)");
41+
} else {
42+
mon->print_on(st);
43+
}
4244
}
4345
} else if (is_locked()) { // last bits != 01 => 00
4446
// thin locked

src/hotspot/share/oops/markWord.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ class markWord {
355355
static inline markWord prototype_for_klass(const Klass* klass);
356356

357357
// Debugging
358-
void print_on(outputStream* st) const;
358+
void print_on(outputStream* st, bool print_monitor_info = true) const;
359359

360360
// Prepare address of oop for placement into mark
361361
inline static markWord encode_pointer_as_mark(void* p) { return from_pointer(p).set_marked(); }

src/hotspot/share/runtime/basicLock.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,18 @@
2323
*/
2424

2525
#include "precompiled.hpp"
26+
#include "oops/oop.inline.hpp"
2627
#include "runtime/basicLock.hpp"
2728
#include "runtime/synchronizer.hpp"
2829

29-
void BasicLock::print_on(outputStream* st) const {
30+
void BasicLock::print_on(outputStream* st, oop owner) const {
3031
st->print("monitor");
3132
markWord mark_word = displaced_header();
32-
if (mark_word.value() != 0)
33-
mark_word.print_on(st);
33+
if (mark_word.value() != 0) {
34+
// Print monitor info if there's an owning oop and it refers to this BasicLock.
35+
bool print_monitor_info = (owner != NULL) && (owner->mark() == markWord::from_pointer((void*)this));
36+
mark_word.print_on(st, print_monitor_info);
37+
}
3438
}
3539

3640
void BasicLock::move_to(oop obj, BasicLock* dest) {

src/hotspot/share/runtime/basicLock.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class BasicLock {
4343
Atomic::store(&_displaced_header, header);
4444
}
4545

46-
void print_on(outputStream* st) const;
46+
void print_on(outputStream* st, oop owner) const;
4747

4848
// move a basic lock (used during deoptimization
4949
void move_to(oop obj, BasicLock* dest);

src/hotspot/share/runtime/frame.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ void frame::interpreter_frame_print_on(outputStream* st) const {
509509
current->obj()->print_value_on(st);
510510
st->print_cr("]");
511511
st->print(" - lock [");
512-
current->lock()->print_on(st);
512+
current->lock()->print_on(st, current->obj());
513513
st->print_cr("]");
514514
}
515515
// monitor

src/hotspot/share/runtime/vframe.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ void javaVFrame::print() {
669669
}
670670
tty->cr();
671671
tty->print("\t ");
672-
monitor->lock()->print_on(tty);
672+
monitor->lock()->print_on(tty, monitor->owner());
673673
tty->cr();
674674
}
675675
}

0 commit comments

Comments
 (0)