Skip to content

Commit f48ad21

Browse files
ArrayingTheRealMDoerr
authored andcommitted
8371216: oopDesc::print_value_on breaks if klass is garbage
Reviewed-by: coleenp, mdoerr
1 parent 2c378e2 commit f48ad21

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/hotspot/share/oops/oop.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,10 @@ char* oopDesc::print_value_string() {
8383

8484
void oopDesc::print_value_on(outputStream* st) const {
8585
oop obj = const_cast<oopDesc*>(this);
86-
if (java_lang_String::is_instance(obj)) {
86+
// We can't use java_lang_String::is_instance since that has klass assertions enabled.
87+
// If the klass is garbage we want to just fail the check and continue printing, as
88+
// opposed to aborting the VM entirely.
89+
if (obj != nullptr && obj->klass_without_asserts() == vmClasses::String_klass()) {
8790
java_lang_String::print(obj, st);
8891
print_address_on(st);
8992
} else {

0 commit comments

Comments
 (0)