From c8fe6517faf91b45683cddff3c15e08e489e12e9 Mon Sep 17 00:00:00 2001 From: Nicolas Geoffray Date: Thu, 1 Apr 2021 14:22:40 +0100 Subject: Integrate ClassLoaderContext check in OatFileAssistant::GetBestOatFile. This reduces some code duplication between OatFileManager::OpenDexFilesFromOat and GetDexoptNeeded. It also gives the chance for OatFileAssistant and GetDexoptNeeded to find the real best oat file. Test: test.py Bug: 176960283 Change-Id: Id366aef7a9e91833d8edaea965abda4cfdcd8455 --- runtime/class_loader_context.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'runtime/class_loader_context.cc') diff --git a/runtime/class_loader_context.cc b/runtime/class_loader_context.cc index b5ce122c95..228b95028a 100644 --- a/runtime/class_loader_context.cc +++ b/runtime/class_loader_context.cc @@ -412,7 +412,9 @@ bool ClassLoaderContext::OpenDexFiles(const std::string& classpath_dir, // no dex files. So that we can distinguish the real failures... const ArtDexFileLoader dex_file_loader; std::vector work_list; - CHECK(class_loader_chain_ != nullptr); + if (class_loader_chain_ == nullptr) { + return true; + } work_list.push_back(class_loader_chain_.get()); size_t dex_file_index = 0; while (!work_list.empty()) { @@ -1155,7 +1157,9 @@ std::unique_ptr ClassLoaderContext::CreateContextForClassLoa jobjectArray dex_elements) { ScopedTrace trace(__FUNCTION__); - CHECK(class_loader != nullptr); + if (class_loader == nullptr) { + return nullptr; + } ScopedObjectAccess soa(Thread::Current()); StackHandleScope<2> hs(soa.Self()); Handle h_class_loader = -- cgit v1.2.3-59-g8ed1b