From 00468f3b4b4741be407169a4f21054ebdcccb2b1 Mon Sep 17 00:00:00 2001 From: Roland Levillain Date: Thu, 27 Oct 2016 18:02:48 +0100 Subject: [PATCH] Remove default argument values in GenerateGcRootFieldLoad. These values were never or rarely used. Test: mmma art (with and without `ART_USE_READ_BARRIER=true`) Bug: 12687968 Bug: 29516974 Change-Id: I5d15140ce501bf50d7a87871b1e492cee54913db --- compiler/optimizing/code_generator_arm.cc | 2 +- compiler/optimizing/code_generator_arm.h | 4 ++-- compiler/optimizing/code_generator_arm64.cc | 11 ++++++----- compiler/optimizing/code_generator_arm64.h | 6 +++--- compiler/optimizing/code_generator_arm_vixl.cc | 5 +++-- compiler/optimizing/code_generator_arm_vixl.h | 2 +- compiler/optimizing/code_generator_x86.cc | 8 ++++---- compiler/optimizing/code_generator_x86.h | 6 +++--- compiler/optimizing/code_generator_x86_64.cc | 10 +++++----- compiler/optimizing/code_generator_x86_64.h | 6 +++--- 10 files changed, 31 insertions(+), 29 deletions(-) diff --git a/compiler/optimizing/code_generator_arm.cc b/compiler/optimizing/code_generator_arm.cc index 9f92b2092..660afec91 100644 --- a/compiler/optimizing/code_generator_arm.cc +++ b/compiler/optimizing/code_generator_arm.cc @@ -5773,7 +5773,7 @@ void InstructionCodeGeneratorARM::VisitLoadString(HLoadString* load) { __ movt(temp, /* placeholder */ 0u); __ BindTrackedLabel(&labels->add_pc_label); __ add(temp, temp, ShifterOperand(PC)); - GenerateGcRootFieldLoad(load, out_loc, temp, 0); + GenerateGcRootFieldLoad(load, out_loc, temp, /* offset */ 0, kEmitCompilerReadBarrier); SlowPathCode* slow_path = new (GetGraph()->GetArena()) LoadStringSlowPathARM(load); codegen_->AddSlowPath(slow_path); __ CompareAndBranchIfZero(out, slow_path->GetEntryLabel()); diff --git a/compiler/optimizing/code_generator_arm.h b/compiler/optimizing/code_generator_arm.h index 4d59b4786..729cbe1f1 100644 --- a/compiler/optimizing/code_generator_arm.h +++ b/compiler/optimizing/code_generator_arm.h @@ -283,12 +283,12 @@ class InstructionCodeGeneratorARM : public InstructionCodeGenerator { // // root <- *(obj + offset) // - // while honoring read barriers if requires_read_barrier is true. + // while honoring read barriers if `requires_read_barrier` is true. void GenerateGcRootFieldLoad(HInstruction* instruction, Location root, Register obj, uint32_t offset, - bool requires_read_barrier = kEmitCompilerReadBarrier); + bool requires_read_barrier); void GenerateTestAndBranch(HInstruction* instruction, size_t condition_input_index, Label* true_target, diff --git a/compiler/optimizing/code_generator_arm64.cc b/compiler/optimizing/code_generator_arm64.cc index 9e59d8cc3..78c164b1f 100644 --- a/compiler/optimizing/code_generator_arm64.cc +++ b/compiler/optimizing/code_generator_arm64.cc @@ -4098,7 +4098,7 @@ void InstructionCodeGeneratorARM64::VisitLoadClass(HLoadClass* cls) { out_loc, current_method, ArtMethod::DeclaringClassOffset().Int32Value(), - /*fixup_label*/ nullptr, + /* fixup_label */ nullptr, requires_read_barrier); break; } @@ -4143,7 +4143,7 @@ void InstructionCodeGeneratorARM64::VisitLoadClass(HLoadClass* cls) { out_loc, out.X(), offset, - /*fixup_label*/ nullptr, + /* fixup_label */ nullptr, requires_read_barrier); generate_null_check = !cls->IsInDexCache(); break; @@ -4180,7 +4180,7 @@ void InstructionCodeGeneratorARM64::VisitLoadClass(HLoadClass* cls) { out_loc, out.X(), CodeGenerator::GetCacheOffset(cls->GetTypeIndex()), - /*fixup_label*/ nullptr, + /* fixup_label */ nullptr, requires_read_barrier); generate_null_check = !cls->IsInDexCache(); break; @@ -4319,8 +4319,9 @@ void InstructionCodeGeneratorARM64::VisitLoadString(HLoadString* load) { GenerateGcRootFieldLoad(load, load->GetLocations()->Out(), temp, - /* placeholder */ 0u, - ldr_label); + /* offset placeholder */ 0u, + ldr_label, + kEmitCompilerReadBarrier); SlowPathCodeARM64* slow_path = new (GetGraph()->GetArena()) LoadStringSlowPathARM64(load, temp, adrp_label); codegen_->AddSlowPath(slow_path); diff --git a/compiler/optimizing/code_generator_arm64.h b/compiler/optimizing/code_generator_arm64.h index eb28ecb42..7de84be48 100644 --- a/compiler/optimizing/code_generator_arm64.h +++ b/compiler/optimizing/code_generator_arm64.h @@ -289,13 +289,13 @@ class InstructionCodeGeneratorARM64 : public InstructionCodeGenerator { // // root <- *(obj + offset) // - // while honoring read barriers (if any). + // while honoring read barriers if `requires_read_barrier` is true. void GenerateGcRootFieldLoad(HInstruction* instruction, Location root, vixl::aarch64::Register obj, uint32_t offset, - vixl::aarch64::Label* fixup_label = nullptr, - bool requires_read_barrier = kEmitCompilerReadBarrier); + vixl::aarch64::Label* fixup_label, + bool requires_read_barrier); // Generate a floating-point comparison. void GenerateFcmp(HInstruction* instruction); diff --git a/compiler/optimizing/code_generator_arm_vixl.cc b/compiler/optimizing/code_generator_arm_vixl.cc index cac0543da..b9e049ae4 100644 --- a/compiler/optimizing/code_generator_arm_vixl.cc +++ b/compiler/optimizing/code_generator_arm_vixl.cc @@ -3357,7 +3357,8 @@ void InstructionCodeGeneratorARMVIXL::VisitLoadClass(HLoadClass* cls) { GenerateGcRootFieldLoad(cls, out_loc, current_method, - ArtMethod::DeclaringClassOffset().Int32Value()); + ArtMethod::DeclaringClassOffset().Int32Value(), + kEmitCompilerReadBarrier); break; } case HLoadClass::LoadKind::kDexCacheViaMethod: { @@ -3369,7 +3370,7 @@ void InstructionCodeGeneratorARMVIXL::VisitLoadClass(HLoadClass* cls) { GetAssembler()->LoadFromOffset(kLoadWord, out, current_method, resolved_types_offset); // /* GcRoot */ out = out[type_index] size_t offset = CodeGenerator::GetCacheOffset(cls->GetTypeIndex()); - GenerateGcRootFieldLoad(cls, out_loc, out, offset); + GenerateGcRootFieldLoad(cls, out_loc, out, offset, kEmitCompilerReadBarrier); generate_null_check = !cls->IsInDexCache(); break; } diff --git a/compiler/optimizing/code_generator_arm_vixl.h b/compiler/optimizing/code_generator_arm_vixl.h index 1cd6184dd..b0fa03899 100644 --- a/compiler/optimizing/code_generator_arm_vixl.h +++ b/compiler/optimizing/code_generator_arm_vixl.h @@ -339,7 +339,7 @@ class InstructionCodeGeneratorARMVIXL : public InstructionCodeGenerator { Location root, vixl::aarch32::Register obj, uint32_t offset, - bool requires_read_barrier = kEmitCompilerReadBarrier); + bool requires_read_barrier); void GenerateTestAndBranch(HInstruction* instruction, size_t condition_input_index, vixl::aarch32::Label* true_target, diff --git a/compiler/optimizing/code_generator_x86.cc b/compiler/optimizing/code_generator_x86.cc index 02c1c3b69..d93001630 100644 --- a/compiler/optimizing/code_generator_x86.cc +++ b/compiler/optimizing/code_generator_x86.cc @@ -5897,7 +5897,7 @@ void InstructionCodeGeneratorX86::VisitLoadClass(HLoadClass* cls) { cls, out_loc, Address(current_method, ArtMethod::DeclaringClassOffset().Int32Value()), - /*fixup_label*/ nullptr, + /* fixup_label */ nullptr, requires_read_barrier); break; } @@ -5929,7 +5929,7 @@ void InstructionCodeGeneratorX86::VisitLoadClass(HLoadClass* cls) { GenerateGcRootFieldLoad(cls, out_loc, Address::Absolute(address), - /*fixup_label*/ nullptr, + /* fixup_label */ nullptr, requires_read_barrier); generate_null_check = !cls->IsInDexCache(); break; @@ -5957,7 +5957,7 @@ void InstructionCodeGeneratorX86::VisitLoadClass(HLoadClass* cls) { GenerateGcRootFieldLoad(cls, out_loc, Address(out, CodeGenerator::GetCacheOffset(cls->GetTypeIndex())), - /*fixup_label*/ nullptr, + /* fixup_label */ nullptr, requires_read_barrier); generate_null_check = !cls->IsInDexCache(); break; @@ -6099,7 +6099,7 @@ void InstructionCodeGeneratorX86::VisitLoadString(HLoadString* load) { Address address = Address(method_address, CodeGeneratorX86::kDummy32BitOffset); Label* fixup_label = codegen_->NewStringBssEntryPatch(load); // /* GcRoot */ out = *address /* PC-relative */ - GenerateGcRootFieldLoad(load, out_loc, address, fixup_label); + GenerateGcRootFieldLoad(load, out_loc, address, fixup_label, kEmitCompilerReadBarrier); SlowPathCode* slow_path = new (GetGraph()->GetArena()) LoadStringSlowPathX86(load); codegen_->AddSlowPath(slow_path); __ testl(out, out); diff --git a/compiler/optimizing/code_generator_x86.h b/compiler/optimizing/code_generator_x86.h index e7d9a43f5..9e5bc831f 100644 --- a/compiler/optimizing/code_generator_x86.h +++ b/compiler/optimizing/code_generator_x86.h @@ -259,12 +259,12 @@ class InstructionCodeGeneratorX86 : public InstructionCodeGenerator { // // root <- *address // - // while honoring read barriers (if any). + // while honoring read barriers if `requires_read_barrier` is true. void GenerateGcRootFieldLoad(HInstruction* instruction, Location root, const Address& address, - Label* fixup_label = nullptr, - bool requires_read_barrier = kEmitCompilerReadBarrier); + Label* fixup_label, + bool requires_read_barrier); // Push value to FPU stack. `is_fp` specifies whether the value is floating point or not. // `is_wide` specifies whether it is long/double or not. diff --git a/compiler/optimizing/code_generator_x86_64.cc b/compiler/optimizing/code_generator_x86_64.cc index 4b64c1b6f..1f0d64843 100644 --- a/compiler/optimizing/code_generator_x86_64.cc +++ b/compiler/optimizing/code_generator_x86_64.cc @@ -5318,7 +5318,7 @@ void InstructionCodeGeneratorX86_64::VisitLoadClass(HLoadClass* cls) { cls, out_loc, Address(current_method, ArtMethod::DeclaringClassOffset().Int32Value()), - /*fixup_label*/nullptr, + /* fixup_label */ nullptr, requires_read_barrier); break; } @@ -5343,7 +5343,7 @@ void InstructionCodeGeneratorX86_64::VisitLoadClass(HLoadClass* cls) { GenerateGcRootFieldLoad(cls, out_loc, address, - /*fixup_label*/nullptr, + /* fixup_label */ nullptr, requires_read_barrier); } else { // TODO: Consider using opcode A1, i.e. movl eax, moff32 (with 64-bit address). @@ -5351,7 +5351,7 @@ void InstructionCodeGeneratorX86_64::VisitLoadClass(HLoadClass* cls) { GenerateGcRootFieldLoad(cls, out_loc, Address(out, 0), - /*fixup_label*/nullptr, + /* fixup_label */ nullptr, requires_read_barrier); } generate_null_check = !cls->IsInDexCache(); @@ -5379,7 +5379,7 @@ void InstructionCodeGeneratorX86_64::VisitLoadClass(HLoadClass* cls) { cls, out_loc, Address(out, CodeGenerator::GetCacheOffset(cls->GetTypeIndex())), - /*fixup_label*/nullptr, + /* fixup_label */ nullptr, requires_read_barrier); generate_null_check = !cls->IsInDexCache(); break; @@ -5496,7 +5496,7 @@ void InstructionCodeGeneratorX86_64::VisitLoadString(HLoadString* load) { /* no_rip */ false); Label* fixup_label = codegen_->NewStringBssEntryPatch(load); // /* GcRoot */ out = *address /* PC-relative */ - GenerateGcRootFieldLoad(load, out_loc, address, fixup_label); + GenerateGcRootFieldLoad(load, out_loc, address, fixup_label, kEmitCompilerReadBarrier); SlowPathCode* slow_path = new (GetGraph()->GetArena()) LoadStringSlowPathX86_64(load); codegen_->AddSlowPath(slow_path); __ testl(out, out); diff --git a/compiler/optimizing/code_generator_x86_64.h b/compiler/optimizing/code_generator_x86_64.h index 57ef83f62..eb082a0d5 100644 --- a/compiler/optimizing/code_generator_x86_64.h +++ b/compiler/optimizing/code_generator_x86_64.h @@ -253,12 +253,12 @@ class InstructionCodeGeneratorX86_64 : public InstructionCodeGenerator { // // root <- *address // - // while honoring read barriers (if any). + // while honoring read barriers if `requires_read_barrier` is true. void GenerateGcRootFieldLoad(HInstruction* instruction, Location root, const Address& address, - Label* fixup_label = nullptr, - bool requires_read_barrier = kEmitCompilerReadBarrier); + Label* fixup_label, + bool requires_read_barrier); void PushOntoFPStack(Location source, uint32_t temp_offset, uint32_t stack_adjustment, bool is_float); -- 2.11.0