From 250a378d5a2152662e0fa820f2b38f794ddd3596 Mon Sep 17 00:00:00 2001 From: Nicolas Geoffray Date: Wed, 20 Apr 2016 16:27:53 +0100 Subject: Add flag to ArtMethod to skip compilation. To ensure even the JIT will not try to compile methods with soft failures a runtime_throw. bug:28293819 bug:28313047 Change-Id: Ie3fd71ded0b77de8dab1c3c825b867cb321b8873 --- compiler/optimizing/optimizing_compiler.cc | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'compiler/optimizing/optimizing_compiler.cc') diff --git a/compiler/optimizing/optimizing_compiler.cc b/compiler/optimizing/optimizing_compiler.cc index 3670ce2253..37197af460 100644 --- a/compiler/optimizing/optimizing_compiler.cc +++ b/compiler/optimizing/optimizing_compiler.cc @@ -769,15 +769,6 @@ CodeGenerator* OptimizingCompiler::TryCompile(ArenaAllocator* arena, return codegen.release(); } -static bool CanHandleVerificationFailure(const VerifiedMethod* verified_method) { - // For access errors the compiler will use the unresolved helpers (e.g. HInvokeUnresolved). - uint32_t unresolved_mask = verifier::VerifyError::VERIFY_ERROR_NO_CLASS - | verifier::VerifyError::VERIFY_ERROR_ACCESS_CLASS - | verifier::VerifyError::VERIFY_ERROR_ACCESS_FIELD - | verifier::VerifyError::VERIFY_ERROR_ACCESS_METHOD; - return (verified_method->GetEncounteredVerificationFailures() & (~unresolved_mask)) == 0; -} - CompiledMethod* OptimizingCompiler::Compile(const DexFile::CodeItem* code_item, uint32_t access_flags, InvokeType invoke_type, @@ -792,7 +783,8 @@ CompiledMethod* OptimizingCompiler::Compile(const DexFile::CodeItem* code_item, const VerifiedMethod* verified_method = compiler_driver->GetVerifiedMethod(&dex_file, method_idx); DCHECK(!verified_method->HasRuntimeThrow()); if (compiler_driver->IsMethodVerifiedWithoutFailures(method_idx, class_def_idx, dex_file) - || CanHandleVerificationFailure(verified_method)) { + || verifier::MethodVerifier::CanCompilerHandleVerificationFailure( + verified_method->GetEncounteredVerificationFailures())) { ArenaAllocator arena(Runtime::Current()->GetArenaPool()); CodeVectorAllocator code_allocator(&arena); std::unique_ptr codegen( @@ -865,6 +857,7 @@ bool OptimizingCompiler::JitCompile(Thread* self, Handle class_loader(hs.NewHandle( method->GetDeclaringClass()->GetClassLoader())); Handle dex_cache(hs.NewHandle(method->GetDexCache())); + DCHECK(method->IsCompilable()); jobject jclass_loader = class_loader.ToJObject(); const DexFile* dex_file = method->GetDexFile(); -- cgit v1.2.3-59-g8ed1b