Revert "Revert "Store resolved Strings for AOT code in .bss.""
Fixed oat_test to keep dex files alive. Fixed mips build.
Rewritten the .bss GC root visiting and added write barrier
to the artResolveStringFromCode().
Test: build aosp_mips-eng
Test: m ART_DEFAULT_GC_TYPE=SS test-art-target-host-gtest-oat_test
Test: Run ART test suite on host and Nexus 9.
Bug: 20323084
Bug: 30627598
This reverts commit 5f926055cb88089d8ca27243f35a9dfd89d981f0.
Change-Id: I07fa2278d82b8eb64964c9a4b66cb93726ccda6b
diff --git a/runtime/class_table.cc b/runtime/class_table.cc
index 0600876..2ae7e8c 100644
--- a/runtime/class_table.cc
+++ b/runtime/class_table.cc
@@ -165,6 +165,16 @@
}
}
strong_roots_.push_back(GcRoot<mirror::Object>(obj));
+ // If `obj` is a dex cache associated with a new oat file with GC roots, add it to oat_files_.
+ if (obj->IsDexCache()) {
+ const DexFile* dex_file = down_cast<mirror::DexCache*>(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);
+ }
+ }
+ }
return true;
}
@@ -201,6 +211,7 @@
void ClassTable::ClearStrongRoots() {
WriterMutexLock mu(Thread::Current(), lock_);
+ oat_files_.clear();
strong_roots_.clear();
}
} // namespace art