diff options
Diffstat (limited to 'runtime/class_table.cc')
-rw-r--r-- | runtime/class_table.cc | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/runtime/class_table.cc b/runtime/class_table.cc index 97c0abdda3..b44104e299 100644 --- a/runtime/class_table.cc +++ b/runtime/class_table.cc @@ -170,14 +170,27 @@ bool ClassTable::InsertStrongRoot(ObjPtr<mirror::Object> obj) { const DexFile* dex_file = ObjPtr<mirror::DexCache>::DownCast(obj)->GetDexFile(); if (dex_file != nullptr && dex_file->GetOatDexFile() != nullptr) { const OatFile* oat_file = dex_file->GetOatDexFile()->GetOatFile(); - if (!oat_file->GetBssGcRoots().empty() && !ContainsElement(oat_files_, oat_file)) { - oat_files_.push_back(oat_file); + if (!oat_file->GetBssGcRoots().empty()) { + InsertOatFileLocked(oat_file); // Ignore return value. } } } return true; } +bool ClassTable::InsertOatFile(const OatFile* oat_file) { + WriterMutexLock mu(Thread::Current(), lock_); + return InsertOatFileLocked(oat_file); +} + +bool ClassTable::InsertOatFileLocked(const OatFile* oat_file) { + if (ContainsElement(oat_files_, oat_file)) { + return false; + } + oat_files_.push_back(oat_file); + return true; +} + size_t ClassTable::WriteToMemory(uint8_t* ptr) const { ReaderMutexLock mu(Thread::Current(), lock_); ClassSet combined; |