diff options
author | 2022-11-30 12:48:34 +0000 | |
---|---|---|
committer | 2022-11-30 12:48:34 +0000 | |
commit | 132bfb47c581ee18ced67ad8b678d213b900a14d (patch) | |
tree | 76f5223fa62798800cebd0002245c5746e4cde30 /runtime/class_linker.cc | |
parent | 3c1ee83f7af15af89d01af920d0f2f64a47b2945 (diff) | |
parent | 0110e952e488bc41429f6f33f36e8884f41a26d8 (diff) |
Revert "Reland "ART: Rewrite compiled code check in FaultHandler."" am: 0110e952e4
Original change: https://android-review.googlesource.com/c/platform/art/+/2318802
Change-Id: Ibd65dab8a7f2069b68a92d320a718ce23f773776
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'runtime/class_linker.cc')
-rw-r--r-- | runtime/class_linker.cc | 31 |
1 files changed, 2 insertions, 29 deletions
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc index c1368c1990..7c7e76598d 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 { |