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/class_linker.h b/src/class_linker.h
index a2f2770..086234d 100644
--- a/src/class_linker.h
+++ b/src/class_linker.h
@@ -7,6 +7,7 @@
#include <utility>
#include <vector>
+#include "heap.h"
#include "macros.h"
#include "dex_file.h"
#include "thread.h"
@@ -27,7 +28,10 @@
StaticField* AllocStaticField();
InstanceField* AllocInstanceField();
Method* AllocMethod();
- ObjectArray* AllocObjectArray(size_t length);
+ template <class C> ObjectArray<C>* AllocObjectArray(size_t length) {
+ return Heap::AllocObjectArray<C>(object_array_class_, length);
+ }
+
// Finds a class by its descriptor name.
// If dex_file is null, searches boot_class_path_.
@@ -49,7 +53,7 @@
String* ResolveString(const Class* referring, uint32_t string_idx);
- void RegisterDexFile(DexFile* dex_file);
+ void RegisterDexFile(const DexFile* dex_file);
private:
ClassLinker() {}
@@ -144,9 +148,9 @@
void CreateReferenceOffsets(Class* klass);
- std::vector<DexFile*> boot_class_path_;
+ std::vector<const DexFile*> boot_class_path_;
- std::vector<DexFile*> dex_files_;
+ std::vector<const DexFile*> dex_files_;
std::vector<DexCache*> dex_caches_;
@@ -183,7 +187,7 @@
Class* field_array_class_;
Class* method_array_class_;
- ObjectArray* array_interfaces_;
+ ObjectArray<Class>* array_interfaces_;
InterfaceEntry* array_iftable_;
FRIEND_TEST(ClassLinkerTest, ProtoCompare);