From 27e0d1f3da2e0b7046dacb40794739d739e454a3 Mon Sep 17 00:00:00 2001 From: Calin Juravle Date: Wed, 26 Jul 2017 00:16:07 -0700 Subject: Pass the class loader context to dex2oat when optimizing at runtime Until now we always passed the special shared library symbol "&" when we called dex2oat at runtime without an explicit class path. This CL changes that and passes the class loader context inferred from the runtime class loaders to dex2oat. If any of the runtime class loaders is not supported we continue to pass the special library symbol. Bug: 38138251 Test: m test-art-host Change-Id: Ica43ee8a3f36dab2d9ed0e634a9f6341379c8e1c --- runtime/oat_file_assistant.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'runtime/oat_file_assistant.h') diff --git a/runtime/oat_file_assistant.h b/runtime/oat_file_assistant.h index 320aa4f860..5eec943689 100644 --- a/runtime/oat_file_assistant.h +++ b/runtime/oat_file_assistant.h @@ -185,12 +185,17 @@ class OatFileAssistant { // profile_changed should be true to indicate the profile has recently // changed for this dex location. // + // If the dex files need to be made up to date, class_loader_context will be + // passed to dex2oat. + // // Returns the result of attempting to update the code. // // If the result is not kUpdateSucceeded, the value of error_msg will be set // to a string describing why there was a failure or the update was not // attempted. error_msg must not be null. - ResultOfAttemptToUpdate MakeUpToDate(bool profile_changed, std::string* error_msg); + ResultOfAttemptToUpdate MakeUpToDate(bool profile_changed, + const std::string& class_loader_context, + std::string* error_msg); // Returns an oat file that can be used for loading dex files. // Returns null if no suitable oat file was found. @@ -389,7 +394,8 @@ class OatFileAssistant { }; // Generate the oat file for the given info from the dex file using the - // current runtime compiler options and the specified filter. + // current runtime compiler options, the specified filter and class loader + // context. // This does not check the current status before attempting to generate the // oat file. // @@ -398,6 +404,7 @@ class OatFileAssistant { // attempted. error_msg must not be null. ResultOfAttemptToUpdate GenerateOatFileNoChecks(OatFileInfo& info, CompilerFilter::Filter target, + const std::string& class_loader_context, std::string* error_msg); // Return info for the best oat file. -- cgit v1.2.3-59-g8ed1b