summaryrefslogtreecommitdiffstats
path: root/oatdump/oatdump.cc
diff options
context:
space:
mode:
authorFred Shih <ffred@google.com>2014-07-16 18:38:08 -0700
committerFred Shih <ffred@google.com>2014-08-25 11:16:53 -0700
commit37f05ef45e0393de812d51261dc293240c17294d (patch)
tree7c7793862efa52e1deb42babbdcb652c245ab941 /oatdump/oatdump.cc
parente25826e28ea65d9c1aa23f84788a091c677b20c7 (diff)
downloadart-37f05ef45e0393de812d51261dc293240c17294d.tar.gz
art-37f05ef45e0393de812d51261dc293240c17294d.tar.bz2
art-37f05ef45e0393de812d51261dc293240c17294d.zip
Reduced memory usage of primitive fields smaller than 4-bytes
Reduced memory used by byte and boolean fields from 4 bytes down to a single byte and shorts and chars down to two bytes. Fields are now arranged as Reference followed by decreasing component sizes, with fields shuffled forward as needed. Bug: 8135266 Change-Id: I65eaf31ed27e5bd5ba0c7d4606454b720b074752
Diffstat (limited to 'oatdump/oatdump.cc')
-rw-r--r--oatdump/oatdump.cc15
1 files changed, 13 insertions, 2 deletions
diff --git a/oatdump/oatdump.cc b/oatdump/oatdump.cc
index 447003c931..88c73d2bc5 100644
--- a/oatdump/oatdump.cc
+++ b/oatdump/oatdump.cc
@@ -939,15 +939,26 @@ class ImageDumper {
StackHandleScope<1> hs(Thread::Current());
FieldHelper fh(hs.NewHandle(field));
mirror::Class* type = fh.GetType();
+ DCHECK(type->IsPrimitive());
if (type->IsPrimitiveLong()) {
os << StringPrintf("%" PRId64 " (0x%" PRIx64 ")\n", field->Get64(obj), field->Get64(obj));
} else if (type->IsPrimitiveDouble()) {
os << StringPrintf("%f (%a)\n", field->GetDouble(obj), field->GetDouble(obj));
} else if (type->IsPrimitiveFloat()) {
os << StringPrintf("%f (%a)\n", field->GetFloat(obj), field->GetFloat(obj));
- } else {
- DCHECK(type->IsPrimitive());
+ } else if (type->IsPrimitiveInt()) {
os << StringPrintf("%d (0x%x)\n", field->Get32(obj), field->Get32(obj));
+ } else if (type->IsPrimitiveChar()) {
+ os << StringPrintf("%u (0x%x)\n", field->GetChar(obj), field->GetChar(obj));
+ } else if (type->IsPrimitiveShort()) {
+ os << StringPrintf("%d (0x%x)\n", field->GetShort(obj), field->GetShort(obj));
+ } else if (type->IsPrimitiveBoolean()) {
+ os << StringPrintf("%s (0x%x)\n", field->GetBoolean(obj)? "true" : "false",
+ field->GetBoolean(obj));
+ } else if (type->IsPrimitiveByte()) {
+ os << StringPrintf("%d (0x%x)\n", field->GetByte(obj), field->GetByte(obj));
+ } else {
+ LOG(FATAL) << "Unknown type: " << PrettyClass(type);
}
} else {
// Get the value, don't compute the type unless it is non-null as we don't want