diff options
author | 2020-09-23 14:47:28 +0100 | |
---|---|---|
committer | 2020-09-23 14:47:28 +0100 | |
commit | 6d69b52f331f788cbd1f21ffd5b87cb3b39965e4 (patch) | |
tree | 2bca1001afb4c3fc45cbb198765c51aa65e45c42 /compiler/optimizing/sharpening.cc | |
parent | e407d97b0f25562110511d025058dcefdacca623 (diff) |
Move MethodLoadKind out of HInvokeStaticOrDirect.
To prepare for using it in HInvokeInterface. For consistency, also move
CodePtrLocation.
Test: test.py
Change-Id: I84f973764275002e2adb71080ebc833b2bafb975
Diffstat (limited to 'compiler/optimizing/sharpening.cc')
-rw-r--r-- | compiler/optimizing/sharpening.cc | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/compiler/optimizing/sharpening.cc b/compiler/optimizing/sharpening.cc index f658f8ad07..67cd200679 100644 --- a/compiler/optimizing/sharpening.cc +++ b/compiler/optimizing/sharpening.cc @@ -65,8 +65,8 @@ HInvokeStaticOrDirect::DispatchInfo HSharpening::SharpenInvokeStaticOrDirect( DCHECK(!(callee->IsConstructor() && callee->GetDeclaringClass()->IsStringClass())); } - HInvokeStaticOrDirect::MethodLoadKind method_load_kind; - HInvokeStaticOrDirect::CodePtrLocation code_ptr_location; + MethodLoadKind method_load_kind; + CodePtrLocation code_ptr_location; uint64_t method_load_data = 0u; // Note: we never call an ArtMethod through a known code pointer, as @@ -85,61 +85,60 @@ HInvokeStaticOrDirect::DispatchInfo HSharpening::SharpenInvokeStaticOrDirect( const CompilerOptions& compiler_options = codegen->GetCompilerOptions(); if (callee == codegen->GetGraph()->GetArtMethod() && !codegen->GetGraph()->IsDebuggable()) { // Recursive call. - method_load_kind = HInvokeStaticOrDirect::MethodLoadKind::kRecursive; - code_ptr_location = HInvokeStaticOrDirect::CodePtrLocation::kCallSelf; + method_load_kind = MethodLoadKind::kRecursive; + code_ptr_location = CodePtrLocation::kCallSelf; } else if (compiler_options.IsBootImage() || compiler_options.IsBootImageExtension()) { if (!compiler_options.GetCompilePic()) { // Test configuration, do not sharpen. - method_load_kind = HInvokeStaticOrDirect::MethodLoadKind::kRuntimeCall; + method_load_kind = MethodLoadKind::kRuntimeCall; } else if (IsInBootImage(callee)) { DCHECK(compiler_options.IsBootImageExtension()); - method_load_kind = HInvokeStaticOrDirect::MethodLoadKind::kBootImageRelRo; + method_load_kind = MethodLoadKind::kBootImageRelRo; } else if (BootImageAOTCanEmbedMethod(callee, compiler_options)) { - method_load_kind = HInvokeStaticOrDirect::MethodLoadKind::kBootImageLinkTimePcRelative; + method_load_kind = MethodLoadKind::kBootImageLinkTimePcRelative; } else if (!has_method_id) { - method_load_kind = HInvokeStaticOrDirect::MethodLoadKind::kRuntimeCall; + method_load_kind = MethodLoadKind::kRuntimeCall; } else { // Use PC-relative access to the .bss methods array. - method_load_kind = HInvokeStaticOrDirect::MethodLoadKind::kBssEntry; + method_load_kind = MethodLoadKind::kBssEntry; } - code_ptr_location = HInvokeStaticOrDirect::CodePtrLocation::kCallArtMethod; + code_ptr_location = CodePtrLocation::kCallArtMethod; } else if (compiler_options.IsJitCompiler()) { ScopedObjectAccess soa(Thread::Current()); if (Runtime::Current()->GetJit()->CanEncodeMethod( callee, compiler_options.IsJitCompilerForSharedCode())) { - method_load_kind = HInvokeStaticOrDirect::MethodLoadKind::kJitDirectAddress; + method_load_kind = MethodLoadKind::kJitDirectAddress; method_load_data = reinterpret_cast<uintptr_t>(callee); - code_ptr_location = HInvokeStaticOrDirect::CodePtrLocation::kCallArtMethod; + code_ptr_location = CodePtrLocation::kCallArtMethod; } else { // Do not sharpen. - method_load_kind = HInvokeStaticOrDirect::MethodLoadKind::kRuntimeCall; - code_ptr_location = HInvokeStaticOrDirect::CodePtrLocation::kCallArtMethod; + method_load_kind = MethodLoadKind::kRuntimeCall; + code_ptr_location = CodePtrLocation::kCallArtMethod; } } else if (IsInBootImage(callee)) { // Use PC-relative access to the .data.bimg.rel.ro methods array. - method_load_kind = HInvokeStaticOrDirect::MethodLoadKind::kBootImageRelRo; - code_ptr_location = HInvokeStaticOrDirect::CodePtrLocation::kCallArtMethod; + method_load_kind = MethodLoadKind::kBootImageRelRo; + code_ptr_location = CodePtrLocation::kCallArtMethod; } else if (!has_method_id) { - method_load_kind = HInvokeStaticOrDirect::MethodLoadKind::kRuntimeCall; - code_ptr_location = HInvokeStaticOrDirect::CodePtrLocation::kCallArtMethod; + method_load_kind = MethodLoadKind::kRuntimeCall; + code_ptr_location = CodePtrLocation::kCallArtMethod; } else { // Use PC-relative access to the .bss methods array. - method_load_kind = HInvokeStaticOrDirect::MethodLoadKind::kBssEntry; - code_ptr_location = HInvokeStaticOrDirect::CodePtrLocation::kCallArtMethod; + method_load_kind = MethodLoadKind::kBssEntry; + code_ptr_location = CodePtrLocation::kCallArtMethod; } - if (method_load_kind != HInvokeStaticOrDirect::MethodLoadKind::kRuntimeCall && - callee->IsCriticalNative()) { - DCHECK_NE(method_load_kind, HInvokeStaticOrDirect::MethodLoadKind::kRecursive); + if (method_load_kind != MethodLoadKind::kRuntimeCall && callee->IsCriticalNative()) { + DCHECK_NE(method_load_kind, MethodLoadKind::kRecursive); DCHECK(callee->IsStatic()); - code_ptr_location = HInvokeStaticOrDirect::CodePtrLocation::kCallCriticalNative; + code_ptr_location = CodePtrLocation::kCallCriticalNative; } if (codegen->GetGraph()->IsDebuggable()) { // For debuggable apps always use the code pointer from ArtMethod // so that we don't circumvent instrumentation stubs if installed. - code_ptr_location = HInvokeStaticOrDirect::CodePtrLocation::kCallArtMethod; + code_ptr_location = CodePtrLocation::kCallArtMethod; } HInvokeStaticOrDirect::DispatchInfo desired_dispatch_info = { |