Enable moving classes.
Slight reduction in Zygote size, memory savings are in the noise.
Before: Zygote size: 8739224
After: Zygote size: 8733568
Fixed a bug where we didn't set the concurrent start bytes after
switching the allocator from bump pointer to ROSAlloc in the
zygote. This caused excessive memory usage.
Added the method verifiers as roots to fix an issue caused by
RegTypes holding a Class*.
Added logic to clear card table in the SemiSpace collector, this
reduces DalvikOther from ~2400k -> ~1760k when using the SemiSpace
collector.
Added a missing lock to the timing loggers which caused a rare
one time crash in std::set.
Bug: 11771255
Bug: 8499494
Bug: 10802951
Change-Id: I99d2b528cd51c1c5ed7012e3220b3aefded680ae
diff --git a/runtime/verifier/method_verifier.cc b/runtime/verifier/method_verifier.cc
index 5f5d865..9183b5f 100644
--- a/runtime/verifier/method_verifier.cc
+++ b/runtime/verifier/method_verifier.cc
@@ -319,10 +319,12 @@
allow_soft_failures_(allow_soft_failures),
has_check_casts_(false),
has_virtual_or_interface_invokes_(false) {
+ Runtime::Current()->AddMethodVerifier(this);
DCHECK(class_def != nullptr);
}
MethodVerifier::~MethodVerifier() {
+ Runtime::Current()->RemoveMethodVerifier(this);
STLDeleteElements(&failure_messages_);
}
@@ -4385,5 +4387,9 @@
return (rejected_classes_->find(ref) != rejected_classes_->end());
}
+void MethodVerifier::VisitRoots(RootVisitor* visitor, void* arg) {
+ reg_types_.VisitRoots(visitor, arg);
+}
+
} // namespace verifier
} // namespace art
diff --git a/runtime/verifier/method_verifier.h b/runtime/verifier/method_verifier.h
index 892b7a8..6b5747b 100644
--- a/runtime/verifier/method_verifier.h
+++ b/runtime/verifier/method_verifier.h
@@ -237,6 +237,8 @@
static bool IsCandidateForCompilation(MethodReference& method_ref,
const uint32_t access_flags);
+ void VisitRoots(RootVisitor* visitor, void* arg) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+
private:
// Adds the given string to the beginning of the last failure message.
void PrependToLastFailMessage(std::string);
diff --git a/runtime/verifier/reg_type.cc b/runtime/verifier/reg_type.cc
index d82e75d..f394bce 100644
--- a/runtime/verifier/reg_type.cc
+++ b/runtime/verifier/reg_type.cc
@@ -969,6 +969,12 @@
}
}
+void RegType::VisitRoots(RootVisitor* visitor, void* arg) {
+ if (klass_ != nullptr) {
+ klass_ = down_cast<mirror::Class*>(visitor(klass_, arg));
+ }
+}
+
void UninitializedThisReferenceType::CheckInvariants() const {
CHECK_EQ(GetAllocationPc(), 0U) << *this;
}
diff --git a/runtime/verifier/reg_type.h b/runtime/verifier/reg_type.h
index f371733..8df481f 100644
--- a/runtime/verifier/reg_type.h
+++ b/runtime/verifier/reg_type.h
@@ -20,6 +20,7 @@
#include "base/macros.h"
#include "globals.h"
#include "primitive.h"
+#include "root_visitor.h"
#include "jni.h"
@@ -269,6 +270,8 @@
virtual ~RegType() {}
+ void VisitRoots(RootVisitor* visitor, void* arg) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+
protected:
RegType(mirror::Class* klass, const std::string& descriptor, uint16_t cache_id)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
@@ -282,7 +285,7 @@
const std::string descriptor_;
- mirror::Class* const klass_;
+ mirror::Class* klass_;
const uint16_t cache_id_;
friend class RegTypeCache;
diff --git a/runtime/verifier/reg_type_cache.cc b/runtime/verifier/reg_type_cache.cc
index 9c9673a..3d24414 100644
--- a/runtime/verifier/reg_type_cache.cc
+++ b/runtime/verifier/reg_type_cache.cc
@@ -554,5 +554,11 @@
}
}
+void RegTypeCache::VisitRoots(RootVisitor* visitor, void* arg) {
+ for (RegType* entry : entries_) {
+ entry->VisitRoots(visitor, arg);
+ }
+}
+
} // namespace verifier
} // namespace art
diff --git a/runtime/verifier/reg_type_cache.h b/runtime/verifier/reg_type_cache.h
index a9f8bff..a811696 100644
--- a/runtime/verifier/reg_type_cache.h
+++ b/runtime/verifier/reg_type_cache.h
@@ -21,6 +21,7 @@
#include "base/macros.h"
#include "base/stl_util.h"
#include "reg_type.h"
+#include "root_visitor.h"
#include "runtime.h"
#include <stdint.h>
@@ -139,6 +140,8 @@
void Dump(std::ostream& os) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
const RegType& RegTypeFromPrimitiveType(Primitive::Type) const;
+ void VisitRoots(RootVisitor* visitor, void* arg) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+
private:
void FillPrimitiveAndSmallConstantTypes() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
mirror::Class* ResolveClass(const char* descriptor, mirror::ClassLoader* loader)