Revert "Revert "Make class loader context fail for unknown class loaders""
This reverts commit e9818ddd70565d52cc1cc93d6991d7e7ec2bc275.
Make class loader context fail for unknown class loaders
Update OatFileAssistant to fail the class loader check when getting an
unknown (null) class loader. The code is only use in GetDexoptNeeded paths
and does not affect the runtime behaviour.
This will enable dexoptanalyzer to provide the right answer for dex files
whose class loader changes often.
Test: test-art-host
Bug: 147208643
Change-Id: I2f8229fc25c018436c17439bdc9ac0899af25758
diff --git a/runtime/oat_file_assistant.h b/runtime/oat_file_assistant.h
index b5812f9..aa4d83b 100644
--- a/runtime/oat_file_assistant.h
+++ b/runtime/oat_file_assistant.h
@@ -144,10 +144,10 @@
// the oat location. Returns a negative status code if the status refers to
// the oat file in the odex location.
int GetDexOptNeeded(CompilerFilter::Filter target_compiler_filter,
+ ClassLoaderContext* context,
+ const std::vector<int>& context_fds,
bool profile_changed = false,
- bool downgrade = false,
- ClassLoaderContext* context = nullptr,
- const std::vector<int>& context_fds = std::vector<int>());
+ bool downgrade = false);
// Returns true if there is up-to-date code for this dex location,
// irrespective of the compiler filter of the up-to-date code.
@@ -292,10 +292,10 @@
// downgrade should be true if the purpose of dexopt is to downgrade the
// compiler filter.
DexOptNeeded GetDexOptNeeded(CompilerFilter::Filter target_compiler_filter,
- bool profile_changed,
- bool downgrade,
ClassLoaderContext* context,
- const std::vector<int>& context_fds);
+ const std::vector<int>& context_fds,
+ bool profile_changed,
+ bool downgrade);
// Returns the loaded file.
// Loads the file if needed. Returns null if the file failed to load.