Always visit object class from VisitReferences
We don't want to unload classes which have instances.
Slight increase in CMS GC time from ~6.5s to ~7.3s on
EvaluateAndApplyChanges.
Bug: 22720414
Change-Id: I467ff9c9d55163d2a90b999aef3bdd7b3f648bac
diff --git a/runtime/mirror/object_array.h b/runtime/mirror/object_array.h
index 607b000..b45cafd 100644
--- a/runtime/mirror/object_array.h
+++ b/runtime/mirror/object_array.h
@@ -83,14 +83,15 @@
ObjectArray<T>* CopyOf(Thread* self, int32_t new_length)
SHARED_REQUIRES(Locks::mutator_lock_) REQUIRES(!Roles::uninterruptible_);
- // TODO fix thread safety analysis broken by the use of template. This should be
- // SHARED_REQUIRES(Locks::mutator_lock_).
- template<const bool kVisitClass, typename Visitor>
- void VisitReferences(const Visitor& visitor) NO_THREAD_SAFETY_ANALYSIS;
-
static MemberOffset OffsetOfElement(int32_t i);
private:
+ // TODO fix thread safety analysis broken by the use of template. This should be
+ // SHARED_REQUIRES(Locks::mutator_lock_).
+ template<typename Visitor>
+ void VisitReferences(const Visitor& visitor) NO_THREAD_SAFETY_ANALYSIS;
+
+ friend class Object; // For VisitReferences
DISALLOW_IMPLICIT_CONSTRUCTORS(ObjectArray);
};