Compiler changes for boot image extension.
Test: m test-art-host-gtest
Test: testrunnner.py --host --optimizing
Test: aosp_taimen-userdebug boots.
Test: run-gtest.sh
Test: testrunner.py --target --optimizing
Change-Id: I8e999c96ec908f26d8c529edc9d2a3be49a9379a
diff --git a/compiler/driver/compiler_options.cc b/compiler/driver/compiler_options.cc
index 8d09977..cde6ae9 100644
--- a/compiler/driver/compiler_options.cc
+++ b/compiler/driver/compiler_options.cc
@@ -20,11 +20,11 @@
#include <string_view>
#include "android-base/stringprintf.h"
-#include "android-base/strings.h"
#include "arch/instruction_set.h"
#include "arch/instruction_set_features.h"
#include "base/runtime_debug.h"
+#include "base/string_view_cpp20.h"
#include "base/variant_map.h"
#include "class_linker.h"
#include "cmdline_parser.h"
@@ -185,18 +185,23 @@
}
bool CompilerOptions::IsCoreImageFilename(const std::string& boot_image_filename) {
+ std::string_view filename(boot_image_filename);
+ size_t colon_pos = filename.find(':');
+ if (colon_pos != std::string_view::npos) {
+ filename = filename.substr(0u, colon_pos);
+ }
// Look for "core.art" or "core-*.art".
- if (android::base::EndsWith(boot_image_filename, "core.art")) {
+ if (EndsWith(filename, "core.art")) {
return true;
}
- if (!android::base::EndsWith(boot_image_filename, ".art")) {
+ if (!EndsWith(filename, ".art")) {
return false;
}
- size_t slash_pos = boot_image_filename.rfind('/');
+ size_t slash_pos = filename.rfind('/');
if (slash_pos == std::string::npos) {
- return android::base::StartsWith(boot_image_filename, "core-");
+ return StartsWith(filename, "core-");
}
- return boot_image_filename.compare(slash_pos + 1, 5u, "core-") == 0;
+ return filename.compare(slash_pos + 1, 5u, "core-") == 0;
}
} // namespace art
diff --git a/compiler/driver/compiler_options.h b/compiler/driver/compiler_options.h
index 98b15dc..e24da59 100644
--- a/compiler/driver/compiler_options.h
+++ b/compiler/driver/compiler_options.h
@@ -72,6 +72,7 @@
enum class ImageType : uint8_t {
kNone, // JIT or AOT app compilation producing only an oat file but no image.
kBootImage, // Creating boot image.
+ kBootImageExtension, // Creating boot image extension.
kAppImage, // Creating app image.
kApexBootImage, // Creating the apex image for jit/zygote experiment b/119800099.
};
@@ -200,6 +201,11 @@
return image_type_ == ImageType::kApexBootImage;
}
+ // Are we compiling a boot image extension?
+ bool IsBootImageExtension() const {
+ return image_type_ == ImageType::kBootImageExtension;
+ }
+
bool IsBaseline() const {
return baseline_;
}