diff options
-rw-r--r-- | dex2oat/dex2oat_image_test.cc | 6 | ||||
-rw-r--r-- | dex2oat/linker/oat_writer.cc | 4 | ||||
-rw-r--r-- | runtime/jit/profile_compilation_info.cc | 14 | ||||
-rw-r--r-- | test/638-checker-inline-caches/profile | 12 | ||||
-rw-r--r-- | test/643-checker-bogus-ic/profile | 4 | ||||
-rw-r--r-- | test/648-inline-caches-unresolved/profile | 2 | ||||
-rw-r--r-- | test/661-oat-writer-layout/expected.txt | 9 | ||||
-rw-r--r-- | test/661-oat-writer-layout/profile | 9 | ||||
-rw-r--r-- | test/661-oat-writer-layout/src/Test.java | 140 | ||||
-rw-r--r-- | test/707-checker-invalid-profile/profile | 6 |
10 files changed, 96 insertions, 110 deletions
diff --git a/dex2oat/dex2oat_image_test.cc b/dex2oat/dex2oat_image_test.cc index 7ddf1c16ec..1f644c15dc 100644 --- a/dex2oat/dex2oat_image_test.cc +++ b/dex2oat/dex2oat_image_test.cc @@ -311,7 +311,11 @@ TEST_F(Dex2oatImageTest, TestModesAndFilters) { { ProfileCompilationInfo profile; VisitLibcoreDexes([&profile](MethodReference ref) { - EXPECT_TRUE(profile.AddMethodIndex(ProfileCompilationInfo::MethodHotness::kFlagHot, ref)); + uint32_t flags = ProfileCompilationInfo::MethodHotness::kFlagHot | + ProfileCompilationInfo::MethodHotness::kFlagStartup; + EXPECT_TRUE(profile.AddMethodIndex( + static_cast<ProfileCompilationInfo::MethodHotness::Flag>(flags), + ref)); }, [&profile](TypeReference ref) { EXPECT_TRUE(profile.AddClassForDex(ref)); }, kMethodFrequency, kTypeFrequency); diff --git a/dex2oat/linker/oat_writer.cc b/dex2oat/linker/oat_writer.cc index a80dbf6bda..dfbe31a548 100644 --- a/dex2oat/linker/oat_writer.cc +++ b/dex2oat/linker/oat_writer.cc @@ -961,8 +961,8 @@ struct OatWriter::OrderedMethodData { if (method_hotness.IsHot() && !method_hotness.IsStartup() && !method_hotness.IsPostStartup()) { std::string name = method_reference.PrettyMethod(); - LOG(WARNING) << "Method " << name << " had a Hot method that wasn't marked " - << "either start-up or post-startup. Possible corrupted profile?"; + LOG(FATAL) << "Method " << name << " had a Hot method that wasn't marked " + << "either start-up or post-startup. Possible corrupted profile?"; // This is not fatal, so only warn. } } diff --git a/runtime/jit/profile_compilation_info.cc b/runtime/jit/profile_compilation_info.cc index 1ed7889998..560131770f 100644 --- a/runtime/jit/profile_compilation_info.cc +++ b/runtime/jit/profile_compilation_info.cc @@ -1704,7 +1704,10 @@ bool ProfileCompilationInfo::GenerateTestProfile(int fd, if (m < (number_of_methods / kFavorSplit)) { method_idx %= kFavorFirstN; } - info.AddMethodIndex(MethodHotness::kFlagHot, + // Alternate between startup and post startup. + uint32_t flags = MethodHotness::kFlagHot; + flags |= ((m & 1) != 0) ? MethodHotness::kFlagPostStartup : MethodHotness::kFlagStartup; + info.AddMethodIndex(static_cast<MethodHotness::Flag>(flags), profile_key, /*method_idx*/ 0, method_idx, @@ -1761,8 +1764,13 @@ bool ProfileCompilationInfo::GenerateTestProfile( if (number_of_methods - i == methods_required_in_profile || std::rand() % (number_of_methods - i - methods_required_in_profile) == 0) { uint32_t method_index = (method_start_index + i) % number_of_methods; - info.AddMethodIndex(MethodHotness::kFlagHot, MethodReference(dex_file.get(), - method_index)); + // Alternate between startup and post startup. + uint32_t flags = MethodHotness::kFlagHot; + flags |= ((method_index & 1) != 0) + ? MethodHotness::kFlagPostStartup + : MethodHotness::kFlagStartup; + info.AddMethodIndex(static_cast<MethodHotness::Flag>(flags), + MethodReference(dex_file.get(), method_index)); methods_required_in_profile--; } } diff --git a/test/638-checker-inline-caches/profile b/test/638-checker-inline-caches/profile index 1ca6d7b4fe..7756a160ba 100644 --- a/test/638-checker-inline-caches/profile +++ b/test/638-checker-inline-caches/profile @@ -1,6 +1,6 @@ -LMain;->inlineMonomorphicSubA(LSuper;)I+LSubA; -LMain;->inlinePolymophicSubASubB(LSuper;)I+LSubA;,LSubB; -LMain;->inlinePolymophicCrossDexSubASubC(LSuper;)I+LSubA;,LSubC; -LMain;->inlineMegamorphic(LSuper;)I+LSubA;,LSubB;,LSubC;,LSubD;,LSubE; -LMain;->inlineMissingTypes(LSuper;)I+missing_types -LMain;->noInlineCache(LSuper;)I +HSLMain;->inlineMonomorphicSubA(LSuper;)I+LSubA; +HSLMain;->inlinePolymophicSubASubB(LSuper;)I+LSubA;,LSubB; +HSLMain;->inlinePolymophicCrossDexSubASubC(LSuper;)I+LSubA;,LSubC; +HSLMain;->inlineMegamorphic(LSuper;)I+LSubA;,LSubB;,LSubC;,LSubD;,LSubE; +HSLMain;->inlineMissingTypes(LSuper;)I+missing_types +HSLMain;->noInlineCache(LSuper;)I diff --git a/test/643-checker-bogus-ic/profile b/test/643-checker-bogus-ic/profile index cbf77961c7..540a935ff5 100644 --- a/test/643-checker-bogus-ic/profile +++ b/test/643-checker-bogus-ic/profile @@ -1,2 +1,2 @@ -LMain;->inlineMonomorphic(LMain;)I+LUnrelated; -LMain;->inlinePolymorphic(LMain;)I+LUnrelated;,LMain; +SHLMain;->inlineMonomorphic(LMain;)I+LUnrelated; +SHLMain;->inlinePolymorphic(LMain;)I+LUnrelated;,LMain; diff --git a/test/648-inline-caches-unresolved/profile b/test/648-inline-caches-unresolved/profile index 92c0a41cab..06bc8ad3f1 100644 --- a/test/648-inline-caches-unresolved/profile +++ b/test/648-inline-caches-unresolved/profile @@ -1 +1 @@ -LMain;->inlineMonomorphicUnresolvedSuper(Ljava/lang/Object;)Ljava/lang/String;+LSubclass; +SHLMain;->inlineMonomorphicUnresolvedSuper(Ljava/lang/Object;)Ljava/lang/String;+LSubclass; diff --git a/test/661-oat-writer-layout/expected.txt b/test/661-oat-writer-layout/expected.txt index db28e4f76d..b7ad70a985 100644 --- a/test/661-oat-writer-layout/expected.txt +++ b/test/661-oat-writer-layout/expected.txt @@ -8,15 +8,6 @@ B::m_c$$$ C::m_a$$$ C::m_b$$$ C::m_c$$$ -A::m_a$Hot$$ -A::m_b$Hot$$ -A::m_c$Hot$$ -B::m_a$Hot$$ -B::m_b$Hot$$ -B::m_c$Hot$$ -C::m_a$Hot$$ -C::m_b$Hot$$ -C::m_c$Hot$$ A::m_a$$Startup$ A::m_b$$Startup$ A::m_c$$Startup$ diff --git a/test/661-oat-writer-layout/profile b/test/661-oat-writer-layout/profile index 54064843ce..cf307c2aa9 100644 --- a/test/661-oat-writer-layout/profile +++ b/test/661-oat-writer-layout/profile @@ -1,60 +1,51 @@ -HLA;->m_a$Hot$$()V SLA;->m_a$$Startup$()V HSLA;->m_a$Hot$Startup$()V PLA;->m_a$$$Poststartup()V HPLA;->m_a$Hot$$Poststartup()V SPLA;->m_a$$Startup$Poststartup()V HSPLA;->m_a$Hot$Startup$Poststartup()V -HLA;->m_b$Hot$$()V SLA;->m_b$$Startup$()V HSLA;->m_b$Hot$Startup$()V PLA;->m_b$$$Poststartup()V HPLA;->m_b$Hot$$Poststartup()V SPLA;->m_b$$Startup$Poststartup()V HSPLA;->m_b$Hot$Startup$Poststartup()V -HLA;->m_c$Hot$$()V SLA;->m_c$$Startup$()V HSLA;->m_c$Hot$Startup$()V PLA;->m_c$$$Poststartup()V HPLA;->m_c$Hot$$Poststartup()V SPLA;->m_c$$Startup$Poststartup()V HSPLA;->m_c$Hot$Startup$Poststartup()V -HLB;->m_a$Hot$$()V SLB;->m_a$$Startup$()V HSLB;->m_a$Hot$Startup$()V PLB;->m_a$$$Poststartup()V HPLB;->m_a$Hot$$Poststartup()V SPLB;->m_a$$Startup$Poststartup()V HSPLB;->m_a$Hot$Startup$Poststartup()V -HLB;->m_b$Hot$$()V SLB;->m_b$$Startup$()V HSLB;->m_b$Hot$Startup$()V PLB;->m_b$$$Poststartup()V HPLB;->m_b$Hot$$Poststartup()V SPLB;->m_b$$Startup$Poststartup()V HSPLB;->m_b$Hot$Startup$Poststartup()V -HLB;->m_c$Hot$$()V SLB;->m_c$$Startup$()V HSLB;->m_c$Hot$Startup$()V PLB;->m_c$$$Poststartup()V HPLB;->m_c$Hot$$Poststartup()V SPLB;->m_c$$Startup$Poststartup()V HSPLB;->m_c$Hot$Startup$Poststartup()V -HLC;->m_a$Hot$$()V SLC;->m_a$$Startup$()V HSLC;->m_a$Hot$Startup$()V PLC;->m_a$$$Poststartup()V HPLC;->m_a$Hot$$Poststartup()V SPLC;->m_a$$Startup$Poststartup()V HSPLC;->m_a$Hot$Startup$Poststartup()V -HLC;->m_b$Hot$$()V SLC;->m_b$$Startup$()V HSLC;->m_b$Hot$Startup$()V PLC;->m_b$$$Poststartup()V HPLC;->m_b$Hot$$Poststartup()V SPLC;->m_b$$Startup$Poststartup()V HSPLC;->m_b$Hot$Startup$Poststartup()V -HLC;->m_c$Hot$$()V SLC;->m_c$$Startup$()V HSLC;->m_c$Hot$Startup$()V PLC;->m_c$$$Poststartup()V diff --git a/test/661-oat-writer-layout/src/Test.java b/test/661-oat-writer-layout/src/Test.java index db67b482a2..f862e3755b 100644 --- a/test/661-oat-writer-layout/src/Test.java +++ b/test/661-oat-writer-layout/src/Test.java @@ -13,86 +13,78 @@ // limitations under the License. import java.lang.reflect.Method; +import java.util.ArrayList; public class Test { // Returns list of all methods in Generated.java // This is to avoid having to introspect classes with extra code // (for example, we ignore <init> methods). public static Method[] getTestMethods() throws NoSuchMethodException, SecurityException { - Method[] all_methods = new Method[72]; - all_methods[0] = A.class.getDeclaredMethod("m_a$$$"); - all_methods[1] = A.class.getDeclaredMethod("m_a$Hot$$"); - all_methods[2] = A.class.getDeclaredMethod("m_a$$Startup$"); - all_methods[3] = A.class.getDeclaredMethod("m_a$Hot$Startup$"); - all_methods[4] = A.class.getDeclaredMethod("m_a$$$Poststartup"); - all_methods[5] = A.class.getDeclaredMethod("m_a$Hot$$Poststartup"); - all_methods[6] = A.class.getDeclaredMethod("m_a$$Startup$Poststartup"); - all_methods[7] = A.class.getDeclaredMethod("m_a$Hot$Startup$Poststartup"); - all_methods[8] = A.class.getDeclaredMethod("m_b$$$"); - all_methods[9] = A.class.getDeclaredMethod("m_b$Hot$$"); - all_methods[10] = A.class.getDeclaredMethod("m_b$$Startup$"); - all_methods[11] = A.class.getDeclaredMethod("m_b$Hot$Startup$"); - all_methods[12] = A.class.getDeclaredMethod("m_b$$$Poststartup"); - all_methods[13] = A.class.getDeclaredMethod("m_b$Hot$$Poststartup"); - all_methods[14] = A.class.getDeclaredMethod("m_b$$Startup$Poststartup"); - all_methods[15] = A.class.getDeclaredMethod("m_b$Hot$Startup$Poststartup"); - all_methods[16] = A.class.getDeclaredMethod("m_c$$$"); - all_methods[17] = A.class.getDeclaredMethod("m_c$Hot$$"); - all_methods[18] = A.class.getDeclaredMethod("m_c$$Startup$"); - all_methods[19] = A.class.getDeclaredMethod("m_c$Hot$Startup$"); - all_methods[20] = A.class.getDeclaredMethod("m_c$$$Poststartup"); - all_methods[21] = A.class.getDeclaredMethod("m_c$Hot$$Poststartup"); - all_methods[22] = A.class.getDeclaredMethod("m_c$$Startup$Poststartup"); - all_methods[23] = A.class.getDeclaredMethod("m_c$Hot$Startup$Poststartup"); - all_methods[24] = B.class.getDeclaredMethod("m_a$$$"); - all_methods[25] = B.class.getDeclaredMethod("m_a$Hot$$"); - all_methods[26] = B.class.getDeclaredMethod("m_a$$Startup$"); - all_methods[27] = B.class.getDeclaredMethod("m_a$Hot$Startup$"); - all_methods[28] = B.class.getDeclaredMethod("m_a$$$Poststartup"); - all_methods[29] = B.class.getDeclaredMethod("m_a$Hot$$Poststartup"); - all_methods[30] = B.class.getDeclaredMethod("m_a$$Startup$Poststartup"); - all_methods[31] = B.class.getDeclaredMethod("m_a$Hot$Startup$Poststartup"); - all_methods[32] = B.class.getDeclaredMethod("m_b$$$"); - all_methods[33] = B.class.getDeclaredMethod("m_b$Hot$$"); - all_methods[34] = B.class.getDeclaredMethod("m_b$$Startup$"); - all_methods[35] = B.class.getDeclaredMethod("m_b$Hot$Startup$"); - all_methods[36] = B.class.getDeclaredMethod("m_b$$$Poststartup"); - all_methods[37] = B.class.getDeclaredMethod("m_b$Hot$$Poststartup"); - all_methods[38] = B.class.getDeclaredMethod("m_b$$Startup$Poststartup"); - all_methods[39] = B.class.getDeclaredMethod("m_b$Hot$Startup$Poststartup"); - all_methods[40] = B.class.getDeclaredMethod("m_c$$$"); - all_methods[41] = B.class.getDeclaredMethod("m_c$Hot$$"); - all_methods[42] = B.class.getDeclaredMethod("m_c$$Startup$"); - all_methods[43] = B.class.getDeclaredMethod("m_c$Hot$Startup$"); - all_methods[44] = B.class.getDeclaredMethod("m_c$$$Poststartup"); - all_methods[45] = B.class.getDeclaredMethod("m_c$Hot$$Poststartup"); - all_methods[46] = B.class.getDeclaredMethod("m_c$$Startup$Poststartup"); - all_methods[47] = B.class.getDeclaredMethod("m_c$Hot$Startup$Poststartup"); - all_methods[48] = C.class.getDeclaredMethod("m_a$$$"); - all_methods[49] = C.class.getDeclaredMethod("m_a$Hot$$"); - all_methods[50] = C.class.getDeclaredMethod("m_a$$Startup$"); - all_methods[51] = C.class.getDeclaredMethod("m_a$Hot$Startup$"); - all_methods[52] = C.class.getDeclaredMethod("m_a$$$Poststartup"); - all_methods[53] = C.class.getDeclaredMethod("m_a$Hot$$Poststartup"); - all_methods[54] = C.class.getDeclaredMethod("m_a$$Startup$Poststartup"); - all_methods[55] = C.class.getDeclaredMethod("m_a$Hot$Startup$Poststartup"); - all_methods[56] = C.class.getDeclaredMethod("m_b$$$"); - all_methods[57] = C.class.getDeclaredMethod("m_b$Hot$$"); - all_methods[58] = C.class.getDeclaredMethod("m_b$$Startup$"); - all_methods[59] = C.class.getDeclaredMethod("m_b$Hot$Startup$"); - all_methods[60] = C.class.getDeclaredMethod("m_b$$$Poststartup"); - all_methods[61] = C.class.getDeclaredMethod("m_b$Hot$$Poststartup"); - all_methods[62] = C.class.getDeclaredMethod("m_b$$Startup$Poststartup"); - all_methods[63] = C.class.getDeclaredMethod("m_b$Hot$Startup$Poststartup"); - all_methods[64] = C.class.getDeclaredMethod("m_c$$$"); - all_methods[65] = C.class.getDeclaredMethod("m_c$Hot$$"); - all_methods[66] = C.class.getDeclaredMethod("m_c$$Startup$"); - all_methods[67] = C.class.getDeclaredMethod("m_c$Hot$Startup$"); - all_methods[68] = C.class.getDeclaredMethod("m_c$$$Poststartup"); - all_methods[69] = C.class.getDeclaredMethod("m_c$Hot$$Poststartup"); - all_methods[70] = C.class.getDeclaredMethod("m_c$$Startup$Poststartup"); - all_methods[71] = C.class.getDeclaredMethod("m_c$Hot$Startup$Poststartup"); - return all_methods; + ArrayList<Method> all_methods = new ArrayList<Method>(); + all_methods.add(A.class.getDeclaredMethod("m_a$$$")); + all_methods.add(A.class.getDeclaredMethod("m_a$$Startup$")); + all_methods.add(A.class.getDeclaredMethod("m_a$Hot$Startup$")); + all_methods.add(A.class.getDeclaredMethod("m_a$$$Poststartup")); + all_methods.add(A.class.getDeclaredMethod("m_a$Hot$$Poststartup")); + all_methods.add(A.class.getDeclaredMethod("m_a$$Startup$Poststartup")); + all_methods.add(A.class.getDeclaredMethod("m_a$Hot$Startup$Poststartup")); + all_methods.add(A.class.getDeclaredMethod("m_b$$$")); + all_methods.add(A.class.getDeclaredMethod("m_b$$Startup$")); + all_methods.add(A.class.getDeclaredMethod("m_b$Hot$Startup$")); + all_methods.add(A.class.getDeclaredMethod("m_b$$$Poststartup")); + all_methods.add(A.class.getDeclaredMethod("m_b$Hot$$Poststartup")); + all_methods.add(A.class.getDeclaredMethod("m_b$$Startup$Poststartup")); + all_methods.add(A.class.getDeclaredMethod("m_b$Hot$Startup$Poststartup")); + all_methods.add(A.class.getDeclaredMethod("m_c$$$")); + all_methods.add(A.class.getDeclaredMethod("m_c$$Startup$")); + all_methods.add(A.class.getDeclaredMethod("m_c$Hot$Startup$")); + all_methods.add(A.class.getDeclaredMethod("m_c$$$Poststartup")); + all_methods.add(A.class.getDeclaredMethod("m_c$Hot$$Poststartup")); + all_methods.add(A.class.getDeclaredMethod("m_c$$Startup$Poststartup")); + all_methods.add(A.class.getDeclaredMethod("m_c$Hot$Startup$Poststartup")); + all_methods.add(B.class.getDeclaredMethod("m_a$$$")); + all_methods.add(B.class.getDeclaredMethod("m_a$$Startup$")); + all_methods.add(B.class.getDeclaredMethod("m_a$Hot$Startup$")); + all_methods.add(B.class.getDeclaredMethod("m_a$$$Poststartup")); + all_methods.add(B.class.getDeclaredMethod("m_a$Hot$$Poststartup")); + all_methods.add(B.class.getDeclaredMethod("m_a$$Startup$Poststartup")); + all_methods.add(B.class.getDeclaredMethod("m_a$Hot$Startup$Poststartup")); + all_methods.add(B.class.getDeclaredMethod("m_b$$$")); + all_methods.add(B.class.getDeclaredMethod("m_b$$Startup$")); + all_methods.add(B.class.getDeclaredMethod("m_b$Hot$Startup$")); + all_methods.add(B.class.getDeclaredMethod("m_b$$$Poststartup")); + all_methods.add(B.class.getDeclaredMethod("m_b$Hot$$Poststartup")); + all_methods.add(B.class.getDeclaredMethod("m_b$$Startup$Poststartup")); + all_methods.add(B.class.getDeclaredMethod("m_b$Hot$Startup$Poststartup")); + all_methods.add(B.class.getDeclaredMethod("m_c$$$")); + all_methods.add(B.class.getDeclaredMethod("m_c$$Startup$")); + all_methods.add(B.class.getDeclaredMethod("m_c$Hot$Startup$")); + all_methods.add(B.class.getDeclaredMethod("m_c$$$Poststartup")); + all_methods.add(B.class.getDeclaredMethod("m_c$Hot$$Poststartup")); + all_methods.add(B.class.getDeclaredMethod("m_c$$Startup$Poststartup")); + all_methods.add(B.class.getDeclaredMethod("m_c$Hot$Startup$Poststartup")); + all_methods.add(C.class.getDeclaredMethod("m_a$$$")); + all_methods.add(C.class.getDeclaredMethod("m_a$$Startup$")); + all_methods.add(C.class.getDeclaredMethod("m_a$Hot$Startup$")); + all_methods.add(C.class.getDeclaredMethod("m_a$$$Poststartup")); + all_methods.add(C.class.getDeclaredMethod("m_a$Hot$$Poststartup")); + all_methods.add(C.class.getDeclaredMethod("m_a$$Startup$Poststartup")); + all_methods.add(C.class.getDeclaredMethod("m_a$Hot$Startup$Poststartup")); + all_methods.add(C.class.getDeclaredMethod("m_b$$$")); + all_methods.add(C.class.getDeclaredMethod("m_b$$Startup$")); + all_methods.add(C.class.getDeclaredMethod("m_b$Hot$Startup$")); + all_methods.add(C.class.getDeclaredMethod("m_b$$$Poststartup")); + all_methods.add(C.class.getDeclaredMethod("m_b$Hot$$Poststartup")); + all_methods.add(C.class.getDeclaredMethod("m_b$$Startup$Poststartup")); + all_methods.add(C.class.getDeclaredMethod("m_b$Hot$Startup$Poststartup")); + all_methods.add(C.class.getDeclaredMethod("m_c$$$")); + all_methods.add(C.class.getDeclaredMethod("m_c$$Startup$")); + all_methods.add(C.class.getDeclaredMethod("m_c$Hot$Startup$")); + all_methods.add(C.class.getDeclaredMethod("m_c$$$Poststartup")); + all_methods.add(C.class.getDeclaredMethod("m_c$Hot$$Poststartup")); + all_methods.add(C.class.getDeclaredMethod("m_c$$Startup$Poststartup")); + all_methods.add(C.class.getDeclaredMethod("m_c$Hot$Startup$Poststartup")); + return all_methods.toArray(new Method[all_methods.size()]); } } diff --git a/test/707-checker-invalid-profile/profile b/test/707-checker-invalid-profile/profile index 5979dd281d..f142c40ed9 100644 --- a/test/707-checker-invalid-profile/profile +++ b/test/707-checker-invalid-profile/profile @@ -1,4 +1,4 @@ -LMain;->attemptInlineMonomorphic(LMain;)I+invalid_class -LMain;->attemptInlinePolymorphic(LMain;)I+LMain;,invalid_class -LMain;->invalid_method +SHLMain;->attemptInlineMonomorphic(LMain;)I+invalid_class +SHLMain;->attemptInlinePolymorphic(LMain;)I+LMain;,invalid_class +SHLMain;->invalid_method invalid_class
\ No newline at end of file |