Free unneeded obsolete maps
In cases where there are no new obsolete methods we can get rid of the
obsolete maps arrays.
Bug: 31455788
Test: ./test.py --host -j40
Change-Id: I4a8cd96b4293439c6e67d9426011b92125cc7b03
diff --git a/runtime/mirror/class_ext.cc b/runtime/mirror/class_ext.cc
index 94e4b88..32d49bb 100644
--- a/runtime/mirror/class_ext.cc
+++ b/runtime/mirror/class_ext.cc
@@ -40,8 +40,6 @@
void ClassExt::SetObsoleteArrays(ObjPtr<PointerArray> methods,
ObjPtr<ObjectArray<DexCache>> dex_caches) {
- DCHECK_EQ(GetLockOwnerThreadId(), Thread::Current()->GetThreadId())
- << "Obsolete arrays are set without synchronization!";
CHECK_EQ(methods.IsNull(), dex_caches.IsNull());
auto obsolete_dex_cache_off = OFFSET_OF_OBJECT_MEMBER(ClassExt, obsolete_dex_caches_);
auto obsolete_methods_off = OFFSET_OF_OBJECT_MEMBER(ClassExt, obsolete_methods_);
@@ -54,8 +52,7 @@
// these arrays are written into without all threads being suspended we have a race condition! This
// race could cause obsolete methods to be missed.
bool ClassExt::ExtendObsoleteArrays(Thread* self, uint32_t increase) {
- DCHECK_EQ(GetLockOwnerThreadId(), Thread::Current()->GetThreadId())
- << "Obsolete arrays are set without synchronization!";
+ // TODO It would be good to check that we have locked the class associated with this ClassExt.
StackHandleScope<5> hs(self);
Handle<ClassExt> h_this(hs.NewHandle(this));
Handle<PointerArray> old_methods(hs.NewHandle(h_this->GetObsoleteMethods()));