--- old/src/hotspot/share/runtime/fieldDescriptor.cpp 2019-03-11 14:27:10.142354270 +0100 +++ new/src/hotspot/share/runtime/fieldDescriptor.cpp 2019-03-11 14:27:09.918354274 +0100 @@ -32,6 +32,7 @@ #include "oops/instanceKlass.hpp" #include "oops/oop.inline.hpp" #include "oops/fieldStreams.hpp" +#include "oops/valueKlass.hpp" #include "runtime/fieldDescriptor.inline.hpp" #include "runtime/handles.inline.hpp" #include "runtime/signature.hpp" @@ -147,8 +148,10 @@ } void fieldDescriptor::print_on_for(outputStream* st, oop obj) { - print_on(st); BasicType ft = field_type(); + if (ft != T_VALUETYPE) { + print_on(st); + } jint as_int = 0; switch (ft) { case T_BYTE: @@ -204,6 +207,30 @@ st->print_cr("NULL"); } break; + case T_VALUETYPE: + if (is_flattened()) { + // Resolve klass of flattened value type field + Thread* THREAD = Thread::current(); + ResourceMark rm(THREAD); + SignatureStream ss(signature(), false); + Klass* k = ss.as_klass(Handle(THREAD, field_holder()->class_loader()), + Handle(THREAD, field_holder()->protection_domain()), + SignatureStream::ReturnNull, THREAD); + assert(k != NULL && !HAS_PENDING_EXCEPTION, "can resolve klass?"); + ValueKlass* vk = ValueKlass::cast(k); + int field_offset = offset() - vk->first_field_offset(); + obj = (oop)((address)obj + field_offset); + // Print flattened fields of the value type field + st->print_cr("Flattened value type '%s':", vk->name()->as_C_string()); + FieldPrinter print_field(st, obj); + vk->do_nonstatic_fields(&print_field); + return; // Do not print underlying representation + } else { + st->print(" "); + NOT_LP64(as_int = obj->int_field(offset())); + obj->obj_field(offset())->print_value_on(st); + } + break; default: ShouldNotReachHere(); break; @@ -211,7 +238,7 @@ // Print a hint as to the underlying integer representation. This can be wrong for // pointers on an LP64 machine #ifdef _LP64 - if ((ft == T_OBJECT || ft == T_ARRAY) && UseCompressedOops) { + if ((ft == T_OBJECT || ft == T_ARRAY || ft == T_VALUETYPE) && UseCompressedOops) { st->print(" (%x)", obj->int_field(offset())); } else // <- intended @@ -221,6 +248,7 @@ } else if (as_int < 0 || as_int > 9) { st->print(" (%x)", as_int); } + st->cr(); } #endif /* PRODUCT */