diff options
author | Nicolas Geoffray <ngeoffray@google.com> | 2016-12-18 15:52:36 +0000 |
---|---|---|
committer | Nicolas Geoffray <ngeoffray@google.com> | 2016-12-20 13:29:45 +0000 |
commit | c1a42cf3873be202c8c0ca3c4e67500b470ab075 (patch) | |
tree | f2bffbd14e1f9d5429dd8514d19be4fa6dfa392f /compiler/optimizing/code_generator_mips.cc | |
parent | 06ce6d4359ed897f1d1b39be4e748f0c4f3ca2ff (diff) |
Remove soon to be obsolete call kinds for direct calls.
And remove CompilerDriver::GetCodeAndMethodForDirectCall in
preparation of removing non-PIC prebuild and non-PIC on-device
boot image compilation.
Test: test-art-host test-art-target
bug:33192586
Change-Id: Ic48e3e8b9d7605dd0e66f31d458a182198ba9578
Diffstat (limited to 'compiler/optimizing/code_generator_mips.cc')
-rw-r--r-- | compiler/optimizing/code_generator_mips.cc | 106 |
1 files changed, 2 insertions, 104 deletions
diff --git a/compiler/optimizing/code_generator_mips.cc b/compiler/optimizing/code_generator_mips.cc index 897b719180..c5029b3902 100644 --- a/compiler/optimizing/code_generator_mips.cc +++ b/compiler/optimizing/code_generator_mips.cc @@ -458,10 +458,6 @@ CodeGeneratorMIPS::CodeGeneratorMIPS(HGraph* graph, isa_features_(isa_features), uint32_literals_(std::less<uint32_t>(), graph->GetArena()->Adapter(kArenaAllocCodeGenerator)), - method_patches_(MethodReferenceComparator(), - graph->GetArena()->Adapter(kArenaAllocCodeGenerator)), - call_patches_(MethodReferenceComparator(), - graph->GetArena()->Adapter(kArenaAllocCodeGenerator)), pc_relative_dex_cache_patches_(graph->GetArena()->Adapter(kArenaAllocCodeGenerator)), boot_image_string_patches_(StringReferenceValueComparator(), graph->GetArena()->Adapter(kArenaAllocCodeGenerator)), @@ -1008,8 +1004,6 @@ inline void CodeGeneratorMIPS::EmitPcRelativeLinkerPatches( void CodeGeneratorMIPS::EmitLinkerPatches(ArenaVector<LinkerPatch>* linker_patches) { DCHECK(linker_patches->empty()); size_t size = - method_patches_.size() + - call_patches_.size() + pc_relative_dex_cache_patches_.size() + pc_relative_string_patches_.size() + pc_relative_type_patches_.size() + @@ -1017,24 +1011,6 @@ void CodeGeneratorMIPS::EmitLinkerPatches(ArenaVector<LinkerPatch>* linker_patch boot_image_type_patches_.size() + boot_image_address_patches_.size(); linker_patches->reserve(size); - for (const auto& entry : method_patches_) { - const MethodReference& target_method = entry.first; - Literal* literal = entry.second; - DCHECK(literal->GetLabel()->IsBound()); - uint32_t literal_offset = __ GetLabelLocation(literal->GetLabel()); - linker_patches->push_back(LinkerPatch::MethodPatch(literal_offset, - target_method.dex_file, - target_method.dex_method_index)); - } - for (const auto& entry : call_patches_) { - const MethodReference& target_method = entry.first; - Literal* literal = entry.second; - DCHECK(literal->GetLabel()->IsBound()); - uint32_t literal_offset = __ GetLabelLocation(literal->GetLabel()); - linker_patches->push_back(LinkerPatch::CodePatch(literal_offset, - target_method.dex_file, - target_method.dex_method_index)); - } EmitPcRelativeLinkerPatches<LinkerPatch::DexCacheArrayPatch>(pc_relative_dex_cache_patches_, linker_patches); if (!GetCompilerOptions().IsBootImage()) { @@ -1107,14 +1083,6 @@ Literal* CodeGeneratorMIPS::DeduplicateMethodLiteral(MethodReference target_meth [this]() { return __ NewLiteral<uint32_t>(/* placeholder */ 0u); }); } -Literal* CodeGeneratorMIPS::DeduplicateMethodAddressLiteral(MethodReference target_method) { - return DeduplicateMethodLiteral(target_method, &method_patches_); -} - -Literal* CodeGeneratorMIPS::DeduplicateMethodCodeLiteral(MethodReference target_method) { - return DeduplicateMethodLiteral(target_method, &call_patches_); -} - Literal* CodeGeneratorMIPS::DeduplicateBootImageStringLiteral(const DexFile& dex_file, dex::StringIndex string_index) { return boot_image_string_patches_.GetOrCreate( @@ -5157,22 +5125,7 @@ void LocationsBuilderMIPS::VisitInvokeStaticOrDirect(HInvokeStaticOrDirect* invo // art::PrepareForRegisterAllocation. DCHECK(!invoke->IsStaticWithExplicitClinitCheck()); - HInvokeStaticOrDirect::MethodLoadKind method_load_kind = invoke->GetMethodLoadKind(); - HInvokeStaticOrDirect::CodePtrLocation code_ptr_location = invoke->GetCodePtrLocation(); - bool isR6 = codegen_->GetInstructionSetFeatures().IsR6(); - - // kDirectAddressWithFixup and kCallDirectWithFixup need no extra input on R6 because - // R6 has PC-relative addressing. - bool has_extra_input = !isR6 && - ((method_load_kind == HInvokeStaticOrDirect::MethodLoadKind::kDirectAddressWithFixup) || - (code_ptr_location == HInvokeStaticOrDirect::CodePtrLocation::kCallDirectWithFixup)); - - if (invoke->HasPcRelativeDexCache()) { - // kDexCachePcRelative is mutually exclusive with - // kDirectAddressWithFixup/kCallDirectWithFixup. - CHECK(!has_extra_input); - has_extra_input = true; - } + bool has_extra_input = invoke->HasPcRelativeDexCache(); IntrinsicLocationsBuilderMIPS intrinsic(codegen_); if (intrinsic.TryDispatch(invoke)) { @@ -5312,9 +5265,7 @@ HInvokeStaticOrDirect::DispatchInfo CodeGeneratorMIPS::GetSupportedInvokeStaticO // is incompatible with it. bool has_irreducible_loops = GetGraph()->HasIrreducibleLoops(); bool fallback_load = true; - bool fallback_call = true; switch (dispatch_info.method_load_kind) { - case HInvokeStaticOrDirect::MethodLoadKind::kDirectAddressWithFixup: case HInvokeStaticOrDirect::MethodLoadKind::kDexCachePcRelative: fallback_load = has_irreducible_loops; break; @@ -5322,25 +5273,10 @@ HInvokeStaticOrDirect::DispatchInfo CodeGeneratorMIPS::GetSupportedInvokeStaticO fallback_load = false; break; } - switch (dispatch_info.code_ptr_location) { - case HInvokeStaticOrDirect::CodePtrLocation::kCallDirectWithFixup: - fallback_call = has_irreducible_loops; - break; - case HInvokeStaticOrDirect::CodePtrLocation::kCallPCRelative: - // TODO: Implement this type. - break; - default: - fallback_call = false; - break; - } if (fallback_load) { dispatch_info.method_load_kind = HInvokeStaticOrDirect::MethodLoadKind::kDexCacheViaMethod; dispatch_info.method_load_data = 0; } - if (fallback_call) { - dispatch_info.code_ptr_location = HInvokeStaticOrDirect::CodePtrLocation::kCallArtMethod; - dispatch_info.direct_code_ptr = 0; - } return dispatch_info; } @@ -5349,31 +5285,10 @@ void CodeGeneratorMIPS::GenerateStaticOrDirectCall(HInvokeStaticOrDirect* invoke Location callee_method = temp; // For all kinds except kRecursive, callee will be in temp. HInvokeStaticOrDirect::MethodLoadKind method_load_kind = invoke->GetMethodLoadKind(); HInvokeStaticOrDirect::CodePtrLocation code_ptr_location = invoke->GetCodePtrLocation(); - bool isR6 = isa_features_.IsR6(); - // kDirectAddressWithFixup and kCallDirectWithFixup have no extra input on R6 because - // R6 has PC-relative addressing. - bool has_extra_input = invoke->HasPcRelativeDexCache() || - (!isR6 && - ((method_load_kind == HInvokeStaticOrDirect::MethodLoadKind::kDirectAddressWithFixup) || - (code_ptr_location == HInvokeStaticOrDirect::CodePtrLocation::kCallDirectWithFixup))); - Register base_reg = has_extra_input + Register base_reg = invoke->HasPcRelativeDexCache() ? GetInvokeStaticOrDirectExtraParameter(invoke, temp.AsRegister<Register>()) : ZERO; - // For better instruction scheduling we load the direct code pointer before the method pointer. - switch (code_ptr_location) { - case HInvokeStaticOrDirect::CodePtrLocation::kCallDirect: - // T9 = invoke->GetDirectCodePtr(); - __ LoadConst32(T9, invoke->GetDirectCodePtr()); - break; - case HInvokeStaticOrDirect::CodePtrLocation::kCallDirectWithFixup: - // T9 = code address from literal pool with link-time patch. - __ LoadLiteral(T9, base_reg, DeduplicateMethodCodeLiteral(invoke->GetTargetMethod())); - break; - default: - break; - } - switch (method_load_kind) { case HInvokeStaticOrDirect::MethodLoadKind::kStringInit: { // temp = thread->string_init_entrypoint @@ -5391,11 +5306,6 @@ void CodeGeneratorMIPS::GenerateStaticOrDirectCall(HInvokeStaticOrDirect* invoke case HInvokeStaticOrDirect::MethodLoadKind::kDirectAddress: __ LoadConst32(temp.AsRegister<Register>(), invoke->GetMethodAddress()); break; - case HInvokeStaticOrDirect::MethodLoadKind::kDirectAddressWithFixup: - __ LoadLiteral(temp.AsRegister<Register>(), - base_reg, - DeduplicateMethodAddressLiteral(invoke->GetTargetMethod())); - break; case HInvokeStaticOrDirect::MethodLoadKind::kDexCachePcRelative: { HMipsDexCacheArraysBase* base = invoke->InputAt(invoke->GetSpecialInputIndex())->AsMipsDexCacheArraysBase(); @@ -5438,18 +5348,6 @@ void CodeGeneratorMIPS::GenerateStaticOrDirectCall(HInvokeStaticOrDirect* invoke case HInvokeStaticOrDirect::CodePtrLocation::kCallSelf: __ Bal(&frame_entry_label_); break; - case HInvokeStaticOrDirect::CodePtrLocation::kCallDirect: - case HInvokeStaticOrDirect::CodePtrLocation::kCallDirectWithFixup: - // T9 prepared above for better instruction scheduling. - // T9() - __ Jalr(T9); - __ NopIfNoReordering(); - break; - case HInvokeStaticOrDirect::CodePtrLocation::kCallPCRelative: - // TODO: Implement this type. - // Currently filtered out by GetSupportedInvokeStaticOrDirectDispatch(). - LOG(FATAL) << "Unsupported"; - UNREACHABLE(); case HInvokeStaticOrDirect::CodePtrLocation::kCallArtMethod: // T9 = callee_method->entry_point_from_quick_compiled_code_; __ LoadFromOffset(kLoadWord, |