Rename RawDexFile to DexFile
Change-Id: I4d0cd3885cf21a7b3dcad05c4d667d7ebd44378b
diff --git a/src/class_linker.cc b/src/class_linker.cc
index bacc9a3..04f703b 100644
--- a/src/class_linker.cc
+++ b/src/class_linker.cc
@@ -20,14 +20,14 @@
namespace art {
-ClassLinker* ClassLinker::Create(std::vector<RawDexFile*> boot_class_path) {
+ClassLinker* ClassLinker::Create(std::vector<DexFile*> boot_class_path) {
scoped_ptr<ClassLinker> class_linker(new ClassLinker);
class_linker->Init(boot_class_path);
// TODO: check for failure during initialization
return class_linker.release();
}
-void ClassLinker::Init(std::vector<RawDexFile*> boot_class_path) {
+void ClassLinker::Init(std::vector<DexFile*> boot_class_path) {
// setup boot_class_path_ so that object_array_class_ can be properly initialized
for (size_t i = 0; i != boot_class_path.size(); ++i) {
@@ -117,7 +117,7 @@
Class* ClassLinker::FindClass(const StringPiece& descriptor,
Object* class_loader,
- const RawDexFile* raw_dex_file) {
+ const DexFile* dex_file) {
Thread* self = Thread::Current();
DCHECK(self != NULL);
CHECK(!self->IsExceptionPending());
@@ -126,28 +126,28 @@
if (klass == NULL) {
// Class is not yet loaded.
if (descriptor[0] == '[') {
- return CreateArrayClass(descriptor, class_loader, raw_dex_file);
+ return CreateArrayClass(descriptor, class_loader, dex_file);
}
ClassPathEntry pair;
- if (raw_dex_file == NULL) {
+ if (dex_file == NULL) {
pair = FindInBootClassPath(descriptor);
} else {
- pair.first = raw_dex_file;
- pair.second = raw_dex_file->FindClassDef(descriptor);
+ pair.first = dex_file;
+ pair.second = dex_file->FindClassDef(descriptor);
}
if (pair.second == NULL) {
LG << "Class " << descriptor << " not found"; // TODO: NoClassDefFoundError
return NULL;
}
- const RawDexFile* raw_dex_file = pair.first;
- const RawDexFile::ClassDef* class_def = pair.second;
- DexCache* dex_cache = FindDexCache(raw_dex_file);
+ const DexFile* dex_file = pair.first;
+ const DexFile::ClassDef* dex_class_def = pair.second;
+ DexCache* dex_cache = FindDexCache(dex_file);
// Load the class from the dex file.
if (descriptor == "Ljava/lang/Object;") {
klass = java_lang_Object_;
klass->dex_cache_ = dex_cache;
klass->object_size_ = sizeof(Object);
- char_array_class_->super_class_idx_ = class_def->class_idx_;
+ char_array_class_->super_class_idx_ = dex_class_def->class_idx_;
} else if (descriptor == "Ljava/lang/Class;") {
klass = java_lang_Class_;
klass->dex_cache_ = dex_cache;
@@ -173,7 +173,7 @@
} else {
klass = AllocClass(dex_cache);
}
- LoadClass(*raw_dex_file, *class_def, klass);
+ LoadClass(*dex_file, *dex_class_def, klass);
// Check for a pending exception during load
if (self->IsExceptionPending()) {
// TODO: free native allocations in klass
@@ -192,7 +192,7 @@
CHECK(klass != NULL);
} else {
// Link the class.
- if (!LinkClass(klass, raw_dex_file)) {
+ if (!LinkClass(klass, dex_file)) {
// Linking failed.
// TODO: CHECK(self->IsExceptionPending());
lock.NotifyAll();
@@ -223,37 +223,37 @@
return klass;
}
-void ClassLinker::LoadClass(const RawDexFile& raw_dex_file,
- const RawDexFile::ClassDef& class_def,
+void ClassLinker::LoadClass(const DexFile& dex_file,
+ const DexFile::ClassDef& dex_class_def,
Class* klass) {
CHECK(klass != NULL);
CHECK(klass->dex_cache_ != NULL);
- const byte* class_data = raw_dex_file.GetClassData(class_def);
- RawDexFile::ClassDataHeader header = raw_dex_file.ReadClassDataHeader(&class_data);
+ const byte* class_data = dex_file.GetClassData(dex_class_def);
+ DexFile::ClassDataHeader header = dex_file.ReadClassDataHeader(&class_data);
- const char* descriptor = raw_dex_file.GetClassDescriptor(class_def);
+ const char* descriptor = dex_file.GetClassDescriptor(dex_class_def);
CHECK(descriptor != NULL);
klass->klass_ = java_lang_Class_;
klass->descriptor_.set(descriptor);
klass->descriptor_alloc_ = NULL;
- klass->access_flags_ = class_def.access_flags_;
+ klass->access_flags_ = dex_class_def.access_flags_;
klass->class_loader_ = NULL; // TODO
klass->primitive_type_ = Class::kPrimNot;
klass->status_ = Class::kStatusIdx;
klass->super_class_ = NULL;
- klass->super_class_idx_ = class_def.superclass_idx_;
+ klass->super_class_idx_ = dex_class_def.superclass_idx_;
klass->num_static_fields_ = header.static_fields_size_;
klass->num_instance_fields_ = header.instance_fields_size_;
klass->num_direct_methods_ = header.direct_methods_size_;
klass->num_virtual_methods_ = header.virtual_methods_size_;
- klass->source_file_ = raw_dex_file.dexGetSourceFile(class_def);
+ klass->source_file_ = dex_file.dexGetSourceFile(dex_class_def);
// Load class interfaces.
- LoadInterfaces(raw_dex_file, class_def, klass);
+ LoadInterfaces(dex_file, dex_class_def, klass);
// Load static fields.
if (klass->NumStaticFields() != 0) {
@@ -261,11 +261,11 @@
klass->sfields_ = new StaticField*[klass->NumStaticFields()]();
uint32_t last_idx = 0;
for (size_t i = 0; i < klass->NumStaticFields(); ++i) {
- RawDexFile::Field raw_field;
- raw_dex_file.dexReadClassDataField(&class_data, &raw_field, &last_idx);
+ DexFile::Field dex_field;
+ dex_file.dexReadClassDataField(&class_data, &dex_field, &last_idx);
StaticField* sfield = AllocStaticField();
klass->sfields_[i] = sfield;
- LoadField(raw_dex_file, raw_field, klass, sfield);
+ LoadField(dex_file, dex_field, klass, sfield);
}
}
@@ -275,11 +275,11 @@
klass->ifields_ = new InstanceField*[klass->NumInstanceFields()]();
uint32_t last_idx = 0;
for (size_t i = 0; i < klass->NumInstanceFields(); ++i) {
- RawDexFile::Field raw_field;
- raw_dex_file.dexReadClassDataField(&class_data, &raw_field, &last_idx);
+ DexFile::Field dex_field;
+ dex_file.dexReadClassDataField(&class_data, &dex_field, &last_idx);
InstanceField* ifield = AllocInstanceField();
klass->ifields_[i] = ifield;
- LoadField(raw_dex_file, raw_field, klass, ifield);
+ LoadField(dex_file, dex_field, klass, ifield);
}
}
@@ -289,11 +289,11 @@
klass->direct_methods_ = new Method*[klass->NumDirectMethods()]();
uint32_t last_idx = 0;
for (size_t i = 0; i < klass->NumDirectMethods(); ++i) {
- RawDexFile::Method raw_method;
- raw_dex_file.dexReadClassDataMethod(&class_data, &raw_method, &last_idx);
+ DexFile::Method dex_method;
+ dex_file.dexReadClassDataMethod(&class_data, &dex_method, &last_idx);
Method* meth = AllocMethod();
klass->direct_methods_[i] = meth;
- LoadMethod(raw_dex_file, raw_method, klass, meth);
+ LoadMethod(dex_file, dex_method, klass, meth);
// TODO: register maps
}
}
@@ -304,56 +304,56 @@
klass->virtual_methods_ = new Method*[klass->NumVirtualMethods()]();
uint32_t last_idx = 0;
for (size_t i = 0; i < klass->NumVirtualMethods(); ++i) {
- RawDexFile::Method raw_method;
- raw_dex_file.dexReadClassDataMethod(&class_data, &raw_method, &last_idx);
+ DexFile::Method dex_method;
+ dex_file.dexReadClassDataMethod(&class_data, &dex_method, &last_idx);
Method* meth = AllocMethod();
klass->virtual_methods_[i] = meth;
- LoadMethod(raw_dex_file, raw_method, klass, meth);
+ LoadMethod(dex_file, dex_method, klass, meth);
// TODO: register maps
}
}
}
-void ClassLinker::LoadInterfaces(const RawDexFile& raw_dex_file,
- const RawDexFile::ClassDef& class_def,
+void ClassLinker::LoadInterfaces(const DexFile& dex_file,
+ const DexFile::ClassDef& dex_class_def,
Class* klass) {
- const RawDexFile::TypeList* list = raw_dex_file.GetInterfacesList(class_def);
+ const DexFile::TypeList* list = dex_file.GetInterfacesList(dex_class_def);
if (list != NULL) {
klass->interface_count_ = list->Size();
// TODO: allocate the interfaces array on the object heap.
klass->interfaces_ = new Class*[list->Size()]();
for (size_t i = 0; i < list->Size(); ++i) {
- const RawDexFile::TypeItem& type_item = list->GetTypeItem(i);
+ const DexFile::TypeItem& type_item = list->GetTypeItem(i);
klass->interfaces_[i] = reinterpret_cast<Class*>(type_item.type_idx_);
}
}
}
-void ClassLinker::LoadField(const RawDexFile& raw_dex_file,
- const RawDexFile::Field& src,
+void ClassLinker::LoadField(const DexFile& dex_file,
+ const DexFile::Field& src,
Class* klass,
Field* dst) {
- const RawDexFile::FieldId& field_id = raw_dex_file.GetFieldId(src.field_idx_);
+ const DexFile::FieldId& field_id = dex_file.GetFieldId(src.field_idx_);
dst->klass_ = klass;
- dst->name_ = raw_dex_file.dexStringById(field_id.name_idx_);
- dst->signature_ = raw_dex_file.dexStringByTypeIdx(field_id.type_idx_);
+ dst->name_ = dex_file.dexStringById(field_id.name_idx_);
+ dst->signature_ = dex_file.dexStringByTypeIdx(field_id.type_idx_);
dst->access_flags_ = src.access_flags_;
}
-void ClassLinker::LoadMethod(const RawDexFile& raw_dex_file,
- const RawDexFile::Method& src,
+void ClassLinker::LoadMethod(const DexFile& dex_file,
+ const DexFile::Method& src,
Class* klass,
Method* dst) {
- const RawDexFile::MethodId& method_id = raw_dex_file.GetMethodId(src.method_idx_);
+ const DexFile::MethodId& method_id = dex_file.GetMethodId(src.method_idx_);
dst->klass_ = klass;
- dst->name_.set(raw_dex_file.dexStringById(method_id.name_idx_));
+ dst->name_.set(dex_file.dexStringById(method_id.name_idx_));
dst->proto_idx_ = method_id.proto_idx_;
- dst->shorty_.set(raw_dex_file.GetShorty(method_id.proto_idx_));
+ dst->shorty_.set(dex_file.GetShorty(method_id.proto_idx_));
dst->access_flags_ = src.access_flags_;
// TODO: check for finalize method
- const RawDexFile::CodeItem* code_item = raw_dex_file.GetCodeItem(src);
+ const DexFile::CodeItem* code_item = dex_file.GetCodeItem(src);
if (code_item != NULL) {
dst->num_registers_ = code_item->registers_size_;
dst->num_ins_ = code_item->ins_size_;
@@ -371,46 +371,46 @@
ClassLinker::ClassPathEntry ClassLinker::FindInBootClassPath(const StringPiece& descriptor) {
for (size_t i = 0; i != boot_class_path_.size(); ++i) {
- RawDexFile* raw_dex_file = boot_class_path_[i];
- const RawDexFile::ClassDef* class_def = raw_dex_file->FindClassDef(descriptor);
- if (class_def != NULL) {
- return ClassPathEntry(raw_dex_file, class_def);
+ DexFile* dex_file = boot_class_path_[i];
+ const DexFile::ClassDef* dex_class_def = dex_file->FindClassDef(descriptor);
+ if (dex_class_def != NULL) {
+ return ClassPathEntry(dex_file, dex_class_def);
}
}
return ClassPathEntry(NULL, NULL);
}
-void ClassLinker::AppendToBootClassPath(RawDexFile* raw_dex_file) {
- boot_class_path_.push_back(raw_dex_file);
- RegisterDexFile(raw_dex_file);
+void ClassLinker::AppendToBootClassPath(DexFile* dex_file) {
+ boot_class_path_.push_back(dex_file);
+ RegisterDexFile(dex_file);
}
-void ClassLinker::RegisterDexFile(RawDexFile* raw_dex_file) {
- raw_dex_files_.push_back(raw_dex_file);
+void ClassLinker::RegisterDexFile(DexFile* dex_file) {
+ dex_files_.push_back(dex_file);
DexCache* dex_cache = AllocDexCache();
CHECK(dex_cache != NULL);
- dex_cache->Init(AllocObjectArray(raw_dex_file->NumStringIds()),
- AllocObjectArray(raw_dex_file->NumTypeIds()),
- AllocObjectArray(raw_dex_file->NumMethodIds()),
- AllocObjectArray(raw_dex_file->NumFieldIds()));
+ dex_cache->Init(AllocObjectArray(dex_file->NumStringIds()),
+ AllocObjectArray(dex_file->NumTypeIds()),
+ AllocObjectArray(dex_file->NumMethodIds()),
+ AllocObjectArray(dex_file->NumFieldIds()));
dex_caches_.push_back(dex_cache);
}
-const RawDexFile* ClassLinker::FindRawDexFile(const DexCache* dex_cache) const {
+const DexFile* ClassLinker::FindDexFile(const DexCache* dex_cache) const {
CHECK(dex_cache != NULL);
for (size_t i = 0; i != dex_caches_.size(); ++i) {
if (dex_caches_[i] == dex_cache) {
- return raw_dex_files_[i];
+ return dex_files_[i];
}
}
- CHECK(false) << "Could not find RawDexFile";
+ CHECK(false) << "Could not find DexFile";
return NULL;
}
-DexCache* ClassLinker::FindDexCache(const RawDexFile* raw_dex_file) const {
- CHECK(raw_dex_file != NULL);
- for (size_t i = 0; i != raw_dex_files_.size(); ++i) {
- if (raw_dex_files_[i] == raw_dex_file) {
+DexCache* ClassLinker::FindDexCache(const DexFile* dex_file) const {
+ CHECK(dex_file != NULL);
+ for (size_t i = 0; i != dex_files_.size(); ++i) {
+ if (dex_files_[i] == dex_file) {
return dex_caches_[i];
}
}
@@ -446,7 +446,7 @@
// Returns NULL with an exception raised on failure.
Class* ClassLinker::CreateArrayClass(const StringPiece& descriptor,
Object* class_loader,
- const RawDexFile* raw_dex_file)
+ const DexFile* dex_file)
{
CHECK(descriptor[0] == '[');
DCHECK(java_lang_Class_ != NULL);
@@ -457,7 +457,7 @@
int array_rank;
if (descriptor[1] == '[') {
// array of arrays; keep descriptor and grab stuff from parent
- Class* outer = FindClass(descriptor.substr(1), class_loader, raw_dex_file);
+ Class* outer = FindClass(descriptor.substr(1), class_loader, dex_file);
if (outer != NULL) {
// want the base class, not "outer", in our component_type_
component_type_ = outer->component_type_;
@@ -470,7 +470,7 @@
if (descriptor[1] == 'L') {
// array of objects; strip off "[" and look up descriptor.
const StringPiece subDescriptor = descriptor.substr(1);
- component_type_ = FindClass(subDescriptor, class_loader, raw_dex_file);
+ component_type_ = FindClass(subDescriptor, class_loader, dex_file);
} else {
// array of a primitive type
component_type_ = FindPrimitiveClass(descriptor[1]);
@@ -799,10 +799,10 @@
bool ClassLinker::HasSameMethodDescriptorClasses(const Method* method,
const Class* klass1,
const Class* klass2) {
- const RawDexFile* raw = FindRawDexFile(method->GetClass()->GetDexCache());
- const RawDexFile::ProtoId& proto_id = raw->GetProtoId(method->proto_idx_);
- RawDexFile::ParameterIterator *it;
- for (it = raw->GetParameterIterator(proto_id); it->HasNext(); it->Next()) {
+ const DexFile* dex_file = FindDexFile(method->GetClass()->GetDexCache());
+ const DexFile::ProtoId& proto_id = dex_file->GetProtoId(method->proto_idx_);
+ DexFile::ParameterIterator *it;
+ for (it = dex_file->GetParameterIterator(proto_id); it->HasNext(); it->Next()) {
const char* descriptor = it->GetDescriptor();
if (descriptor == NULL) {
break;
@@ -815,7 +815,7 @@
}
}
// Check the return type
- const char* descriptor = raw->GetReturnTypeDescriptor(proto_id);
+ const char* descriptor = dex_file->GetReturnTypeDescriptor(proto_id);
if (descriptor[0] == 'L' || descriptor[0] == '[') {
if (HasSameDescriptorClasses(descriptor, klass1, klass2)) {
return false;
@@ -851,14 +851,14 @@
}
bool ClassLinker::HasSameArgumentTypes(const Method* m1, const Method* m2) const {
- const RawDexFile* raw1 = FindRawDexFile(m1->GetClass()->GetDexCache());
- const RawDexFile* raw2 = FindRawDexFile(m2->GetClass()->GetDexCache());
- const RawDexFile::ProtoId& proto1 = raw1->GetProtoId(m1->proto_idx_);
- const RawDexFile::ProtoId& proto2 = raw2->GetProtoId(m2->proto_idx_);
+ const DexFile* dex1 = FindDexFile(m1->GetClass()->GetDexCache());
+ const DexFile* dex2 = FindDexFile(m2->GetClass()->GetDexCache());
+ const DexFile::ProtoId& proto1 = dex1->GetProtoId(m1->proto_idx_);
+ const DexFile::ProtoId& proto2 = dex2->GetProtoId(m2->proto_idx_);
// TODO: compare ProtoId objects for equality and exit early
- const RawDexFile::TypeList* type_list1 = raw1->GetProtoParameters(proto1);
- const RawDexFile::TypeList* type_list2 = raw2->GetProtoParameters(proto2);
+ const DexFile::TypeList* type_list1 = dex1->GetProtoParameters(proto1);
+ const DexFile::TypeList* type_list2 = dex2->GetProtoParameters(proto2);
size_t arity1 = (type_list1 == NULL) ? 0 : type_list1->Size();
size_t arity2 = (type_list2 == NULL) ? 0 : type_list2->Size();
if (arity1 != arity2) {
@@ -868,8 +868,8 @@
for (size_t i = 0; i < arity1; ++i) {
uint32_t type_idx1 = type_list1->GetTypeItem(i).type_idx_;
uint32_t type_idx2 = type_list2->GetTypeItem(i).type_idx_;
- const char* type1 = raw1->dexStringByTypeIdx(type_idx1);
- const char* type2 = raw2->dexStringByTypeIdx(type_idx2);
+ const char* type1 = dex1->dexStringByTypeIdx(type_idx1);
+ const char* type2 = dex2->dexStringByTypeIdx(type_idx2);
if (strcmp(type1, type2) != 0) {
return false;
}
@@ -879,12 +879,12 @@
}
bool ClassLinker::HasSameReturnType(const Method* m1, const Method* m2) const {
- const RawDexFile* raw1 = FindRawDexFile(m1->GetClass()->GetDexCache());
- const RawDexFile* raw2 = FindRawDexFile(m2->GetClass()->GetDexCache());
- const RawDexFile::ProtoId& proto1 = raw1->GetProtoId(m1->proto_idx_);
- const RawDexFile::ProtoId& proto2 = raw2->GetProtoId(m2->proto_idx_);
- const char* type1 = raw1->dexStringByTypeIdx(proto1.return_type_idx_);
- const char* type2 = raw2->dexStringByTypeIdx(proto2.return_type_idx_);
+ const DexFile* dex1 = FindDexFile(m1->GetClass()->GetDexCache());
+ const DexFile* dex2 = FindDexFile(m2->GetClass()->GetDexCache());
+ const DexFile::ProtoId& proto1 = dex1->GetProtoId(m1->proto_idx_);
+ const DexFile::ProtoId& proto2 = dex2->GetProtoId(m2->proto_idx_);
+ const char* type1 = dex1->dexStringByTypeIdx(proto1.return_type_idx_);
+ const char* type2 = dex2->dexStringByTypeIdx(proto2.return_type_idx_);
return (strcmp(type1, type2) == 0);
}
@@ -914,52 +914,52 @@
if (num_static_fields == 0) {
return;
}
- DexCache* dex_file = klass->GetDexCache();
- if (dex_file == NULL) {
+ DexCache* dex_cache = klass->GetDexCache();
+ if (dex_cache == NULL) {
return;
}
const StringPiece& descriptor = klass->GetDescriptor();
- const RawDexFile* raw = FindRawDexFile(dex_file);
- const RawDexFile::ClassDef* class_def = raw->FindClassDef(descriptor);
- CHECK(class_def != NULL);
- const byte* addr = raw->GetEncodedArray(*class_def);
+ const DexFile* dex_file = FindDexFile(dex_cache);
+ const DexFile::ClassDef* dex_class_def = dex_file->FindClassDef(descriptor);
+ CHECK(dex_class_def != NULL);
+ const byte* addr = dex_file->GetEncodedArray(*dex_class_def);
size_t array_size = DecodeUnsignedLeb128(&addr);
for (size_t i = 0; i < array_size; ++i) {
StaticField* field = klass->GetStaticField(i);
JValue value;
- RawDexFile::ValueType type = raw->ReadEncodedValue(&addr, &value);
+ DexFile::ValueType type = dex_file->ReadEncodedValue(&addr, &value);
switch (type) {
- case RawDexFile::kByte:
+ case DexFile::kByte:
field->SetByte(value.b);
break;
- case RawDexFile::kShort:
+ case DexFile::kShort:
field->SetShort(value.s);
break;
- case RawDexFile::kChar:
+ case DexFile::kChar:
field->SetChar(value.c);
break;
- case RawDexFile::kInt:
+ case DexFile::kInt:
field->SetInt(value.i);
break;
- case RawDexFile::kLong:
+ case DexFile::kLong:
field->SetLong(value.j);
break;
- case RawDexFile::kFloat:
+ case DexFile::kFloat:
field->SetFloat(value.f);
break;
- case RawDexFile::kDouble:
+ case DexFile::kDouble:
field->SetDouble(value.d);
break;
- case RawDexFile::kString: {
+ case DexFile::kString: {
uint32_t string_idx = value.i;
String* resolved = ResolveString(klass, string_idx);
field->SetObject(resolved);
break;
}
- case RawDexFile::kBoolean:
+ case DexFile::kBoolean:
field->SetBoolean(value.z);
break;
- case RawDexFile::kNull:
+ case DexFile::kNull:
field->SetObject(value.l);
break;
default:
@@ -968,11 +968,11 @@
}
}
-bool ClassLinker::LinkClass(Class* klass, const RawDexFile* raw_dex_file) {
+bool ClassLinker::LinkClass(Class* klass, const DexFile* dex_file) {
CHECK(klass->status_ == Class::kStatusIdx ||
klass->status_ == Class::kStatusLoaded);
if (klass->status_ == Class::kStatusIdx) {
- if (!LinkInterfaces(klass, raw_dex_file)) {
+ if (!LinkInterfaces(klass, dex_file)) {
return false;
}
}
@@ -991,7 +991,7 @@
return true;
}
-bool ClassLinker::LinkInterfaces(Class* klass, const RawDexFile* raw_dex_file) {
+bool ClassLinker::LinkInterfaces(Class* klass, const DexFile* dex_file) {
scoped_array<uint32_t> interfaces_idx;
// TODO: store interfaces_idx in the Class object
// TODO: move this outside of link interfaces
@@ -1003,8 +1003,8 @@
}
// Mark the class as loaded.
klass->status_ = Class::kStatusLoaded;
- if (klass->super_class_idx_ != RawDexFile::kDexNoIndex) {
- Class* super_class = ResolveClass(klass, klass->super_class_idx_, raw_dex_file);
+ if (klass->super_class_idx_ != DexFile::kDexNoIndex) {
+ Class* super_class = ResolveClass(klass, klass->super_class_idx_, dex_file);
if (super_class == NULL) {
LG << "Failed to resolve superclass";
return false;
@@ -1014,7 +1014,7 @@
if (klass->interface_count_ > 0) {
for (size_t i = 0; i < klass->interface_count_; ++i) {
uint32_t idx = interfaces_idx[i];
- klass->interfaces_[i] = ResolveClass(klass, idx, raw_dex_file);
+ klass->interfaces_[i] = ResolveClass(klass, idx, dex_file);
if (klass->interfaces_[i] == NULL) {
LG << "Failed to resolve interface";
return false;
@@ -1453,17 +1453,17 @@
Class* ClassLinker::ResolveClass(const Class* referrer,
uint32_t class_idx,
- const RawDexFile* raw_dex_file) {
+ const DexFile* dex_file) {
DexCache* dex_cache = referrer->GetDexCache();
Class* resolved = dex_cache->GetResolvedClass(class_idx);
if (resolved != NULL) {
return resolved;
}
- const char* descriptor = raw_dex_file->dexStringByTypeIdx(class_idx);
+ const char* descriptor = dex_file->dexStringByTypeIdx(class_idx);
if (descriptor[0] != '\0' && descriptor[1] == '\0') {
resolved = FindPrimitiveClass(descriptor[0]);
} else {
- resolved = FindClass(descriptor, referrer->GetClassLoader(), raw_dex_file);
+ resolved = FindClass(descriptor, referrer->GetClassLoader(), dex_file);
}
if (resolved != NULL) {
Class* check = resolved->IsArray() ? resolved->component_type_ : resolved;
@@ -1488,9 +1488,9 @@
String* ClassLinker::ResolveString(const Class* referring,
uint32_t string_idx) {
- const RawDexFile* raw = FindRawDexFile(referring->GetDexCache());
- const RawDexFile::StringId& string_id = raw->GetStringId(string_idx);
- const char* string_data = raw->GetStringData(string_id);
+ const DexFile* dex_file = FindDexFile(referring->GetDexCache());
+ const DexFile::StringId& string_id = dex_file->GetStringId(string_idx);
+ const char* string_data = dex_file->GetStringData(string_id);
String* new_string = Heap::AllocStringFromModifiedUtf8(java_lang_String_,
char_array_class_,
string_data);
diff --git a/src/class_linker.h b/src/class_linker.h
index 9d6c53e..ee56595 100644
--- a/src/class_linker.h
+++ b/src/class_linker.h
@@ -18,7 +18,7 @@
class ClassLinker {
public:
// Initializes the class linker.
- static ClassLinker* Create(std::vector<RawDexFile*> boot_class_path);
+ static ClassLinker* Create(std::vector<DexFile*> boot_class_path);
~ClassLinker() {}
@@ -30,10 +30,10 @@
ObjectArray* AllocObjectArray(size_t length);
// Finds a class by its descriptor name.
- // If raw_dex_file is null, searches boot_class_path_.
+ // If dex_file is null, searches boot_class_path_.
Class* FindClass(const StringPiece& descriptor,
Object* class_loader,
- const RawDexFile* raw_dex_file);
+ const DexFile* dex_file);
Class* FindSystemClass(const StringPiece& descriptor) {
return FindClass(descriptor, NULL, NULL);
@@ -45,50 +45,50 @@
Class* ResolveClass(const Class* referring,
uint32_t class_idx,
- const RawDexFile* raw_dex_file);
+ const DexFile* dex_file);
String* ResolveString(const Class* referring, uint32_t string_idx);
- void RegisterDexFile(RawDexFile* raw_dex_file);
+ void RegisterDexFile(DexFile* dex_file);
private:
ClassLinker() {}
- void Init(std::vector<RawDexFile*> boot_class_path_);
+ void Init(std::vector<DexFile*> boot_class_path_);
Class* CreatePrimitiveClass(const StringPiece& descriptor);
Class* CreateArrayClass(const StringPiece& descriptor,
Object* class_loader,
- const RawDexFile* raw_dex_file);
+ const DexFile* dex_file);
Class* FindPrimitiveClass(char type);
- const RawDexFile* FindRawDexFile(const DexCache* dex_file) const;
+ const DexFile* FindDexFile(const DexCache* dex_cache) const;
- DexCache* FindDexCache(const RawDexFile* raw_dex_file) const;
+ DexCache* FindDexCache(const DexFile* dex_file) const;
- typedef std::pair<const RawDexFile*, const RawDexFile::ClassDef*> ClassPathEntry;
+ typedef std::pair<const DexFile*, const DexFile::ClassDef*> ClassPathEntry;
- void AppendToBootClassPath(RawDexFile* raw_dex_file);
+ void AppendToBootClassPath(DexFile* dex_file);
ClassPathEntry FindInBootClassPath(const StringPiece& descriptor);
- void LoadClass(const RawDexFile& raw_dex_file,
- const RawDexFile::ClassDef& class_def,
+ void LoadClass(const DexFile& dex_file,
+ const DexFile::ClassDef& dex_class_def,
Class* klass);
- void LoadInterfaces(const RawDexFile& raw_dex_file,
- const RawDexFile::ClassDef& class_def,
+ void LoadInterfaces(const DexFile& dex_file,
+ const DexFile::ClassDef& dex_class_def,
Class *klass);
- void LoadField(const RawDexFile& raw_dex_file,
- const RawDexFile::Field& src,
+ void LoadField(const DexFile& dex_file,
+ const DexFile::Field& dex_field,
Class* klass,
Field* dst);
- void LoadMethod(const RawDexFile& raw_dex_file,
- const RawDexFile::Method& src,
+ void LoadMethod(const DexFile& dex_file,
+ const DexFile::Method& dex_method,
Class* klass,
Method* dst);
@@ -126,11 +126,11 @@
bool HasSameArgumentTypes(const Method* m1, const Method* m2) const;
- bool LinkClass(Class* klass, const RawDexFile* raw_dex_file);
+ bool LinkClass(Class* klass, const DexFile* dex_file);
bool LinkSuperClass(Class* klass);
- bool LinkInterfaces(Class* klass, const RawDexFile* raw_dex_file);
+ bool LinkInterfaces(Class* klass, const DexFile* dex_file);
bool LinkMethods(Class* klass);
@@ -144,9 +144,9 @@
void CreateReferenceOffsets(Class* klass);
- std::vector<RawDexFile*> boot_class_path_;
+ std::vector<DexFile*> boot_class_path_;
- std::vector<RawDexFile*> raw_dex_files_;
+ std::vector<DexFile*> dex_files_;
std::vector<DexCache*> dex_caches_;
diff --git a/src/class_linker_test.cc b/src/class_linker_test.cc
index a128445..938b6fe 100644
--- a/src/class_linker_test.cc
+++ b/src/class_linker_test.cc
@@ -82,7 +82,7 @@
}
TEST_F(ClassLinkerTest, FindClassNested) {
- scoped_ptr<RawDexFile> nestedDex(OpenRawDexFileBase64(kNestedDex));
+ scoped_ptr<DexFile> nestedDex(OpenDexFileBase64(kNestedDex));
class_linker_.get()->RegisterDexFile(nestedDex.get());
Class* outer = class_linker_.get()->FindClass("LNested;", NULL, nestedDex.get());
@@ -135,7 +135,7 @@
EXPECT_EQ(0U, JavaLangObject->interface_count_);
- scoped_ptr<RawDexFile> dex(OpenRawDexFileBase64(kMyClassDex));
+ scoped_ptr<DexFile> dex(OpenDexFileBase64(kMyClassDex));
linker->RegisterDexFile(dex.get());
EXPECT_TRUE(linker->FindSystemClass("LMyClass;") == NULL);
Class* MyClass = linker->FindClass("LMyClass;", NULL, dex.get());
@@ -178,7 +178,7 @@
TEST_F(ClassLinkerTest, ProtoCompare) {
ClassLinker* linker = class_linker_.get();
- scoped_ptr<RawDexFile> proto_dex_file(OpenRawDexFileBase64(kProtoCompareDex));
+ scoped_ptr<DexFile> proto_dex_file(OpenDexFileBase64(kProtoCompareDex));
linker->RegisterDexFile(proto_dex_file.get());
Class* klass = linker->FindClass("LProtoCompare;", NULL, proto_dex_file.get());
@@ -232,9 +232,9 @@
TEST_F(ClassLinkerTest, ProtoCompare2) {
ClassLinker* linker = class_linker_.get();
- scoped_ptr<RawDexFile> proto1_dex_file(OpenRawDexFileBase64(kProtoCompareDex));
+ scoped_ptr<DexFile> proto1_dex_file(OpenDexFileBase64(kProtoCompareDex));
linker->RegisterDexFile(proto1_dex_file.get());
- scoped_ptr<RawDexFile> proto2_dex_file(OpenRawDexFileBase64(kProtoCompare2Dex));
+ scoped_ptr<DexFile> proto2_dex_file(OpenDexFileBase64(kProtoCompare2Dex));
linker->RegisterDexFile(proto2_dex_file.get());
Class* klass1 = linker->FindClass("LProtoCompare;", NULL, proto1_dex_file.get());
diff --git a/src/common_test.h b/src/common_test.h
index 26a4348..96834b1 100644
--- a/src/common_test.h
+++ b/src/common_test.h
@@ -145,14 +145,14 @@
"AAAACQAAAAwBAAAGAAAAAgAAAFQBAAABIAAAAgAAAJQBAAABEAAABAAAAMABAAACIAAAEwAAAOIB"
"AAADIAAAAgAAAHUCAAAAIAAAAgAAAH8CAAAAEAAAAQAAALACAAA=";
-static inline RawDexFile* OpenRawDexFileBase64(const char* base64) {
+static inline DexFile* OpenDexFileBase64(const char* base64) {
CHECK(base64 != NULL);
size_t length;
- byte* dex_file = DecodeBase64(base64, &length);
+ byte* dex_bytes = DecodeBase64(base64, &length);
+ CHECK(dex_bytes != NULL);
+ DexFile* dex_file = DexFile::OpenPtr(dex_bytes, length);
CHECK(dex_file != NULL);
- RawDexFile* raw_dex_file = RawDexFile::OpenPtr(dex_file, length);
- CHECK(raw_dex_file != NULL);
- return raw_dex_file;
+ return dex_file;
}
class RuntimeTest : public testing::Test {
@@ -162,10 +162,10 @@
ASSERT_TRUE(Thread::Attach() != NULL);
ASSERT_TRUE(Heap::Init());
- java_lang_raw_dex_file_.reset(OpenRawDexFileBase64(kJavaLangDex));
+ java_lang_dex_file_.reset(OpenDexFileBase64(kJavaLangDex));
- std::vector<RawDexFile*> boot_class_path;
- boot_class_path.push_back(java_lang_raw_dex_file_.get());
+ std::vector<DexFile*> boot_class_path;
+ boot_class_path.push_back(java_lang_dex_file_.get());
class_linker_.reset(ClassLinker::Create(boot_class_path));
CHECK(class_linker_ != NULL);
@@ -175,7 +175,7 @@
Heap::Destroy();
}
- scoped_ptr<RawDexFile> java_lang_raw_dex_file_;
+ scoped_ptr<DexFile> java_lang_dex_file_;
scoped_ptr<ClassLinker> class_linker_;
};
diff --git a/src/dex_file.cc b/src/dex_file.cc
index 506ae39..a5ac01b 100644
--- a/src/dex_file.cc
+++ b/src/dex_file.cc
@@ -17,24 +17,24 @@
namespace art {
-const byte RawDexFile::kDexMagic[] = { 'd', 'e', 'x', '\n' };
-const byte RawDexFile::kDexMagicVersion[] = { '0', '3', '5', '\0' };
+const byte DexFile::kDexMagic[] = { 'd', 'e', 'x', '\n' };
+const byte DexFile::kDexMagicVersion[] = { '0', '3', '5', '\0' };
-RawDexFile::Closer::~Closer() {}
+DexFile::Closer::~Closer() {}
-RawDexFile::MmapCloser::MmapCloser(void* addr, size_t length) : addr_(addr), length_(length) {
+DexFile::MmapCloser::MmapCloser(void* addr, size_t length) : addr_(addr), length_(length) {
CHECK(addr != NULL);
}
-RawDexFile::MmapCloser::~MmapCloser() {
+DexFile::MmapCloser::~MmapCloser() {
if (munmap(addr_, length_) == -1) {
PLOG(INFO) << "munmap failed";
}
}
-RawDexFile::PtrCloser::PtrCloser(byte* addr) : addr_(addr) {}
-RawDexFile::PtrCloser::~PtrCloser() { delete[] addr_; }
+DexFile::PtrCloser::PtrCloser(byte* addr) : addr_(addr) {}
+DexFile::PtrCloser::~PtrCloser() { delete[] addr_; }
-RawDexFile* RawDexFile::OpenFile(const char* filename) {
+DexFile* DexFile::OpenFile(const char* filename) {
CHECK(filename != NULL);
int fd = open(filename, O_RDONLY); // TODO: scoped_fd
if (fd == -1) {
@@ -61,25 +61,25 @@
return Open(dex_file, length, closer);
}
-RawDexFile* RawDexFile::OpenPtr(byte* ptr, size_t length) {
+DexFile* DexFile::OpenPtr(byte* ptr, size_t length) {
CHECK(ptr != NULL);
- RawDexFile::Closer* closer = new PtrCloser(ptr);
+ DexFile::Closer* closer = new PtrCloser(ptr);
return Open(ptr, length, closer);
}
-RawDexFile* RawDexFile::Open(const byte* dex_file, size_t length,
- Closer* closer) {
- scoped_ptr<RawDexFile> raw(new RawDexFile(dex_file, length, closer));
- if (!raw->Init()) {
+DexFile* DexFile::Open(const byte* dex_bytes, size_t length,
+ Closer* closer) {
+ scoped_ptr<DexFile> dex_file(new DexFile(dex_bytes, length, closer));
+ if (!dex_file->Init()) {
return NULL;
} else {
- return raw.release();
+ return dex_file.release();
}
}
-RawDexFile::~RawDexFile() {}
+DexFile::~DexFile() {}
-bool RawDexFile::Init() {
+bool DexFile::Init() {
InitMembers();
if (!IsMagicValid()) {
return false;
@@ -88,7 +88,7 @@
return true;
}
-void RawDexFile::InitMembers() {
+void DexFile::InitMembers() {
const byte* b = base_;
header_ = reinterpret_cast<const Header*>(b);
const Header* h = header_;
@@ -100,11 +100,11 @@
class_defs_ = reinterpret_cast<const ClassDef*>(b + h->class_defs_off_);
}
-bool RawDexFile::IsMagicValid() {
+bool DexFile::IsMagicValid() {
return CheckMagic(header_->magic_);
}
-bool RawDexFile::CheckMagic(const byte* magic) {
+bool DexFile::CheckMagic(const byte* magic) {
CHECK(magic != NULL);
if (memcmp(magic, kDexMagic, sizeof(kDexMagic)) != 0) {
LOG(WARNING) << "Unrecognized magic number:"
@@ -126,7 +126,7 @@
return true;
}
-void RawDexFile::InitIndex() {
+void DexFile::InitIndex() {
CHECK_EQ(index_.size(), 0U);
for (size_t i = 0; i < NumClassDefs(); ++i) {
const ClassDef& class_def = GetClassDef(i);
@@ -135,7 +135,7 @@
}
}
-const RawDexFile::ClassDef* RawDexFile::FindClassDef(const StringPiece& descriptor) const {
+const DexFile::ClassDef* DexFile::FindClassDef(const StringPiece& descriptor) const {
CHECK(descriptor != NULL);
Index::const_iterator it = index_.find(descriptor);
if (it == index_.end()) {
@@ -202,60 +202,60 @@
return val;
}
-RawDexFile::ValueType RawDexFile::ReadEncodedValue(const byte** stream,
- JValue* value) const {
+DexFile::ValueType DexFile::ReadEncodedValue(const byte** stream,
+ JValue* value) const {
const byte* ptr = *stream;
byte value_type = *ptr++;
byte value_arg = value_type >> kEncodedValueArgShift;
size_t width = value_arg + 1; // assume and correct later
int type = value_type & kEncodedValueTypeMask;
switch (type) {
- case RawDexFile::kByte: {
+ case DexFile::kByte: {
int32_t b = ReadSignedInt(ptr, value_arg);
CHECK(IsInt(8, b));
value->i = b;
break;
}
- case RawDexFile::kShort: {
+ case DexFile::kShort: {
int32_t s = ReadSignedInt(ptr, value_arg);
CHECK(IsInt(16, s));
value->i = s;
break;
}
- case RawDexFile::kChar: {
+ case DexFile::kChar: {
uint32_t c = ReadUnsignedInt(ptr, value_arg, false);
CHECK(IsUint(16, c));
value->i = c;
break;
}
- case RawDexFile::kInt:
+ case DexFile::kInt:
value->i = ReadSignedInt(ptr, value_arg);
break;
- case RawDexFile::kLong:
+ case DexFile::kLong:
value->j = ReadSignedLong(ptr, value_arg);
break;
- case RawDexFile::kFloat:
+ case DexFile::kFloat:
value->i = ReadUnsignedInt(ptr, value_arg, true);
break;
- case RawDexFile::kDouble:
+ case DexFile::kDouble:
value->j = ReadUnsignedLong(ptr, value_arg, true);
break;
- case RawDexFile::kBoolean:
+ case DexFile::kBoolean:
value->i = (value_arg != 0);
width = 0;
break;
- case RawDexFile::kString:
- case RawDexFile::kType:
- case RawDexFile::kMethod:
- case RawDexFile::kEnum:
+ case DexFile::kString:
+ case DexFile::kType:
+ case DexFile::kMethod:
+ case DexFile::kEnum:
value->i = ReadUnsignedInt(ptr, value_arg, false);
break;
- case RawDexFile::kField:
- case RawDexFile::kArray:
- case RawDexFile::kAnnotation:
+ case DexFile::kField:
+ case DexFile::kArray:
+ case DexFile::kAnnotation:
LOG(FATAL) << "Unimplemented";
break;
- case RawDexFile::kNull:
+ case DexFile::kNull:
value->i = 0;
width = 0;
break;
diff --git a/src/dex_file.h b/src/dex_file.h
index e677b42..4d00537 100644
--- a/src/dex_file.h
+++ b/src/dex_file.h
@@ -17,7 +17,7 @@
union JValue;
// TODO: move all of the macro functionality into the DexCache class.
-class RawDexFile {
+class DexFile {
public:
static const byte kDexMagic[];
static const byte kDexMagicVersion[];
@@ -142,9 +142,9 @@
class ParameterIterator { // TODO: stream
public:
- ParameterIterator(const RawDexFile& raw, const ProtoId& proto_id)
- : raw_(raw), size_(0), pos_(0) {
- type_list_ = raw_.GetProtoParameters(proto_id);
+ ParameterIterator(const DexFile& dex_file, const ProtoId& proto_id)
+ : dex_file_(dex_file), size_(0), pos_(0) {
+ type_list_ = dex_file_.GetProtoParameters(proto_id);
if (type_list_ != NULL) {
size_ = type_list_->Size();
}
@@ -153,10 +153,10 @@
void Next() { ++pos_; }
const char* GetDescriptor() {
uint32_t type_idx = type_list_->GetTypeItem(pos_).type_idx_;
- return raw_.dexStringByTypeIdx(type_idx);
+ return dex_file_.dexStringByTypeIdx(type_idx);
}
private:
- const RawDexFile& raw_;
+ const DexFile& dex_file_;
const TypeList* type_list_;
uint32_t size_;
uint32_t pos_;
@@ -204,13 +204,13 @@
};
// Opens a .dex file from the file system.
- static RawDexFile* OpenFile(const char* filename);
+ static DexFile* OpenFile(const char* filename);
// Opens a .dex file from a new allocated pointer
- static RawDexFile* OpenPtr(byte* ptr, size_t length);
+ static DexFile* OpenPtr(byte* ptr, size_t length);
// Closes a .dex file.
- virtual ~RawDexFile();
+ virtual ~DexFile();
const Header& GetHeader() {
CHECK(header_ != NULL);
@@ -266,7 +266,7 @@
}
}
- // Decodes the header section from the raw class data bytes.
+ // Decodes the header section from the class data bytes.
ClassDataHeader ReadClassDataHeader(const byte** class_data) const {
CHECK(class_data != NULL);
ClassDataHeader header;
@@ -394,7 +394,7 @@
// TODO: encoded_field is actually a stream of bytes
void dexReadClassDataField(const byte** encoded_field,
- RawDexFile::Field* field,
+ DexFile::Field* field,
uint32_t* last_idx) const {
uint32_t idx = *last_idx + DecodeUnsignedLeb128(encoded_field);
field->access_flags_ = DecodeUnsignedLeb128(encoded_field);
@@ -404,7 +404,7 @@
// TODO: encoded_method is actually a stream of bytes
void dexReadClassDataMethod(const byte** encoded_method,
- RawDexFile::Method* method,
+ DexFile::Method* method,
uint32_t* last_idx) const {
uint32_t idx = *last_idx + DecodeUnsignedLeb128(encoded_method);
method->access_flags_ = DecodeUnsignedLeb128(encoded_method);
@@ -456,9 +456,9 @@
};
// Opens a .dex file at a the given address.
- static RawDexFile* Open(const byte* dex_file, size_t length, Closer* closer);
+ static DexFile* Open(const byte* dex_file, size_t length, Closer* closer);
- RawDexFile(const byte* addr, size_t length, Closer* closer)
+ DexFile(const byte* addr, size_t length, Closer* closer)
: base_(addr),
length_(length),
closer_(closer),
@@ -486,7 +486,7 @@
bool IsMagicValid();
// The index of descriptors to class definitions.
- typedef std::map<const StringPiece, const RawDexFile::ClassDef*> Index;
+ typedef std::map<const StringPiece, const DexFile::ClassDef*> Index;
Index index_;
// The base address of the memory mapping.
diff --git a/src/dex_file_test.cc b/src/dex_file_test.cc
index b6a7e77..a6b5bd5 100644
--- a/src/dex_file_test.cc
+++ b/src/dex_file_test.cc
@@ -9,16 +9,16 @@
namespace art {
-TEST(RawDexFileTest, Open) {
- scoped_ptr<RawDexFile> raw(OpenRawDexFileBase64(kNestedDex));
- ASSERT_TRUE(raw != NULL);
+TEST(DexFileTest, Open) {
+ scoped_ptr<DexFile> dex(OpenDexFileBase64(kNestedDex));
+ ASSERT_TRUE(dex != NULL);
}
-TEST(RawDexFileTest, Header) {
- scoped_ptr<RawDexFile> raw(OpenRawDexFileBase64(kNestedDex));
+TEST(DexFileTest, Header) {
+ scoped_ptr<DexFile> raw(OpenDexFileBase64(kNestedDex));
ASSERT_TRUE(raw != NULL);
- const RawDexFile::Header& header = raw->GetHeader();
+ const DexFile::Header& header = raw->GetHeader();
// TODO: header.magic_
EXPECT_EQ(0x00d87910U, header.checksum_);
// TODO: header.signature_
@@ -42,15 +42,15 @@
EXPECT_EQ(320U, header.data_off_);
}
-TEST(RawDexFileTest, ClassDefs) {
- scoped_ptr<RawDexFile> raw(OpenRawDexFileBase64(kNestedDex));
+TEST(DexFileTest, ClassDefs) {
+ scoped_ptr<DexFile> raw(OpenDexFileBase64(kNestedDex));
ASSERT_TRUE(raw != NULL);
EXPECT_EQ(2U, raw->NumClassDefs());
- const RawDexFile::ClassDef& c0 = raw->GetClassDef(0);
+ const DexFile::ClassDef& c0 = raw->GetClassDef(0);
EXPECT_STREQ("LNested$Inner;", raw->GetClassDescriptor(c0));
- const RawDexFile::ClassDef& c1 = raw->GetClassDef(1);
+ const DexFile::ClassDef& c1 = raw->GetClassDef(1);
EXPECT_STREQ("LNested;", raw->GetClassDescriptor(c1));
}
diff --git a/src/jni_compiler_test.cc b/src/jni_compiler_test.cc
index c7af269..4d5e7da 100644
--- a/src/jni_compiler_test.cc
+++ b/src/jni_compiler_test.cc
@@ -19,8 +19,8 @@
virtual void SetUp() {
RuntimeTest::SetUp();
// Create runtime and attach thread
- std::vector<RawDexFile*> boot_class_path;
- boot_class_path.push_back(java_lang_raw_dex_file_.get());
+ std::vector<DexFile*> boot_class_path;
+ boot_class_path.push_back(java_lang_dex_file_.get());
runtime_ = Runtime::Create(boot_class_path);
CHECK(runtime_->AttachCurrentThread());
// Create thunk code that performs the native to managed transition
@@ -184,7 +184,7 @@
}
TEST_F(JniCompilerTest, CompileAndRunNoArgMethod) {
- scoped_ptr<RawDexFile> dex(OpenRawDexFileBase64(kMyClassNativesDex));
+ scoped_ptr<DexFile> dex(OpenDexFileBase64(kMyClassNativesDex));
class_linker_.get()->RegisterDexFile(dex.get());
Class* klass = class_linker_.get()->FindClass("LMyClass;", NULL, dex.get());
Method* method = klass->FindVirtualMethod("foo");
@@ -209,7 +209,7 @@
}
TEST_F(JniCompilerTest, CompileAndRunIntMethod) {
- scoped_ptr<RawDexFile> dex(OpenRawDexFileBase64(kMyClassNativesDex));
+ scoped_ptr<DexFile> dex(OpenDexFileBase64(kMyClassNativesDex));
class_linker_.get()->RegisterDexFile(dex.get());
Class* klass = class_linker_.get()->FindClass("LMyClass;", NULL, dex.get());
Method* method = klass->FindVirtualMethod("fooI");
@@ -236,7 +236,7 @@
}
TEST_F(JniCompilerTest, CompileAndRunIntIntMethod) {
- scoped_ptr<RawDexFile> dex(OpenRawDexFileBase64(kMyClassNativesDex));
+ scoped_ptr<DexFile> dex(OpenDexFileBase64(kMyClassNativesDex));
class_linker_.get()->RegisterDexFile(dex.get());
Class* klass = class_linker_.get()->FindClass("LMyClass;", NULL, dex.get());
Method* method = klass->FindVirtualMethod("fooII");
@@ -266,7 +266,7 @@
TEST_F(JniCompilerTest, CompileAndRunDoubleDoubleMethod) {
- scoped_ptr<RawDexFile> dex(OpenRawDexFileBase64(kMyClassNativesDex));
+ scoped_ptr<DexFile> dex(OpenDexFileBase64(kMyClassNativesDex));
class_linker_.get()->RegisterDexFile(dex.get());
Class* klass = class_linker_.get()->FindClass("LMyClass;", NULL, dex.get());
Method* method = klass->FindVirtualMethod("fooDD");
@@ -295,7 +295,7 @@
}
TEST_F(JniCompilerTest, CompileAndRunIntObjectObjectMethod) {
- scoped_ptr<RawDexFile> dex(OpenRawDexFileBase64(kMyClassNativesDex));
+ scoped_ptr<DexFile> dex(OpenDexFileBase64(kMyClassNativesDex));
class_linker_.get()->RegisterDexFile(dex.get());
Class* klass = class_linker_.get()->FindClass("LMyClass;", NULL, dex.get());
Method* method = klass->FindVirtualMethod("fooIOO");
@@ -350,7 +350,7 @@
}
TEST_F(JniCompilerTest, CompileAndRunStaticIntObjectObjectMethod) {
- scoped_ptr<RawDexFile> dex(OpenRawDexFileBase64(kMyClassNativesDex));
+ scoped_ptr<DexFile> dex(OpenDexFileBase64(kMyClassNativesDex));
class_linker_.get()->RegisterDexFile(dex.get());
Class* klass = class_linker_.get()->FindClass("LMyClass;", NULL, dex.get());
Method* method = klass->FindDirectMethod("fooSIOO");
@@ -402,7 +402,7 @@
}
TEST_F(JniCompilerTest, CompileAndRunStaticSynchronizedIntObjectObjectMethod) {
- scoped_ptr<RawDexFile> dex(OpenRawDexFileBase64(kMyClassNativesDex));
+ scoped_ptr<DexFile> dex(OpenDexFileBase64(kMyClassNativesDex));
class_linker_.get()->RegisterDexFile(dex.get());
Class* klass = class_linker_.get()->FindClass("LMyClass;", NULL, dex.get());
Method* method = klass->FindDirectMethod("fooSSIOO");
@@ -460,7 +460,7 @@
Thread::Current()->DecrementSuspendCount();
}
TEST_F(JniCompilerTest, SuspendCountAcknolewdgement) {
- scoped_ptr<RawDexFile> dex(OpenRawDexFileBase64(kMyClassNativesDex));
+ scoped_ptr<DexFile> dex(OpenDexFileBase64(kMyClassNativesDex));
class_linker_.get()->RegisterDexFile(dex.get());
Class* klass = class_linker_.get()->FindClass("LMyClass;", NULL, dex.get());
Method* method = klass->FindVirtualMethod("fooI");
@@ -501,7 +501,7 @@
Thread::Current()->ClearException();
}
TEST_F(JniCompilerTest, ExceptionHandling) {
- scoped_ptr<RawDexFile> dex(OpenRawDexFileBase64(kMyClassNativesDex));
+ scoped_ptr<DexFile> dex(OpenDexFileBase64(kMyClassNativesDex));
class_linker_.get()->RegisterDexFile(dex.get());
Class* klass = class_linker_.get()->FindClass("LMyClass;", NULL, dex.get());
Method* method = klass->FindVirtualMethod("foo");
diff --git a/src/runtime.cc b/src/runtime.cc
index be926c3..eadc50e 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -44,7 +44,7 @@
// notreached
}
-Runtime* Runtime::Create(std::vector<RawDexFile*> boot_class_path) {
+Runtime* Runtime::Create(std::vector<DexFile*> boot_class_path) {
scoped_ptr<Runtime> runtime(new Runtime());
bool success = runtime->Init(boot_class_path);
if (!success) {
@@ -54,7 +54,7 @@
}
}
-bool Runtime::Init(std::vector<RawDexFile*> boot_class_path) {
+bool Runtime::Init(std::vector<DexFile*> boot_class_path) {
thread_list_ = ThreadList::Create();
Heap::Init(Heap::kStartupSize, Heap::kMaximumSize);
Thread::Init();
diff --git a/src/runtime.h b/src/runtime.h
index f697b4a..da773a3 100644
--- a/src/runtime.h
+++ b/src/runtime.h
@@ -19,7 +19,7 @@
class Runtime {
public:
// Creates and initializes a new runtime.
- static Runtime* Create(std::vector<RawDexFile*> boot_class_path);
+ static Runtime* Create(std::vector<DexFile*> boot_class_path);
// Compiles a dex file.
static void Compile(const StringPiece& filename);
@@ -45,7 +45,7 @@
Runtime() : class_linker_(NULL), thread_list_(NULL) {}
// Initializes a new uninitialized runtime.
- bool Init(std::vector<RawDexFile*> boot_class_path);
+ bool Init(std::vector<DexFile*> boot_class_path);
ClassLinker* class_linker_;