Revert^2 "Allow boot image for a part of the boot classpath."
This reverts commit fb83d76a8b186df05f874216b535f5ad57e7bd02.
Fixed host run-test dependencies, cleaned up target run-test
and gtest dependencies.
Test: rm -f out/host/linux-x86/framework/conscrypt-hostdex.jar
testrunner.py -b --host --optimizing -t 660-clinit
Bug: 119868597
Change-Id: Ia0a5aba0223ae6616bf3e109daf0af7b8355d048
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index a40ffbd..55bc2ec 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -974,8 +974,8 @@
VLOG(startup) << "Runtime::StartDaemonThreads exiting";
}
-static size_t OpenDexFiles(const std::vector<std::string>& dex_filenames,
- const std::vector<std::string>& dex_locations,
+static size_t OpenDexFiles(ArrayRef<const std::string> dex_filenames,
+ ArrayRef<const std::string> dex_locations,
std::vector<std::unique_ptr<const DexFile>>* dex_files) {
DCHECK(dex_files != nullptr) << "OpenDexFiles: out-param is nullptr";
size_t failure_count = 0;
@@ -1432,6 +1432,21 @@
GetInternTable()->AddImageStringsToTable(image_space, VoidFunctor());
}
}
+ if (heap_->GetBootImageSpaces().size() != GetBootClassPath().size()) {
+ // The boot image did not contain all boot class path components. Load the rest.
+ DCHECK_LT(heap_->GetBootImageSpaces().size(), GetBootClassPath().size());
+ size_t start = heap_->GetBootImageSpaces().size();
+ DCHECK_LT(start, GetBootClassPath().size());
+ std::vector<std::unique_ptr<const DexFile>> extra_boot_class_path;
+ if (runtime_options.Exists(Opt::BootClassPathDexList)) {
+ extra_boot_class_path.swap(*runtime_options.GetOrDefault(Opt::BootClassPathDexList));
+ } else {
+ OpenDexFiles(ArrayRef<const std::string>(GetBootClassPath()).SubArray(start),
+ ArrayRef<const std::string>(GetBootClassPathLocations()).SubArray(start),
+ &extra_boot_class_path);
+ }
+ class_linker_->AddExtraBootDexFiles(self, std::move(extra_boot_class_path));
+ }
if (IsJavaDebuggable()) {
// Now that we have loaded the boot image, deoptimize its methods if we are running
// debuggable, as the code may have been compiled non-debuggable.
@@ -1442,7 +1457,9 @@
if (runtime_options.Exists(Opt::BootClassPathDexList)) {
boot_class_path.swap(*runtime_options.GetOrDefault(Opt::BootClassPathDexList));
} else {
- OpenDexFiles(GetBootClassPath(), GetBootClassPathLocations(), &boot_class_path);
+ OpenDexFiles(ArrayRef<const std::string>(GetBootClassPath()),
+ ArrayRef<const std::string>(GetBootClassPathLocations()),
+ &boot_class_path);
}
if (!class_linker_->InitWithoutImage(std::move(boot_class_path), &error_msg)) {
LOG(ERROR) << "Could not initialize without image: " << error_msg;