diff options
author | Calin Juravle <calin@google.com> | 2015-04-13 18:42:21 +0100 |
---|---|---|
committer | Calin Juravle <calin@google.com> | 2015-04-16 16:28:11 +0100 |
commit | f1c6d9e87cbfd27702103ccc7c7f08ce784dc872 (patch) | |
tree | 45ad9f5bb52eb0db3857e344ab67b5aab2309472 /compiler/driver/compiler_driver.cc | |
parent | e015a31e509c3f4de8a90b57b77329ba6609ce2f (diff) | |
download | android_art-f1c6d9e87cbfd27702103ccc7c7f08ce784dc872.tar.gz android_art-f1c6d9e87cbfd27702103ccc7c7f08ce784dc872.tar.bz2 android_art-f1c6d9e87cbfd27702103ccc7c7f08ce784dc872.zip |
Fallback to quick in case of soft verification errors
Add a regression test: using uninitialized values triggers a soft
verification error and optimizing should not crash.
Thanks to Stephen Kyle (stephenckyle@googlemail.com) for the bug report.
Bug: 19988704
Change-Id: I67174538eed853baff735694b3ae8eb34afe2a39
Diffstat (limited to 'compiler/driver/compiler_driver.cc')
-rw-r--r-- | compiler/driver/compiler_driver.cc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc index ef47377bcc..641d174935 100644 --- a/compiler/driver/compiler_driver.cc +++ b/compiler/driver/compiler_driver.cc @@ -2344,6 +2344,31 @@ CompiledMethod* CompilerDriver::GetCompiledMethod(MethodReference ref) const { return it->second; } +bool CompilerDriver::IsMethodVerifiedWithoutFailures(uint32_t method_idx, + uint16_t class_def_idx, + const DexFile& dex_file) const { + const VerifiedMethod* verified_method = GetVerifiedMethod(&dex_file, method_idx); + if (verified_method != nullptr) { + return !verified_method->HasVerificationFailures(); + } + + // If we can't find verification metadata, check if this is a system class (we trust that system + // classes have their methods verified). If it's not, be conservative and assume the method + // has not been verified successfully. + + // TODO: When compiling the boot image it should be safe to assume that everything is verified, + // even if methods are not found in the verification cache. + const char* descriptor = dex_file.GetClassDescriptor(dex_file.GetClassDef(class_def_idx)); + ClassLinker* class_linker = Runtime::Current()->GetClassLinker(); + Thread* self = Thread::Current(); + ScopedObjectAccess soa(self); + bool is_system_class = class_linker->FindSystemClass(self, descriptor) != nullptr; + if (!is_system_class) { + self->ClearException(); + } + return is_system_class; +} + size_t CompilerDriver::GetNonRelativeLinkerPatchCount() const { MutexLock mu(Thread::Current(), compiled_methods_lock_); return non_relative_linker_patch_count_; |