summaryrefslogtreecommitdiff
path: root/dexoptanalyzer
diff options
context:
space:
mode:
authorStefania Halac <shalac@google.com>2020-02-14 17:58:26 +0000
committerStefania Halac <shalac@google.com>2020-02-14 19:36:44 +0000
commite9818ddd70565d52cc1cc93d6991d7e7ec2bc275 (patch)
treec2deb578605ebfa0511532b8d7ca908fa4c71092 /dexoptanalyzer
parent1d852c36ad84e6f32132b215af079546300bfc28 (diff)
Revert "Make class loader context fail for unknown class loaders"
This reverts commit 2d3de3a40015af07f7645a298f77b398af0c6c2c. Reason for revert: 8s regression in boot time b/149517940 Change-Id: I81365d1bd63c691d715b8f970dac9da64ab419ff
Diffstat (limited to 'dexoptanalyzer')
-rw-r--r--dexoptanalyzer/dexoptanalyzer.cc6
-rw-r--r--dexoptanalyzer/dexoptanalyzer_test.cc21
2 files changed, 10 insertions, 17 deletions
diff --git a/dexoptanalyzer/dexoptanalyzer.cc b/dexoptanalyzer/dexoptanalyzer.cc
index 7454993eca..b4111186c5 100644
--- a/dexoptanalyzer/dexoptanalyzer.cc
+++ b/dexoptanalyzer/dexoptanalyzer.cc
@@ -319,10 +319,10 @@ class DexoptAnalyzer final {
}
int dexoptNeeded = oat_file_assistant->GetDexOptNeeded(compiler_filter_,
- class_loader_context.get(),
- context_fds_,
assume_profile_changed_,
- downgrade_);
+ downgrade_,
+ class_loader_context.get(),
+ context_fds_);
// Convert OatFileAssitant codes to dexoptanalyzer codes.
switch (dexoptNeeded) {
diff --git a/dexoptanalyzer/dexoptanalyzer_test.cc b/dexoptanalyzer/dexoptanalyzer_test.cc
index 651fa4ae7b..65b50358d8 100644
--- a/dexoptanalyzer/dexoptanalyzer_test.cc
+++ b/dexoptanalyzer/dexoptanalyzer_test.cc
@@ -36,7 +36,7 @@ class DexoptAnalyzerTest : public DexoptTest {
int Analyze(const std::string& dex_file,
CompilerFilter::Filter compiler_filter,
bool assume_profile_changed,
- const char* class_loader_context) {
+ const std::string& class_loader_context) {
std::string dexoptanalyzer_cmd = GetDexoptAnalyzerCmd();
std::vector<std::string> argv_str;
argv_str.push_back(dexoptanalyzer_cmd);
@@ -52,8 +52,8 @@ class DexoptAnalyzerTest : public DexoptTest {
argv_str.push_back(GetClassPathOption("-Xbootclasspath-locations:", GetLibCoreDexLocations()));
argv_str.push_back("--image=" + GetImageLocation());
argv_str.push_back("--android-data=" + android_data_);
- if (class_loader_context != nullptr) {
- argv_str.push_back("--class-loader-context=" + std::string(class_loader_context));
+ if (!class_loader_context.empty()) {
+ argv_str.push_back("--class-loader-context=" + class_loader_context);
}
std::string error;
@@ -78,19 +78,13 @@ class DexoptAnalyzerTest : public DexoptTest {
CompilerFilter::Filter compiler_filter,
bool assume_profile_changed = false,
bool downgrade = false,
- const char* class_loader_context = "PCL[]") {
+ const std::string& class_loader_context = "") {
int dexoptanalyzerResult = Analyze(
dex_file, compiler_filter, assume_profile_changed, class_loader_context);
dexoptanalyzerResult = DexoptanalyzerToOatFileAssistant(dexoptanalyzerResult);
OatFileAssistant oat_file_assistant(dex_file.c_str(), kRuntimeISA, /*load_executable=*/ false);
- std::vector<int> context_fds;
-
- std::unique_ptr<ClassLoaderContext> context = class_loader_context == nullptr
- ? nullptr
- : ClassLoaderContext::Create(class_loader_context);
-
int assistantResult = oat_file_assistant.GetDexOptNeeded(
- compiler_filter, context.get(), context_fds, assume_profile_changed, downgrade);
+ compiler_filter, assume_profile_changed, downgrade);
EXPECT_EQ(assistantResult, dexoptanalyzerResult);
}
};
@@ -106,7 +100,6 @@ TEST_F(DexoptAnalyzerTest, DexNoOat) {
Verify(dex_location, CompilerFilter::kExtract);
Verify(dex_location, CompilerFilter::kQuicken);
Verify(dex_location, CompilerFilter::kSpeedProfile);
- Verify(dex_location, CompilerFilter::kSpeed, false, false, nullptr);
}
// Case: We have a DEX file and up-to-date OAT file for it.
@@ -119,7 +112,6 @@ TEST_F(DexoptAnalyzerTest, OatUpToDate) {
Verify(dex_location, CompilerFilter::kQuicken);
Verify(dex_location, CompilerFilter::kExtract);
Verify(dex_location, CompilerFilter::kEverything);
- Verify(dex_location, CompilerFilter::kSpeed, false, false, nullptr);
}
// Case: We have a DEX file and speed-profile OAT file for it.
@@ -333,6 +325,7 @@ TEST_F(DexoptAnalyzerTest, ClassLoaderContext) {
// Generate the odex to get the class loader context also open the dex files.
GenerateOdexForTest(dex_location1, odex_location1, CompilerFilter::kSpeed, /* compilation_reason= */ nullptr, /* extra_args= */ { class_loader_context_option });
- Verify(dex_location1, CompilerFilter::kSpeed, false, false, class_loader_context.c_str());
+ Verify(dex_location1, CompilerFilter::kSpeed, false, false, class_loader_context);
}
+
} // namespace art