< prev index next >
src/share/vm/runtime/fieldDescriptor.cpp
Print this page
@@ -29,10 +29,11 @@
#include "memory/universe.inline.hpp"
#include "oops/annotations.hpp"
#include "oops/instanceKlass.hpp"
#include "oops/oop.inline.hpp"
#include "oops/fieldStreams.hpp"
+#include "oops/valueKlass.hpp"
#include "runtime/fieldDescriptor.hpp"
#include "runtime/handles.inline.hpp"
#include "runtime/signature.hpp"
@@ -144,12 +145,14 @@
}
}
}
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:
as_int = (jint)obj->byte_field(offset());
st->print(" %d", obj->byte_field(offset()));
@@ -193,15 +196,25 @@
case T_OBJECT:
st->print(" ");
NOT_LP64(as_int = obj->int_field(offset()));
obj->obj_field(offset())->print_value_on(st);
break;
- case T_VALUETYPE:
- st->print(" ");
- NOT_LP64(as_int = obj->int_field(offset()));
- obj->obj_field(offset())->print_value_on(st);
- break;
+ case T_VALUETYPE: {
+ // Resolve klass of flattened value type field
+ Thread* THREAD = Thread::current();
+ SignatureStream ss(signature(), false);
+ Klass* k = ss.as_klass(Handle(field_holder()->class_loader()), Handle(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)((uintptr_t)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
+ }
default:
ShouldNotReachHere();
break;
}
// Print a hint as to the underlying integer representation. This can be wrong for
@@ -209,8 +222,9 @@
if (ft == T_LONG || ft == T_DOUBLE LP64_ONLY(|| !is_java_primitive(ft)) ) {
st->print(" (%x %x)", obj->int_field(offset()), obj->int_field(offset()+sizeof(jint)));
} else if (as_int < 0 || as_int > 9) {
st->print(" (%x)", as_int);
}
+ st->cr();
}
#endif /* PRODUCT */
< prev index next >