diff options
author | 2016-06-02 15:55:48 +0100 | |
---|---|---|
committer | 2016-06-06 11:29:47 +0100 | |
commit | 808067335b228d7b50ad84123d3c8ecb7aeeb200 (patch) | |
tree | 8642091a7775c18ac03a079f1befea3261805346 /compiler/optimizing/optimizing_compiler.cc | |
parent | 4b53f5795a289b40aa81b9c42ede5c896ea0e4ef (diff) |
Fix ArtMethod::GetInvokeType for static methods on interfaces.
And avoid calling ResolveMethod in the JIT, since it already
knows that method.
bug:29089267
bug:27521545
(cherry picked from commit 2dc77ecf375882f51ff7c09712c05b80e58abb6b)
Change-Id: I36084b1f207317452c42fdfc8ffa4d8c721d2f76
Diffstat (limited to 'compiler/optimizing/optimizing_compiler.cc')
-rw-r--r-- | compiler/optimizing/optimizing_compiler.cc | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/compiler/optimizing/optimizing_compiler.cc b/compiler/optimizing/optimizing_compiler.cc index 37197af460..0e0a30b4a3 100644 --- a/compiler/optimizing/optimizing_compiler.cc +++ b/compiler/optimizing/optimizing_compiler.cc @@ -321,6 +321,7 @@ class OptimizingCompiler FINAL : public Compiler { jobject class_loader, const DexFile& dex_file, Handle<mirror::DexCache> dex_cache, + ArtMethod* method, bool osr) const; std::unique_ptr<OptimizingCompilerStats> compilation_stats_; @@ -614,6 +615,7 @@ CodeGenerator* OptimizingCompiler::TryCompile(ArenaAllocator* arena, jobject class_loader, const DexFile& dex_file, Handle<mirror::DexCache> dex_cache, + ArtMethod* method, bool osr) const { MaybeRecordStat(MethodCompilationStat::kAttemptCompilation); CompilerDriver* compiler_driver = GetCompilerDriver(); @@ -679,18 +681,21 @@ CodeGenerator* OptimizingCompiler::TryCompile(ArenaAllocator* arena, osr); const uint8_t* interpreter_metadata = nullptr; - { + if (method == nullptr) { ScopedObjectAccess soa(Thread::Current()); StackHandleScope<1> hs(soa.Self()); Handle<mirror::ClassLoader> loader(hs.NewHandle( soa.Decode<mirror::ClassLoader*>(class_loader))); - ArtMethod* art_method = compiler_driver->ResolveMethod( + method = compiler_driver->ResolveMethod( soa, dex_cache, loader, &dex_compilation_unit, method_idx, invoke_type); - // We may not get a method, for example if its class is erroneous. - if (art_method != nullptr) { - graph->SetArtMethod(art_method); - interpreter_metadata = art_method->GetQuickenedInfo(); - } + } + // For AOT compilation, we may not get a method, for example if its class is erroneous. + // JIT should always have a method. + DCHECK(Runtime::Current()->IsAotCompiler() || method != nullptr); + if (method != nullptr) { + graph->SetArtMethod(method); + ScopedObjectAccess soa(Thread::Current()); + interpreter_metadata = method->GetQuickenedInfo(); } std::unique_ptr<CodeGenerator> codegen( @@ -798,6 +803,7 @@ CompiledMethod* OptimizingCompiler::Compile(const DexFile::CodeItem* code_item, jclass_loader, dex_file, dex_cache, + nullptr, /* osr */ false)); if (codegen.get() != nullptr) { MaybeRecordStat(MethodCompilationStat::kCompiled); @@ -884,6 +890,7 @@ bool OptimizingCompiler::JitCompile(Thread* self, jclass_loader, *dex_file, dex_cache, + method, osr)); if (codegen.get() == nullptr) { return false; |