diff options
| author | 2017-11-10 10:02:44 +0000 | |
|---|---|---|
| committer | 2017-11-10 10:02:44 +0000 | |
| commit | e983b1658589e2a3d12620846b7e2351af26afa6 (patch) | |
| tree | 4a5abce1e079b54262248fd809f02e97d120740a /compiler/driver/compiler_driver.cc | |
| parent | 77526ffcc5f25ef9c4aa4e87d416c22f2586cf17 (diff) | |
| parent | b0a6aeee250945b1d156ebab94053380f2e5a3c5 (diff) | |
Merge "Record @{Fast,Critical}Native in method's access flags."
Diffstat (limited to 'compiler/driver/compiler_driver.cc')
| -rw-r--r-- | compiler/driver/compiler_driver.cc | 36 |
1 files changed, 4 insertions, 32 deletions
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc index a9d27ef0cc..32d0bbe495 100644 --- a/compiler/driver/compiler_driver.cc +++ b/compiler/driver/compiler_driver.cc @@ -46,6 +46,7 @@ #include "dex/verified_method.h" #include "dex_compilation_unit.h" #include "dex_file-inl.h" +#include "dex_file_annotations.h" #include "dex_instruction-inl.h" #include "driver/compiler_options.h" #include "gc/accounting/card_table-inl.h" @@ -511,40 +512,11 @@ static void CompileMethod(Thread* self, InstructionSetHasGenericJniStub(driver->GetInstructionSet())) { // Leaving this empty will trigger the generic JNI version } else { - // Look-up the ArtMethod associated with this code_item (if any) - // -- It is later used to lookup any [optimization] annotations for this method. - ScopedObjectAccess soa(self); - - // TODO: Lookup annotation from DexFile directly without resolving method. - ArtMethod* method = - Runtime::Current()->GetClassLinker()->ResolveMethod<ClassLinker::ResolveMode::kNoChecks>( - dex_file, - method_idx, - dex_cache, - class_loader, - /* referrer */ nullptr, - invoke_type); - // Query any JNI optimization annotations such as @FastNative or @CriticalNative. - Compiler::JniOptimizationFlags optimization_flags = Compiler::kNone; - if (UNLIKELY(method == nullptr)) { - // Failed method resolutions happen very rarely, e.g. ancestor class cannot be resolved. - DCHECK(self->IsExceptionPending()); - self->ClearException(); - } else if (method->IsAnnotatedWithFastNative()) { - // TODO: Will no longer need this CHECK once we have verifier checking this. - CHECK(!method->IsAnnotatedWithCriticalNative()); - optimization_flags = Compiler::kFastNative; - } else if (method->IsAnnotatedWithCriticalNative()) { - // TODO: Will no longer need this CHECK once we have verifier checking this. - CHECK(!method->IsAnnotatedWithFastNative()); - optimization_flags = Compiler::kCriticalNative; - } + access_flags |= annotations::GetNativeMethodAnnotationAccessFlags( + dex_file, dex_file.GetClassDef(class_def_idx), method_idx); - compiled_method = driver->GetCompiler()->JniCompile(access_flags, - method_idx, - dex_file, - optimization_flags); + compiled_method = driver->GetCompiler()->JniCompile(access_flags, method_idx, dex_file); CHECK(compiled_method != nullptr); } } else if ((access_flags & kAccAbstract) != 0) { |