diff options
author | Mathieu Chartier <mathieuc@google.com> | 2013-09-13 13:46:47 -0700 |
---|---|---|
committer | Mathieu Chartier <mathieuc@google.com> | 2013-11-11 15:34:27 -0800 |
commit | 590fee9e8972f872301c2d16a575d579ee564bee (patch) | |
tree | b02db45c72f1911ec896b93379ada0276aea3199 /runtime/verifier/method_verifier.h | |
parent | 5b70680b8df6d8fa95bb8e1070d0107f3d388940 (diff) | |
download | art-590fee9e8972f872301c2d16a575d579ee564bee.zip art-590fee9e8972f872301c2d16a575d579ee564bee.tar.gz art-590fee9e8972f872301c2d16a575d579ee564bee.tar.bz2 |
Compacting collector.
The compacting collector is currently similar to semispace. It works by
copying objects back and forth between two bump pointer spaces. There
are types of objects which are "non-movable" due to current runtime
limitations. These are Classes, Methods, and Fields.
Bump pointer spaces are a new type of continuous alloc space which have
no lock in the allocation code path. When you allocate from these it uses
atomic operations to increase an index. Traversing the objects in the bump
pointer space relies on Object::SizeOf matching the allocated size exactly.
Runtime changes:
JNI::GetArrayElements returns copies objects if you attempt to get the
backing data of a movable array. For GetArrayElementsCritical, we return
direct backing storage for any types of arrays, but temporarily disable
the GC until the critical region is completed.
Added a new runtime call called VisitObjects, this is used in place of
the old pattern which was flushing the allocation stack and walking
the bitmaps.
Changed image writer to be compaction safe and use object monitor word
for forwarding addresses.
Added a bunch of added SIRTs to ClassLinker, MethodLinker, etc..
TODO: Enable switching allocators, compacting on background, etc..
Bug: 8981901
Change-Id: I3c886fd322a6eef2b99388d19a765042ec26ab99
Diffstat (limited to 'runtime/verifier/method_verifier.h')
-rw-r--r-- | runtime/verifier/method_verifier.h | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/runtime/verifier/method_verifier.h b/runtime/verifier/method_verifier.h index 57fde1d..8a663f9 100644 --- a/runtime/verifier/method_verifier.h +++ b/runtime/verifier/method_verifier.h @@ -33,6 +33,7 @@ #include "reg_type_cache-inl.h" #include "register_line.h" #include "safe_map.h" +#include "sirt_ref.h" #include "UniquePtr.h" namespace art { @@ -142,14 +143,15 @@ class MethodVerifier { static FailureKind VerifyClass(const mirror::Class* klass, bool allow_soft_failures, std::string* error) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - static FailureKind VerifyClass(const DexFile* dex_file, mirror::DexCache* dex_cache, - mirror::ClassLoader* class_loader, + static FailureKind VerifyClass(const DexFile* dex_file, SirtRef<mirror::DexCache>& dex_cache, + SirtRef<mirror::ClassLoader>& class_loader, const DexFile::ClassDef* class_def, bool allow_soft_failures, std::string* error) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); static void VerifyMethodAndDump(std::ostream& os, uint32_t method_idx, const DexFile* dex_file, - mirror::DexCache* dex_cache, mirror::ClassLoader* class_loader, + SirtRef<mirror::DexCache>& dex_cache, + SirtRef<mirror::ClassLoader>& class_loader, const DexFile::ClassDef* class_def, const DexFile::CodeItem* code_item, mirror::ArtMethod* method, uint32_t method_access_flags) @@ -217,16 +219,13 @@ class MethodVerifier { return can_load_classes_; } - MethodVerifier(const DexFile* dex_file, mirror::DexCache* dex_cache, - mirror::ClassLoader* class_loader, const DexFile::ClassDef* class_def, - const DexFile::CodeItem* code_item, - uint32_t method_idx, mirror::ArtMethod* method, + MethodVerifier(const DexFile* dex_file, SirtRef<mirror::DexCache>* dex_cache, + SirtRef<mirror::ClassLoader>* class_loader, const DexFile::ClassDef* class_def, + const DexFile::CodeItem* code_item, uint32_t method_idx, mirror::ArtMethod* method, uint32_t access_flags, bool can_load_classes, bool allow_soft_failures) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - ~MethodVerifier() { - STLDeleteElements(&failure_messages_); - } + ~MethodVerifier(); // Run verification on the method. Returns true if verification completes and false if the input // has an irrecoverable corruption. @@ -257,8 +256,8 @@ class MethodVerifier { * for code flow problems. */ static FailureKind VerifyMethod(uint32_t method_idx, const DexFile* dex_file, - mirror::DexCache* dex_cache, - mirror::ClassLoader* class_loader, + SirtRef<mirror::DexCache>& dex_cache, + SirtRef<mirror::ClassLoader>& class_loader, const DexFile::ClassDef* class_def_idx, const DexFile::CodeItem* code_item, mirror::ArtMethod* method, uint32_t method_access_flags, @@ -685,9 +684,9 @@ class MethodVerifier { const RegType* return_type_; // Lazily computed return type of the method. const DexFile* const dex_file_; // The dex file containing the method. // The dex_cache for the declaring class of the method. - mirror::DexCache* dex_cache_ GUARDED_BY(Locks::mutator_lock_); + SirtRef<mirror::DexCache>* dex_cache_ GUARDED_BY(Locks::mutator_lock_); // The class loader for the declaring class of the method. - mirror::ClassLoader* class_loader_ GUARDED_BY(Locks::mutator_lock_); + SirtRef<mirror::ClassLoader>* class_loader_ GUARDED_BY(Locks::mutator_lock_); const DexFile::ClassDef* const class_def_; // The class def of the declaring class of the method. const DexFile::CodeItem* const code_item_; // The code item containing the code for the method. const RegType* declaring_class_; // Lazily computed reg type of the method's declaring class. |