ART: Prune FindArrayClass cache in image writer

The ClassLinker cache speeds up FindArrayClass requests, but all
entries are roots. It is possible that an entry is a non-image
class when creating the boot image, artificially keeping the
class around.

Bug: 21596650

(cherry picked from commit 44905ce1c97613a5cb44046049843fe1029a64cf)

Change-Id: Ief9b439945d0e293a3cb5dcddfeb189b5e174f06
diff --git a/runtime/class_linker.h b/runtime/class_linker.h
index fa8b2e7..d9935cb 100644
--- a/runtime/class_linker.h
+++ b/runtime/class_linker.h
@@ -480,6 +480,10 @@
 
   ArtMethod* CreateRuntimeMethod();
 
+  // Clear the ArrayClass cache. This is necessary when cleaning up for the image, as the cache
+  // entries are roots, but potentially not image classes.
+  void DropFindArrayClassCache() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+
  private:
   const OatFile::OatMethod FindOatMethodFor(ArtMethod* method, bool* found)
       SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);