summaryrefslogtreecommitdiffstats
path: root/oatdump
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2014-12-02 15:04:37 -0800
committerIan Rogers <irogers@google.com>2014-12-02 15:12:27 -0800
commit08f1f50d6c2e8f247b8f5f19711d75a792851c7a (patch)
treedca490545d56168f7f9ae4a4616199b1b1c8ba0c /oatdump
parent8443637f71a777a13317fe7635028d758a0adf97 (diff)
downloadart-08f1f50d6c2e8f247b8f5f19711d75a792851c7a.tar.gz
art-08f1f50d6c2e8f247b8f5f19711d75a792851c7a.tar.bz2
art-08f1f50d6c2e8f247b8f5f19711d75a792851c7a.zip
Remove FieldHelper.
Change-Id: I2d74e2d5b3c35a691c95339de0db9361847fca11
Diffstat (limited to 'oatdump')
-rw-r--r--oatdump/oatdump.cc67
1 files changed, 35 insertions, 32 deletions
diff --git a/oatdump/oatdump.cc b/oatdump/oatdump.cc
index d28b626073..b048833431 100644
--- a/oatdump/oatdump.cc
+++ b/oatdump/oatdump.cc
@@ -32,7 +32,6 @@
#include "dex_instruction.h"
#include "disassembler.h"
#include "elf_builder.h"
-#include "field_helper.h"
#include "gc_map.h"
#include "gc/space/image_space.h"
#include "gc/space/large_object_space.h"
@@ -1459,50 +1458,54 @@ class ImageDumper {
static void PrintField(std::ostream& os, mirror::ArtField* field, mirror::Object* obj)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- const char* descriptor = field->GetTypeDescriptor();
os << StringPrintf("%s: ", field->GetName());
- if (descriptor[0] != 'L' && descriptor[0] != '[') {
- StackHandleScope<1> hs(Thread::Current());
- FieldHelper fh(hs.NewHandle(field));
- mirror::Class* type = fh.GetType();
- DCHECK(type->IsPrimitive());
- if (type->IsPrimitiveLong()) {
+ switch (field->GetTypeAsPrimitiveType()) {
+ case Primitive::kPrimLong:
os << StringPrintf("%" PRId64 " (0x%" PRIx64 ")\n", field->Get64(obj), field->Get64(obj));
- } else if (type->IsPrimitiveDouble()) {
+ break;
+ case Primitive::kPrimDouble:
os << StringPrintf("%f (%a)\n", field->GetDouble(obj), field->GetDouble(obj));
- } else if (type->IsPrimitiveFloat()) {
+ break;
+ case Primitive::kPrimFloat:
os << StringPrintf("%f (%a)\n", field->GetFloat(obj), field->GetFloat(obj));
- } else if (type->IsPrimitiveInt()) {
+ break;
+ case Primitive::kPrimInt:
os << StringPrintf("%d (0x%x)\n", field->Get32(obj), field->Get32(obj));
- } else if (type->IsPrimitiveChar()) {
+ break;
+ case Primitive::kPrimChar:
os << StringPrintf("%u (0x%x)\n", field->GetChar(obj), field->GetChar(obj));
- } else if (type->IsPrimitiveShort()) {
+ break;
+ case Primitive::kPrimShort:
os << StringPrintf("%d (0x%x)\n", field->GetShort(obj), field->GetShort(obj));
- } else if (type->IsPrimitiveBoolean()) {
+ break;
+ case Primitive::kPrimBoolean:
os << StringPrintf("%s (0x%x)\n", field->GetBoolean(obj)? "true" : "false",
field->GetBoolean(obj));
- } else if (type->IsPrimitiveByte()) {
+ break;
+ case Primitive::kPrimByte:
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
- // to cause class loading.
- mirror::Object* value = field->GetObj(obj);
- if (value == nullptr) {
- os << StringPrintf("null %s\n", PrettyDescriptor(descriptor).c_str());
- } else {
- // Grab the field type without causing resolution.
- StackHandleScope<1> hs(Thread::Current());
- FieldHelper fh(hs.NewHandle(field));
- mirror::Class* field_type = fh.GetType(false);
- if (field_type != nullptr) {
- PrettyObjectValue(os, field_type, value);
+ break;
+ case Primitive::kPrimNot: {
+ // Get the value, don't compute the type unless it is non-null as we don't want
+ // to cause class loading.
+ mirror::Object* value = field->GetObj(obj);
+ if (value == nullptr) {
+ os << StringPrintf("null %s\n", PrettyDescriptor(field->GetTypeDescriptor()).c_str());
} else {
- os << StringPrintf("%p %s\n", value, PrettyDescriptor(descriptor).c_str());
+ // Grab the field type without causing resolution.
+ mirror::Class* field_type = field->GetType(false);
+ if (field_type != nullptr) {
+ PrettyObjectValue(os, field_type, value);
+ } else {
+ os << StringPrintf("%p %s\n", value,
+ PrettyDescriptor(field->GetTypeDescriptor()).c_str());
+ }
}
+ break;
}
+ default:
+ os << "unexpected field type: " << field->GetTypeDescriptor() << "\n";
+ break;
}
}