diff options
author | 2016-06-03 17:47:32 -0700 | |
---|---|---|
committer | 2016-06-06 11:26:32 -0700 | |
commit | c9dbb1df3b5c06ba122cacaf35b17cb53c6be3c6 (patch) | |
tree | d9b8f3c81c0abc7ce6839d0723271ee9740a267c /runtime/class_table.h | |
parent | f102faf1bcbdb2149e3e7bf27b1819f621b7894b (diff) |
Revert "Revert "Hold dex caches live in class table""
Bug: 29083330
This reverts commit f102faf1bcbdb2149e3e7bf27b1819f621b7894b.
Change-Id: Ibc6d260247b3113beec7d33552061512a36c9ce8
Diffstat (limited to 'runtime/class_table.h')
-rw-r--r-- | runtime/class_table.h | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/runtime/class_table.h b/runtime/class_table.h index 686381d35c..6fb420605c 100644 --- a/runtime/class_table.h +++ b/runtime/class_table.h @@ -133,8 +133,8 @@ class ClassTable { REQUIRES(!lock_) SHARED_REQUIRES(Locks::mutator_lock_); - // Return true if we inserted the dex file, false if it already exists. - bool InsertDexFile(mirror::Object* dex_file) + // Return true if we inserted the strong root, false if it already exists. + bool InsertStrongRoot(mirror::Object* obj) REQUIRES(!lock_) SHARED_REQUIRES(Locks::mutator_lock_); @@ -153,6 +153,11 @@ class ClassTable { REQUIRES(!lock_) SHARED_REQUIRES(Locks::mutator_lock_); + // Clear strong roots (other than classes themselves). + void ClearStrongRoots() + REQUIRES(!lock_) + SHARED_REQUIRES(Locks::mutator_lock_); + ReaderWriterMutex& GetLock() { return lock_; } @@ -162,9 +167,10 @@ class ClassTable { mutable ReaderWriterMutex lock_; // We have a vector to help prevent dirty pages after the zygote forks by calling FreezeSnapshot. std::vector<ClassSet> classes_ GUARDED_BY(lock_); - // Dex files used by the class loader which may not be owned by the class loader. We keep these - // live so that we do not have issues closing any of the dex files. - std::vector<GcRoot<mirror::Object>> dex_files_ GUARDED_BY(lock_); + // Extra strong roots that can be either dex files or dex caches. Dex files used by the class + // loader which may not be owned by the class loader must be held strongly live. Also dex caches + // are held live to prevent them being unloading once they have classes in them. + std::vector<GcRoot<mirror::Object>> strong_roots_ GUARDED_BY(lock_); }; } // namespace art |