From 038924b75f06b91c2a7e944196ca11f118ce182f Mon Sep 17 00:00:00 2001 From: Vladimir Marko Date: Tue, 19 Feb 2019 15:09:35 +0000 Subject: ART: Reduce dependencies on CompilerDriver. Preparation for moving CompilerDriver and other stuff from libart-compiler.so to dex2oat. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: Ic221ebca4b8c79dd1549316921ace655f2e3f0fe --- compiler/driver/compiler_options.cc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'compiler/driver/compiler_options.cc') diff --git a/compiler/driver/compiler_options.cc b/compiler/driver/compiler_options.cc index 7dd743f533..6f39488cc7 100644 --- a/compiler/driver/compiler_options.cc +++ b/compiler/driver/compiler_options.cc @@ -20,6 +20,7 @@ #include #include "android-base/stringprintf.h" +#include "android-base/strings.h" #include "arch/instruction_set.h" #include "arch/instruction_set_features.h" @@ -184,4 +185,19 @@ bool CompilerOptions::IsMethodVerifiedWithoutFailures(uint32_t method_idx, return is_system_class; } +bool CompilerOptions::IsCoreImageFilename(const std::string& boot_image_filename) { + // Look for "core.art" or "core-*.art". + if (android::base::EndsWith(boot_image_filename, "core.art")) { + return true; + } + if (!android::base::EndsWith(boot_image_filename, ".art")) { + return false; + } + size_t slash_pos = boot_image_filename.rfind('/'); + if (slash_pos == std::string::npos) { + return android::base::StartsWith(boot_image_filename, "core-"); + } + return boot_image_filename.compare(slash_pos + 1, 5u, "core-") == 0; +} + } // namespace art -- cgit v1.2.3-59-g8ed1b