diff options
-rw-r--r-- | dex2oat/dex2oat.cc | 2 | ||||
-rw-r--r-- | runtime/class_loader_context_test.cc | 8 | ||||
-rw-r--r-- | runtime/dex_file.h | 6 | ||||
-rw-r--r-- | runtime/dex_file_test.cc | 12 | ||||
-rw-r--r-- | runtime/jit/profile_compilation_info.cc | 7 | ||||
-rw-r--r-- | runtime/native/java_lang_VMClassLoader.cc | 2 | ||||
-rw-r--r-- | runtime/oat.h | 4 | ||||
-rw-r--r-- | runtime/oat_file.h | 4 | ||||
-rw-r--r-- | runtime/oat_file_test.cc | 8 | ||||
-rwxr-xr-x | test/569-checker-pattern-replacement/run | 2 |
10 files changed, 31 insertions, 24 deletions
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc index c9cd17142e..c4b099cbac 100644 --- a/dex2oat/dex2oat.cc +++ b/dex2oat/dex2oat.cc @@ -1787,7 +1787,7 @@ class Dex2Oat FINAL { for (const DexFile* dex_file : *dex_file_vector) { for (const std::string& filter : no_inline_filters) { // Use dex_file->GetLocation() rather than dex_file->GetBaseLocation(). This - // allows tests to specify <test-dexfile>:classes2.dex if needed but if the + // allows tests to specify <test-dexfile>!classes2.dex if needed but if the // base location passes the StartsWith() test, so do all extra locations. std::string dex_location = dex_file->GetLocation(); if (filter.find('/') == std::string::npos) { diff --git a/runtime/class_loader_context_test.cc b/runtime/class_loader_context_test.cc index 1b46f67215..a87552d5dc 100644 --- a/runtime/class_loader_context_test.cc +++ b/runtime/class_loader_context_test.cc @@ -488,4 +488,12 @@ TEST_F(ClassLoaderContextTest, VerifyClassLoaderContextMatchAfterEncoding) { ASSERT_TRUE(context->VerifyClassLoaderContextMatch(context->EncodeContextForOatFile(""))); } +TEST_F(ClassLoaderContextTest, VerifyClassLoaderContextMatchAfterEncodingMultidex) { + jobject class_loader = LoadDexInPathClassLoader("MultiDex", nullptr); + + std::unique_ptr<ClassLoaderContext> context = CreateContextForClassLoader(class_loader); + + ASSERT_TRUE(context->VerifyClassLoaderContextMatch(context->EncodeContextForOatFile(""))); +} + } // namespace art diff --git a/runtime/dex_file.h b/runtime/dex_file.h index eb3b210cd1..990ab118e7 100644 --- a/runtime/dex_file.h +++ b/runtime/dex_file.h @@ -62,11 +62,11 @@ class DexFile { static const uint16_t kDexNoIndex16 = 0xFFFF; // The separator character in MultiDex locations. - static constexpr char kMultiDexSeparator = ':'; + static constexpr char kMultiDexSeparator = '!'; // A string version of the previous. This is a define so that we can merge string literals in the // preprocessor. - #define kMultiDexSeparatorString ":" + #define kMultiDexSeparatorString "!" // Raw header_item. struct Header { @@ -499,7 +499,7 @@ class DexFile { return GetBaseLocation(location.c_str()); } - // Returns the ':classes*.dex' part of the dex location. Returns an empty + // Returns the '!classes*.dex' part of the dex location. Returns an empty // string if there is no multidex suffix for the given location. // The kMultiDexSeparator is included in the returned suffix. static std::string GetMultiDexSuffix(const std::string& location) { diff --git a/runtime/dex_file_test.cc b/runtime/dex_file_test.cc index 78d5c5f4ba..1a73062068 100644 --- a/runtime/dex_file_test.cc +++ b/runtime/dex_file_test.cc @@ -535,9 +535,9 @@ TEST_F(DexFileTest, GetMultiDexLocation) { std::string dex_location_str = "/system/app/framework.jar"; const char* dex_location = dex_location_str.c_str(); ASSERT_EQ("/system/app/framework.jar", DexFile::GetMultiDexLocation(0, dex_location)); - ASSERT_EQ("/system/app/framework.jar:classes2.dex", + ASSERT_EQ("/system/app/framework.jar!classes2.dex", DexFile::GetMultiDexLocation(1, dex_location)); - ASSERT_EQ("/system/app/framework.jar:classes101.dex", + ASSERT_EQ("/system/app/framework.jar!classes101.dex", DexFile::GetMultiDexLocation(100, dex_location)); } @@ -563,11 +563,11 @@ TEST_F(DexFileTest, GetDexCanonicalLocation) { TEST(DexFileUtilsTest, GetBaseLocationAndMultiDexSuffix) { EXPECT_EQ("/foo/bar/baz.jar", DexFile::GetBaseLocation("/foo/bar/baz.jar")); - EXPECT_EQ("/foo/bar/baz.jar", DexFile::GetBaseLocation("/foo/bar/baz.jar:classes2.dex")); - EXPECT_EQ("/foo/bar/baz.jar", DexFile::GetBaseLocation("/foo/bar/baz.jar:classes8.dex")); + EXPECT_EQ("/foo/bar/baz.jar", DexFile::GetBaseLocation("/foo/bar/baz.jar!classes2.dex")); + EXPECT_EQ("/foo/bar/baz.jar", DexFile::GetBaseLocation("/foo/bar/baz.jar!classes8.dex")); EXPECT_EQ("", DexFile::GetMultiDexSuffix("/foo/bar/baz.jar")); - EXPECT_EQ(":classes2.dex", DexFile::GetMultiDexSuffix("/foo/bar/baz.jar:classes2.dex")); - EXPECT_EQ(":classes8.dex", DexFile::GetMultiDexSuffix("/foo/bar/baz.jar:classes8.dex")); + EXPECT_EQ("!classes2.dex", DexFile::GetMultiDexSuffix("/foo/bar/baz.jar!classes2.dex")); + EXPECT_EQ("!classes8.dex", DexFile::GetMultiDexSuffix("/foo/bar/baz.jar!classes8.dex")); } TEST_F(DexFileTest, ZipOpenClassesPresent) { diff --git a/runtime/jit/profile_compilation_info.cc b/runtime/jit/profile_compilation_info.cc index a247b56587..45c3792580 100644 --- a/runtime/jit/profile_compilation_info.cc +++ b/runtime/jit/profile_compilation_info.cc @@ -47,9 +47,8 @@ namespace art { const uint8_t ProfileCompilationInfo::kProfileMagic[] = { 'p', 'r', 'o', '\0' }; -// Last profile version: Move startup methods to use a bitmap. Also add support for post-startup -// methods. -const uint8_t ProfileCompilationInfo::kProfileVersion[] = { '0', '0', '8', '\0' }; +// Last profile version: update the multidex separator. +const uint8_t ProfileCompilationInfo::kProfileVersion[] = { '0', '0', '9', '\0' }; static constexpr uint16_t kMaxDexFileKeyLength = PATH_MAX; @@ -1341,7 +1340,7 @@ std::string ProfileCompilationInfo::DumpInfo(const std::vector<const DexFile*>* os << "ProfileInfo:"; - const std::string kFirstDexFileKeySubstitute = ":classes.dex"; + const std::string kFirstDexFileKeySubstitute = "!classes.dex"; for (const DexFileData* dex_data : info_) { os << "\n"; diff --git a/runtime/native/java_lang_VMClassLoader.cc b/runtime/native/java_lang_VMClassLoader.cc index fc50d5584d..57c313e933 100644 --- a/runtime/native/java_lang_VMClassLoader.cc +++ b/runtime/native/java_lang_VMClassLoader.cc @@ -135,7 +135,7 @@ static jobjectArray VMClassLoader_getBootClassPathEntries(JNIEnv* env, jclass) { for (size_t i = 0; i < path.size(); ++i) { const DexFile* dex_file = path[i]; - // For multidex locations, e.g., x.jar:classes2.dex, we want to look into x.jar. + // For multidex locations, e.g., x.jar!classes2.dex, we want to look into x.jar. const std::string& location(dex_file->GetBaseLocation()); ScopedLocalRef<jstring> javaPath(env, env->NewStringUTF(location.c_str())); diff --git a/runtime/oat.h b/runtime/oat.h index f4edb16bce..de4b942bad 100644 --- a/runtime/oat.h +++ b/runtime/oat.h @@ -32,8 +32,8 @@ class InstructionSetFeatures; class PACKED(4) OatHeader { public: static constexpr uint8_t kOatMagic[] = { 'o', 'a', 't', '\n' }; - // Last oat version changed reason: add new class status to skip superclass validation. - static constexpr uint8_t kOatVersion[] = { '1', '2', '9', '\0' }; + // Last oat version changed reason: update kMultiDexSeparator from ':' to '!'. + static constexpr uint8_t kOatVersion[] = { '1', '3', '0', '\0' }; static constexpr const char* kImageLocationKey = "image-location"; static constexpr const char* kDex2OatCmdLineKey = "dex2oat-cmdline"; diff --git a/runtime/oat_file.h b/runtime/oat_file.h index b112b84564..be7d4953a0 100644 --- a/runtime/oat_file.h +++ b/runtime/oat_file.h @@ -289,8 +289,8 @@ class OatFile { // If not null, abs_dex_location is used to resolve the absolute dex // location of relative dex locations encoded in the oat file. // For example, given absolute location "/data/app/foo/base.apk", encoded - // dex locations "base.apk", "base.apk:classes2.dex", etc. would be resolved - // to "/data/app/foo/base.apk", "/data/app/foo/base.apk:classes2.dex", etc. + // dex locations "base.apk", "base.apk!classes2.dex", etc. would be resolved + // to "/data/app/foo/base.apk", "/data/app/foo/base.apk!classes2.dex", etc. // Relative encoded dex locations that don't match the given abs_dex_location // are left unchanged. static std::string ResolveRelativeEncodedDexLocation( diff --git a/runtime/oat_file_test.cc b/runtime/oat_file_test.cc index d5fe1f382a..7bf0f84596 100644 --- a/runtime/oat_file_test.cc +++ b/runtime/oat_file_test.cc @@ -45,13 +45,13 @@ TEST_F(OatFileTest, ResolveRelativeEncodedDexLocation) { OatFile::ResolveRelativeEncodedDexLocation( "/data/app/foo/base.apk", "foo/base.apk")); - EXPECT_EQ(std::string("/data/app/foo/base.apk:classes2.dex"), + EXPECT_EQ(std::string("/data/app/foo/base.apk!classes2.dex"), OatFile::ResolveRelativeEncodedDexLocation( - "/data/app/foo/base.apk", "base.apk:classes2.dex")); + "/data/app/foo/base.apk", "base.apk!classes2.dex")); - EXPECT_EQ(std::string("/data/app/foo/base.apk:classes11.dex"), + EXPECT_EQ(std::string("/data/app/foo/base.apk!classes11.dex"), OatFile::ResolveRelativeEncodedDexLocation( - "/data/app/foo/base.apk", "base.apk:classes11.dex")); + "/data/app/foo/base.apk", "base.apk!classes11.dex")); EXPECT_EQ(std::string("base.apk"), OatFile::ResolveRelativeEncodedDexLocation( diff --git a/test/569-checker-pattern-replacement/run b/test/569-checker-pattern-replacement/run index f7e9df211f..8ab6527346 100755 --- a/test/569-checker-pattern-replacement/run +++ b/test/569-checker-pattern-replacement/run @@ -15,4 +15,4 @@ # limitations under the License. exec ${RUN} "$@" \ - -Xcompiler-option --no-inline-from=core-oj,569-checker-pattern-replacement.jar:classes2.dex + -Xcompiler-option --no-inline-from="core-oj,569-checker-pattern-replacement.jar!classes2.dex" |