ClassLinker can now FindClass all libcore classes
Summary:
- added ClassLinkerTest/LibCore test of finding all libcore classes
- fixed bug in LinkInterfaceMethods appending mirant methods to vtable_
- fixed bug in LinkVirtualMethods allocating subclass vtable_
- fixed mmap bug in MarkStack::Init
- bumped default (and max) heap sizes to handle ClassLinkerTest/LibCore
- made ObjectArray a templated class
- heap allocate Class::vtable_
- "mm test-art" and "mm test-art-target" added
- new is_host_ for use by tests
Details:
Added support for "mm test-art" and "mm test-art-target" in addition to test-art-host
Android.mk
Made ObjectArray a template class for clearer declarations and to
remove need the need for down_cast.
src/object.h
src/object_test.cc
src/class_linker.cc
src/class_linker.h
src/dex_cache.cc
src/dex_cache.h
src/dex_cache_test.cc
src/mark_sweep.cc
Made Class::vtable_ a heap allocated ObjectArray<Method>
src/class_linker.cc
Fix bug in ClassLinker::LinkInterfaceMethods where we were not
extending the vtable_ before appending miranda methods.
src/class_linker.cc
Changed all uses of DexFile* in ClassLinker to be const
src/class_linker.cc
src/class_linker.h
Fix bug in ClassLinker::LinkVirtualMethods where we were using
NumVirtualMethods vs vtable->GetLength when determining new max
vtable_ length.
src/class_linker.cc
New ClassLinkerTest/LibCore that enumerates the libcore dex file
and tries to FindClass every descriptor found.
src/class_linker_test.cc
Added if_host_ check for host only tests. In the future will use
for picking proper location of files, etc. on host vs target.
src/common_test.h
Fixed test to use ClassLinker::AllocDexCache
src/dex_cache_test.cc
Fixed fooIds comments to foo_ids_
src/dex_file.h
Bumped default heap size (and max as well) to make ClassLinkerTest/LibCore run
src/heap.h
Fixed bug where we were not using MAP_ANONYMOUS for MarkStack
allocation found running ClassLinkerTest/LibCore.
src/mark_stack.cc
Change-Id: I204e2ec7205210e2b60f5b81d126ab6e1da5a71c
diff --git a/src/dex_cache.h b/src/dex_cache.h
index 2892e29..47f9bcf 100644
--- a/src/dex_cache.h
+++ b/src/dex_cache.h
@@ -15,7 +15,7 @@
class String;
union JValue;
-class DexCache : public ObjectArray {
+class DexCache : public ObjectArray<Object> {
public:
enum ArrayIndexes {
@@ -26,10 +26,10 @@
kMax = 4,
};
- void Init(ObjectArray* strings,
- ObjectArray* classes,
- ObjectArray* methods,
- ObjectArray* fields);
+ void Init(ObjectArray<String>* strings,
+ ObjectArray<Class>* classes,
+ ObjectArray<Method>* methods,
+ ObjectArray<Field>* fields);
size_t NumStrings() const {
return GetStrings()->GetLength();
@@ -48,7 +48,7 @@
}
String* GetResolvedString(uint32_t string_idx) const {
- return down_cast<String*>(GetStrings()->Get(string_idx));
+ return GetStrings()->Get(string_idx);
}
void SetResolvedString(uint32_t string_idx, String* resolved) {
@@ -56,7 +56,7 @@
}
Class* GetResolvedClass(uint32_t class_idx) const {
- return down_cast<Class*>(GetClasses()->Get(class_idx));
+ return GetClasses()->Get(class_idx);
}
void SetResolvedClass(uint32_t class_idx, Class* resolved) {
@@ -64,7 +64,7 @@
}
Method* GetResolvedMethod(uint32_t method_idx) const {
- return down_cast<Method*>(GetMethods()->Get(method_idx));
+ return GetMethods()->Get(method_idx);
}
void SetResolvedMethod(uint32_t method_idx, Method* resolved) {
@@ -72,7 +72,7 @@
}
Field* GetResolvedField(uint32_t field_idx) const {
- return down_cast<Field*>(GetFields()->Get(field_idx));
+ return GetFields()->Get(field_idx);
}
void SetResolvedfield(uint32_t field_idx, Field* resolved) {
@@ -80,17 +80,17 @@
}
private:
- ObjectArray* GetStrings() const {
- return down_cast<ObjectArray*>(Get(kStrings));
+ ObjectArray<String>* GetStrings() const {
+ return down_cast<ObjectArray<String>*>(Get(kStrings));
}
- ObjectArray* GetClasses() const {
- return down_cast<ObjectArray*>(Get(kClasses));
+ ObjectArray<Class>* GetClasses() const {
+ return down_cast<ObjectArray<Class>*>(Get(kClasses));
}
- ObjectArray* GetMethods() const {
- return down_cast<ObjectArray*>(Get(kMethods));
+ ObjectArray<Method>* GetMethods() const {
+ return down_cast<ObjectArray<Method>*>(Get(kMethods));
}
- ObjectArray* GetFields() const {
- return down_cast<ObjectArray*>(Get(kFields));
+ ObjectArray<Field>* GetFields() const {
+ return down_cast<ObjectArray<Field>*>(Get(kFields));
}
DexCache();
};