diff options
author | 2018-11-21 22:25:21 +0000 | |
---|---|---|
committer | 2018-11-21 22:25:21 +0000 | |
commit | f759dc027507d0092a49d9ec146dc37ca4534dd4 (patch) | |
tree | b500f8a4724876b45b9ea49676defd1152c5ac84 /compiler/driver/compiler_driver.cc | |
parent | 5a78e8dbf068c544b84e98f636b30045b09451c4 (diff) | |
parent | 5c803116e26ef40ad2a9c14d3411e21d149e0c9b (diff) |
Merge "ART: Add profile-compile-check support"
Diffstat (limited to 'compiler/driver/compiler_driver.cc')
-rw-r--r-- | compiler/driver/compiler_driver.cc | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc index 77b0cea311..67cabef641 100644 --- a/compiler/driver/compiler_driver.cc +++ b/compiler/driver/compiler_driver.cc @@ -24,6 +24,7 @@ #include <malloc.h> // For mallinfo #endif +#include "android-base/logging.h" #include "android-base/strings.h" #include "art_field-inl.h" @@ -598,6 +599,29 @@ static void CompileMethodQuick( class_loader, dex_file, dex_cache); + ProfileMethodsCheck check_type = + driver->GetCompilerOptions().CheckProfiledMethodsCompiled(); + if (UNLIKELY(check_type != ProfileMethodsCheck::kNone)) { + bool violation = driver->ShouldCompileBasedOnProfile(method_ref) && + (compiled_method == nullptr); + if (violation) { + std::ostringstream oss; + oss << "Failed to compile " + << method_ref.dex_file->PrettyMethod(method_ref.index) + << "[" << method_ref.dex_file->GetLocation() << "]" + << " as expected by profile"; + switch (check_type) { + case ProfileMethodsCheck::kNone: + break; + case ProfileMethodsCheck::kLog: + LOG(ERROR) << oss.str(); + break; + case ProfileMethodsCheck::kAbort: + LOG(FATAL_WITHOUT_ABORT) << oss.str(); + _exit(1); + } + } + } } if (compiled_method == nullptr && dex_to_dex_compilation_level != |