diff options
author | 2016-10-24 16:53:39 +0000 | |
---|---|---|
committer | 2016-10-25 10:01:08 +0100 | |
commit | 1bc4b178590fa204265363a0207f1388e8bd6d15 (patch) | |
tree | 791fd12e3fac0c9c4ec260233d471d8a97cca5ca /runtime/class_table.cc | |
parent | 3667e26de4856cccf24bcbab54ad3349a05267c0 (diff) |
Revert "Disable kBssEntry LoadString sharpening."
Fix .bss GC root walking by registering the oat file
with the class loader's class table.
Also fix potentially outdated ObjPtr<> use in debug build.
This reverts commit b55fdbb30b3bc4e334c241153b98c0a6ea4a4a2b.
Test: m test-art-host
Bug: 32124939
Change-Id: I0b7e3b93cb53c7b22408aa10a04eaf5582c69ee8
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; |