summaryrefslogtreecommitdiff
path: root/runtime/class_linker.cc
diff options
context:
space:
mode:
author Vladimír Marko <vmarko@google.com> 2022-11-30 12:20:40 +0000
committer Vladimír Marko <vmarko@google.com> 2022-11-30 12:24:02 +0000
commit0110e952e488bc41429f6f33f36e8884f41a26d8 (patch)
tree69b19ac65cf5ee7a5f4acefa53abf7f5ef191846 /runtime/class_linker.cc
parent7a570e0216b3b03cd8a83153ff739833d86a4430 (diff)
Revert "Reland "ART: Rewrite compiled code check in FaultHandler.""
This reverts commit 64fdbedd880bda36215e6e680d23bc2c361d2bfb. Reason for revert: Buildbot breakages: `Check failed: !bad_mutexes_held`. Bug: 38383823 Change-Id: I33d41c764c130cef05171de1eed82b778740704f
Diffstat (limited to 'runtime/class_linker.cc')
-rw-r--r--runtime/class_linker.cc31
1 files changed, 2 insertions, 29 deletions
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index e4b49efef0..a421461d96 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -3888,8 +3888,7 @@ void ClassLinker::RegisterDexFileLocked(const DexFile& dex_file,
std::string dex_file_location = dex_file.GetLocation();
// The following paths checks don't work on preopt when using boot dex files, where the dex
// cache location is the one on device, and the dex_file's location is the one on host.
- Runtime* runtime = Runtime::Current();
- if (!(runtime->IsAotCompiler() && class_loader == nullptr && !kIsTargetBuild)) {
+ if (!(Runtime::Current()->IsAotCompiler() && class_loader == nullptr && !kIsTargetBuild)) {
CHECK_GE(dex_file_location.length(), dex_cache_length)
<< dex_cache_location << " " << dex_file.GetLocation();
const std::string dex_file_suffix = dex_file_location.substr(
@@ -3901,7 +3900,7 @@ void ClassLinker::RegisterDexFileLocked(const DexFile& dex_file,
}
// Check if we need to initialize OatFile data (.data.bimg.rel.ro and .bss
- // sections) needed for code execution and register the oat code range.
+ // sections) needed for code execution.
const OatFile* oat_file =
(dex_file.GetOatDexFile() != nullptr) ? dex_file.GetOatDexFile()->GetOatFile() : nullptr;
bool initialize_oat_file_data = (oat_file != nullptr) && oat_file->IsExecutable();
@@ -3917,13 +3916,6 @@ void ClassLinker::RegisterDexFileLocked(const DexFile& dex_file,
}
if (initialize_oat_file_data) {
oat_file->InitializeRelocations();
- // Notify the fault handler about the new executable code range if needed.
- size_t exec_offset = oat_file->GetOatHeader().GetExecutableOffset();
- DCHECK_LE(exec_offset, oat_file->Size());
- size_t exec_size = oat_file->Size() - exec_offset;
- if (exec_size != 0u) {
- runtime->AddGeneratedCodeRange(oat_file->Begin() + exec_offset, exec_size);
- }
}
// Let hiddenapi assign a domain to the newly registered dex file.
@@ -10309,23 +10301,16 @@ void ClassLinker::CleanupClassLoaders() {
}
}
}
- std::set<const OatFile*> unregistered_oat_files;
if (!to_delete.empty()) {
JavaVMExt* vm = self->GetJniEnv()->GetVm();
WriterMutexLock mu(self, *Locks::dex_lock_);
for (auto it = dex_caches_.begin(), end = dex_caches_.end(); it != end; ) {
- const DexFile* dex_file = it->first;
const DexCacheData& data = it->second;
if (self->DecodeJObject(data.weak_root) == nullptr) {
DCHECK(to_delete.end() != std::find_if(
to_delete.begin(),
to_delete.end(),
[&](const ClassLoaderData& cld) { return cld.class_table == data.class_table; }));
- if (dex_file->GetOatDexFile() != nullptr &&
- dex_file->GetOatDexFile()->GetOatFile() != nullptr &&
- dex_file->GetOatDexFile()->GetOatFile()->IsExecutable()) {
- unregistered_oat_files.insert(dex_file->GetOatDexFile()->GetOatFile());
- }
vm->DeleteWeakGlobalRef(self, data.weak_root);
it = dex_caches_.erase(it);
} else {
@@ -10337,18 +10322,6 @@ void ClassLinker::CleanupClassLoaders() {
// CHA unloading analysis and SingleImplementaion cleanups are required.
DeleteClassLoader(self, data, /*cleanup_cha=*/ true);
}
- if (!unregistered_oat_files.empty()) {
- for (const OatFile* oat_file : unregistered_oat_files) {
- // Notify the fault handler about removal of the executable code range if needed.
- DCHECK(oat_file->IsExecutable());
- size_t exec_offset = oat_file->GetOatHeader().GetExecutableOffset();
- DCHECK_LE(exec_offset, oat_file->Size());
- size_t exec_size = oat_file->Size() - exec_offset;
- if (exec_size != 0u) {
- Runtime::Current()->RemoveGeneratedCodeRange(oat_file->Begin() + exec_offset, exec_size);
- }
- }
- }
}
class ClassLinker::FindVirtualMethodHolderVisitor : public ClassVisitor {