diff options
author | Nicolas Geoffray <ngeoffray@google.com> | 2015-06-24 15:53:03 +0100 |
---|---|---|
committer | Nicolas Geoffray <ngeoffray@google.com> | 2015-06-24 17:16:07 +0100 |
commit | 286763464072ffb599846f76720c7ec54392ae6e (patch) | |
tree | c735e7e8dc14f8c978c75a08d8a32e8bb46632fe /compiler | |
parent | b5171ff4859104a1e314c3091b6bd4872ad7c2b2 (diff) | |
download | art-286763464072ffb599846f76720c7ec54392ae6e.zip art-286763464072ffb599846f76720c7ec54392ae6e.tar.gz art-286763464072ffb599846f76720c7ec54392ae6e.tar.bz2 |
Use a flag from the verifier to know if we should compile.
Only used for the lack of bottom type in the aget-object case
for now. Could be used for more.
bug:21865466
(cherry picked from commit 4824c27988c8eeb302791624bb3ce1d557b0db6c)
Change-Id: I2bb7fe1d4737bd92c1076b5193607d74d8761ee7
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/dex/quick/quick_compiler.cc | 5 | ||||
-rw-r--r-- | compiler/dex/verified_method.cc | 1 | ||||
-rw-r--r-- | compiler/dex/verified_method.h | 5 | ||||
-rw-r--r-- | compiler/optimizing/optimizing_compiler.cc | 3 |
4 files changed, 13 insertions, 1 deletions
diff --git a/compiler/dex/quick/quick_compiler.cc b/compiler/dex/quick/quick_compiler.cc index 58236e2..ff4659a 100644 --- a/compiler/dex/quick/quick_compiler.cc +++ b/compiler/dex/quick/quick_compiler.cc @@ -33,6 +33,7 @@ #include "dex/pass_driver_me_post_opt.h" #include "dex/pass_manager.h" #include "dex/quick/mir_to_lir.h" +#include "dex/verified_method.h" #include "driver/compiler_driver.h" #include "driver/compiler_options.h" #include "elf_writer_quick.h" @@ -624,6 +625,10 @@ CompiledMethod* QuickCompiler::Compile(const DexFile::CodeItem* code_item, return nullptr; } + if (driver->GetVerifiedMethod(&dex_file, method_idx)->HasRuntimeThrow()) { + return nullptr; + } + DCHECK(driver->GetCompilerOptions().IsCompilationEnabled()); Runtime* const runtime = Runtime::Current(); diff --git a/compiler/dex/verified_method.cc b/compiler/dex/verified_method.cc index 9b141cc..2bc8042 100644 --- a/compiler/dex/verified_method.cc +++ b/compiler/dex/verified_method.cc @@ -41,6 +41,7 @@ const VerifiedMethod* VerifiedMethod::Create(verifier::MethodVerifier* method_ve bool compile) { std::unique_ptr<VerifiedMethod> verified_method(new VerifiedMethod); verified_method->has_verification_failures_ = method_verifier->HasFailures(); + verified_method->has_runtime_throw_ = method_verifier->HasInstructionThatWillThrow(); if (compile) { /* Generate a register map. */ if (!verified_method->GenerateGcMap(method_verifier)) { diff --git a/compiler/dex/verified_method.h b/compiler/dex/verified_method.h index 242e3df..bad4495 100644 --- a/compiler/dex/verified_method.h +++ b/compiler/dex/verified_method.h @@ -75,6 +75,10 @@ class VerifiedMethod { return has_verification_failures_; } + bool HasRuntimeThrow() const { + return has_runtime_throw_; + } + void SetStringInitPcRegMap(SafeMap<uint32_t, std::set<uint32_t>>& string_init_pc_reg_map) { string_init_pc_reg_map_ = string_init_pc_reg_map; } @@ -121,6 +125,7 @@ class VerifiedMethod { SafeCastSet safe_cast_set_; bool has_verification_failures_; + bool has_runtime_throw_ = false; // Copy of mapping generated by verifier of dex PCs of string init invocations // to the set of other registers that the receiver has been copied into. diff --git a/compiler/optimizing/optimizing_compiler.cc b/compiler/optimizing/optimizing_compiler.cc index 810b4f8..8958932 100644 --- a/compiler/optimizing/optimizing_compiler.cc +++ b/compiler/optimizing/optimizing_compiler.cc @@ -618,7 +618,8 @@ CompiledMethod* OptimizingCompiler::Compile(const DexFile::CodeItem* code_item, const DexFile& dex_file) const { CompilerDriver* compiler_driver = GetCompilerDriver(); CompiledMethod* method = nullptr; - if (compiler_driver->IsMethodVerifiedWithoutFailures(method_idx, class_def_idx, dex_file)) { + if (compiler_driver->IsMethodVerifiedWithoutFailures(method_idx, class_def_idx, dex_file) && + !compiler_driver->GetVerifiedMethod(&dex_file, method_idx)->HasRuntimeThrow()) { method = TryCompile(code_item, access_flags, invoke_type, class_def_idx, method_idx, jclass_loader, dex_file); } else { |