diff options
author | Andreas Gampe <agampe@google.com> | 2014-11-03 21:36:10 -0800 |
---|---|---|
committer | Andreas Gampe <agampe@google.com> | 2014-11-04 18:40:08 -0800 |
commit | 277ccbd200ea43590dfc06a93ae184a765327ad0 (patch) | |
tree | d89712e93da5fb2748989353c9ee071102cf3f33 /compiler | |
parent | ad17d41841ba1fb177fb0bf175ec0e9f5e1412b3 (diff) | |
download | android_art-277ccbd200ea43590dfc06a93ae184a765327ad0.tar.gz android_art-277ccbd200ea43590dfc06a93ae184a765327ad0.tar.bz2 android_art-277ccbd200ea43590dfc06a93ae184a765327ad0.zip |
ART: More warnings
Enable -Wno-conversion-null, -Wredundant-decls and -Wshadow in general,
and -Wunused-but-set-parameter for GCC builds.
Change-Id: I81bbdd762213444673c65d85edae594a523836e5
Diffstat (limited to 'compiler')
35 files changed, 266 insertions, 256 deletions
diff --git a/compiler/compiled_method.h b/compiler/compiled_method.h index cdae8d2d24..0361cd18cc 100644 --- a/compiler/compiled_method.h +++ b/compiler/compiled_method.h @@ -162,7 +162,7 @@ class SrcMap FINAL : public std::vector<SrcMapElem> { } this->resize(i + 1); - for (size_t i = size(); --i >= 1; ) { + for (i = size(); --i >= 1; ) { (*this)[i].from_ -= (*this)[i-1].from_; (*this)[i].to_ -= (*this)[i-1].to_; } diff --git a/compiler/dex/local_value_numbering.cc b/compiler/dex/local_value_numbering.cc index a7d93538d6..c1ce2ac016 100644 --- a/compiler/dex/local_value_numbering.cc +++ b/compiler/dex/local_value_numbering.cc @@ -787,9 +787,9 @@ void LocalValueNumbering::MergeAliasingValues(const typename Map::value_type& en if (same_version) { // Find the first non-null values. for (const LocalValueNumbering* lvn : gvn_->merge_lvns_) { - auto it = (lvn->*map_ptr).find(key); - if (it != (lvn->*map_ptr).end()) { - cmp_values = &it->second; + auto value = (lvn->*map_ptr).find(key); + if (value != (lvn->*map_ptr).end()) { + cmp_values = &value->second; break; } } @@ -799,21 +799,21 @@ void LocalValueNumbering::MergeAliasingValues(const typename Map::value_type& en // field version and the values' memory_version_before_stores, last_stored_value // and store_loc_set are identical. for (const LocalValueNumbering* lvn : gvn_->merge_lvns_) { - auto it = (lvn->*map_ptr).find(key); - if (it == (lvn->*map_ptr).end()) { + auto value = (lvn->*map_ptr).find(key); + if (value == (lvn->*map_ptr).end()) { if (cmp_values->memory_version_before_stores != kNoValue) { same_version = false; break; } - } else if (cmp_values->last_stored_value != it->second.last_stored_value || - cmp_values->memory_version_before_stores != it->second.memory_version_before_stores || - cmp_values->store_loc_set != it->second.store_loc_set) { + } else if (cmp_values->last_stored_value != value->second.last_stored_value || + cmp_values->memory_version_before_stores != value->second.memory_version_before_stores || + cmp_values->store_loc_set != value->second.store_loc_set) { same_version = false; break; - } else if (it->second.last_load_memory_version != kNoValue) { + } else if (value->second.last_load_memory_version != kNoValue) { DCHECK(load_memory_version_for_same_version == kNoValue || - load_memory_version_for_same_version == it->second.last_load_memory_version); - load_memory_version_for_same_version = it->second.last_load_memory_version; + load_memory_version_for_same_version == value->second.last_load_memory_version); + load_memory_version_for_same_version = value->second.last_load_memory_version; } } } @@ -828,12 +828,12 @@ void LocalValueNumbering::MergeAliasingValues(const typename Map::value_type& en if (!cmp_values->load_value_map.empty()) { my_values->load_value_map = cmp_values->load_value_map; for (const LocalValueNumbering* lvn : gvn_->merge_lvns_) { - auto it = (lvn->*map_ptr).find(key); - if (it == (lvn->*map_ptr).end() || it->second.load_value_map.empty()) { + auto value = (lvn->*map_ptr).find(key); + if (value == (lvn->*map_ptr).end() || value->second.load_value_map.empty()) { my_values->load_value_map.clear(); break; } - InPlaceIntersectMaps(&my_values->load_value_map, it->second.load_value_map); + InPlaceIntersectMaps(&my_values->load_value_map, value->second.load_value_map); if (my_values->load_value_map.empty()) { break; } @@ -847,20 +847,20 @@ void LocalValueNumbering::MergeAliasingValues(const typename Map::value_type& en // Calculate the locations that have been either read from or written to in each incoming LVN. bool first_lvn = true; for (const LocalValueNumbering* lvn : gvn_->merge_lvns_) { - auto it = (lvn->*map_ptr).find(key); - if (it == (lvn->*map_ptr).end()) { + auto value = (lvn->*map_ptr).find(key); + if (value == (lvn->*map_ptr).end()) { my_values->load_value_map.clear(); break; } if (first_lvn) { first_lvn = false; // Copy the first LVN's locations. Values will be overwritten later. - my_values->load_value_map = it->second.load_value_map; - for (uint16_t location : it->second.store_loc_set) { + my_values->load_value_map = value->second.load_value_map; + for (uint16_t location : value->second.store_loc_set) { my_values->load_value_map.Put(location, 0u); } } else { - IntersectAliasingValueLocations(my_values, &it->second); + IntersectAliasingValueLocations(my_values, &value->second); } } // Calculate merged values for the intersection. diff --git a/compiler/dex/quick/arm/utility_arm.cc b/compiler/dex/quick/arm/utility_arm.cc index 448e80f715..a1a5ad1d1f 100644 --- a/compiler/dex/quick/arm/utility_arm.cc +++ b/compiler/dex/quick/arm/utility_arm.cc @@ -464,7 +464,6 @@ LIR* ArmMir2Lir::OpRegRegReg(OpKind op, RegStorage r_dest, RegStorage r_src1, Re } LIR* ArmMir2Lir::OpRegRegImm(OpKind op, RegStorage r_dest, RegStorage r_src1, int value) { - LIR* res; bool neg = (value < 0); int32_t abs_value = (neg) ? -value : value; ArmOpcode opcode = kThumbBkpt; @@ -590,6 +589,7 @@ LIR* ArmMir2Lir::OpRegRegImm(OpKind op, RegStorage r_dest, RegStorage r_src1, in } else { RegStorage r_scratch = AllocTemp(); LoadConstant(r_scratch, value); + LIR* res; if (EncodingMap[alt_opcode].flags & IS_QUAD_OP) res = NewLIR4(alt_opcode, r_dest.GetReg(), r_src1.GetReg(), r_scratch.GetReg(), 0); else diff --git a/compiler/dex/quick/arm64/assemble_arm64.cc b/compiler/dex/quick/arm64/assemble_arm64.cc index 85f502ced6..da7ac87325 100644 --- a/compiler/dex/quick/arm64/assemble_arm64.cc +++ b/compiler/dex/quick/arm64/assemble_arm64.cc @@ -928,14 +928,13 @@ void Arm64Mir2Lir::AssembleLIR() { // Check if branch offset can be encoded in tbz/tbnz. if (!IS_SIGNED_IMM14(delta >> 2)) { DexOffset dalvik_offset = lir->dalvik_offset; - int16_t opcode = lir->opcode; - LIR* target = lir->target; + LIR* targetLIR = lir->target; // "tbz/tbnz Rt, #imm, label" -> "tst Rt, #(1<<imm)". offset_adjustment -= lir->flags.size; - int32_t imm = EncodeLogicalImmediate(IS_WIDE(opcode), 1 << lir->operands[1]); - DCHECK_NE(imm, -1); + int32_t encodedImm = EncodeLogicalImmediate(IS_WIDE(opcode), 1 << lir->operands[1]); + DCHECK_NE(encodedImm, -1); lir->opcode = IS_WIDE(opcode) ? WIDE(kA64Tst2rl) : kA64Tst2rl; - lir->operands[1] = imm; + lir->operands[1] = encodedImm; lir->target = nullptr; lir->flags.fixup = EncodingMap[kA64Tst2rl].fixup; lir->flags.size = EncodingMap[kA64Tst2rl].size; @@ -944,7 +943,7 @@ void Arm64Mir2Lir::AssembleLIR() { opcode = UNWIDE(opcode); DCHECK(opcode == kA64Tbz3rht || opcode == kA64Tbnz3rht); LIR* new_lir = RawLIR(dalvik_offset, kA64B2ct, - opcode == kA64Tbz3rht ? kArmCondEq : kArmCondNe, 0, 0, 0, 0, target); + opcode == kA64Tbz3rht ? kArmCondEq : kArmCondNe, 0, 0, 0, 0, targetLIR); InsertLIRAfter(lir, new_lir); new_lir->offset = lir->offset + lir->flags.size; new_lir->flags.generation = generation; diff --git a/compiler/dex/quick/gen_common.cc b/compiler/dex/quick/gen_common.cc index 9410f7e83b..c5aa27c324 100644 --- a/compiler/dex/quick/gen_common.cc +++ b/compiler/dex/quick/gen_common.cc @@ -66,8 +66,8 @@ void Mir2Lir::GenDivZeroCheck(RegStorage reg) { void Mir2Lir::AddDivZeroCheckSlowPath(LIR* branch) { class DivZeroCheckSlowPath : public Mir2Lir::LIRSlowPath { public: - DivZeroCheckSlowPath(Mir2Lir* m2l, LIR* branch) - : LIRSlowPath(m2l, m2l->GetCurrentDexPc(), branch) { + DivZeroCheckSlowPath(Mir2Lir* m2l, LIR* branch_in) + : LIRSlowPath(m2l, m2l->GetCurrentDexPc(), branch_in) { } void Compile() OVERRIDE { @@ -84,9 +84,10 @@ void Mir2Lir::AddDivZeroCheckSlowPath(LIR* branch) { void Mir2Lir::GenArrayBoundsCheck(RegStorage index, RegStorage length) { class ArrayBoundsCheckSlowPath : public Mir2Lir::LIRSlowPath { public: - ArrayBoundsCheckSlowPath(Mir2Lir* m2l, LIR* branch, RegStorage index, RegStorage length) - : LIRSlowPath(m2l, m2l->GetCurrentDexPc(), branch), - index_(index), length_(length) { + ArrayBoundsCheckSlowPath(Mir2Lir* m2l, LIR* branch_in, RegStorage index_in, + RegStorage length_in) + : LIRSlowPath(m2l, m2l->GetCurrentDexPc(), branch_in), + index_(index_in), length_(length_in) { } void Compile() OVERRIDE { @@ -108,9 +109,9 @@ void Mir2Lir::GenArrayBoundsCheck(RegStorage index, RegStorage length) { void Mir2Lir::GenArrayBoundsCheck(int index, RegStorage length) { class ArrayBoundsCheckSlowPath : public Mir2Lir::LIRSlowPath { public: - ArrayBoundsCheckSlowPath(Mir2Lir* m2l, LIR* branch, int index, RegStorage length) - : LIRSlowPath(m2l, m2l->GetCurrentDexPc(), branch), - index_(index), length_(length) { + ArrayBoundsCheckSlowPath(Mir2Lir* m2l, LIR* branch_in, int index_in, RegStorage length_in) + : LIRSlowPath(m2l, m2l->GetCurrentDexPc(), branch_in), + index_(index_in), length_(length_in) { } void Compile() OVERRIDE { @@ -461,7 +462,7 @@ void Mir2Lir::GenFilledNewArray(CallInfo* info) { // Set up the loop counter (known to be > 0) LoadConstant(r_idx, elems - 1); // Generate the copy loop. Going backwards for convenience - LIR* target = NewLIR0(kPseudoTargetLabel); + LIR* loop_head_target = NewLIR0(kPseudoTargetLabel); // Copy next element { ScopedMemRefType mem_ref_type(this, ResourceMask::kDalvikReg); @@ -471,7 +472,7 @@ void Mir2Lir::GenFilledNewArray(CallInfo* info) { } StoreBaseIndexed(r_dst, r_idx, r_val, 2, k32); FreeTemp(r_val); - OpDecAndBranch(kCondGe, r_idx, target); + OpDecAndBranch(kCondGe, r_idx, loop_head_target); if (cu_->instruction_set == kX86 || cu_->instruction_set == kX86_64) { // Restore the target pointer OpRegRegImm(kOpAdd, ref_reg, r_dst, @@ -955,7 +956,6 @@ void Mir2Lir::GenConstClass(uint32_t type_idx, RegLocation rl_dest) { RegLocation rl_method = LoadCurrMethod(); CheckRegLocation(rl_method); RegStorage res_reg = AllocTempRef(); - RegLocation rl_result = EvalLoc(rl_dest, kRefReg, true); if (!cu_->compiler_driver->CanAccessTypeWithoutChecks(cu_->method_idx, *cu_->dex_file, type_idx)) { @@ -965,6 +965,7 @@ void Mir2Lir::GenConstClass(uint32_t type_idx, RegLocation rl_dest) { RegLocation rl_result = GetReturn(kRefReg); StoreValue(rl_dest, rl_result); } else { + RegLocation rl_result = EvalLoc(rl_dest, kRefReg, true); // We're don't need access checks, load type from dex cache int32_t dex_cache_offset = mirror::ArtMethod::DexCacheResolvedTypesOffset().Int32Value(); @@ -981,10 +982,10 @@ void Mir2Lir::GenConstClass(uint32_t type_idx, RegLocation rl_dest) { // Object to generate the slow path for class resolution. class SlowPath : public LIRSlowPath { public: - SlowPath(Mir2Lir* m2l, LIR* fromfast, LIR* cont, const int type_idx, - const RegLocation& rl_method, const RegLocation& rl_result) : - LIRSlowPath(m2l, m2l->GetCurrentDexPc(), fromfast, cont), type_idx_(type_idx), - rl_method_(rl_method), rl_result_(rl_result) { + SlowPath(Mir2Lir* m2l, LIR* fromfast, LIR* cont_in, const int type_idx_in, + const RegLocation& rl_method_in, const RegLocation& rl_result_in) : + LIRSlowPath(m2l, m2l->GetCurrentDexPc(), fromfast, cont_in), + type_idx_(type_idx_in), rl_method_(rl_method_in), rl_result_(rl_result_in) { } void Compile() { @@ -1045,9 +1046,10 @@ void Mir2Lir::GenConstString(uint32_t string_idx, RegLocation rl_dest) { // Object to generate the slow path for string resolution. class SlowPath : public LIRSlowPath { public: - SlowPath(Mir2Lir* m2l, LIR* fromfast, LIR* cont, RegStorage r_method, int32_t string_idx) : - LIRSlowPath(m2l, m2l->GetCurrentDexPc(), fromfast, cont), - r_method_(r_method), string_idx_(string_idx) { + SlowPath(Mir2Lir* m2l, LIR* fromfast_in, LIR* cont_in, RegStorage r_method_in, + int32_t string_idx_in) : + LIRSlowPath(m2l, m2l->GetCurrentDexPc(), fromfast_in, cont_in), + r_method_(r_method_in), string_idx_(string_idx_in) { } void Compile() { @@ -1225,10 +1227,10 @@ void Mir2Lir::GenInstanceofCallingHelper(bool needs_access_check, bool type_know class InitTypeSlowPath : public Mir2Lir::LIRSlowPath { public: - InitTypeSlowPath(Mir2Lir* m2l, LIR* branch, LIR* cont, uint32_t type_idx, - RegLocation rl_src) - : LIRSlowPath(m2l, m2l->GetCurrentDexPc(), branch, cont), type_idx_(type_idx), - rl_src_(rl_src) { + InitTypeSlowPath(Mir2Lir* m2l, LIR* branch, LIR* cont, uint32_t type_idx_in, + RegLocation rl_src_in) + : LIRSlowPath(m2l, m2l->GetCurrentDexPc(), branch, cont), type_idx_(type_idx_in), + rl_src_(rl_src_in) { } void Compile() OVERRIDE { @@ -1370,10 +1372,10 @@ void Mir2Lir::GenCheckCast(uint32_t insn_idx, uint32_t type_idx, RegLocation rl_ // Slow path to initialize the type. Executed if the type is NULL. class SlowPath : public LIRSlowPath { public: - SlowPath(Mir2Lir* m2l, LIR* fromfast, LIR* cont, const int type_idx, - const RegStorage class_reg) : - LIRSlowPath(m2l, m2l->GetCurrentDexPc(), fromfast, cont), type_idx_(type_idx), - class_reg_(class_reg) { + SlowPath(Mir2Lir* m2l, LIR* fromfast, LIR* cont_in, const int type_idx_in, + const RegStorage class_reg_in) : + LIRSlowPath(m2l, m2l->GetCurrentDexPc(), fromfast, cont_in), + type_idx_(type_idx_in), class_reg_(class_reg_in) { } void Compile() { diff --git a/compiler/dex/quick/gen_invoke.cc b/compiler/dex/quick/gen_invoke.cc index c7449c8eae..4cb12f1dc9 100755 --- a/compiler/dex/quick/gen_invoke.cc +++ b/compiler/dex/quick/gen_invoke.cc @@ -44,8 +44,8 @@ typedef mirror::ObjectArray<mirror::Object> ObjArray; void Mir2Lir::AddIntrinsicSlowPath(CallInfo* info, LIR* branch, LIR* resume) { class IntrinsicSlowPathPath : public Mir2Lir::LIRSlowPath { public: - IntrinsicSlowPathPath(Mir2Lir* m2l, CallInfo* info, LIR* branch, LIR* resume = nullptr) - : LIRSlowPath(m2l, info->offset, branch, resume), info_(info) { + IntrinsicSlowPathPath(Mir2Lir* m2l, CallInfo* info_in, LIR* branch_in, LIR* resume_in) + : LIRSlowPath(m2l, info_in->offset, branch_in, resume_in), info_(info_in) { } void Compile() { @@ -790,13 +790,13 @@ int Mir2Lir::GenDalvikArgsNoRange(CallInfo* info, if (rl_arg.reg.IsPair()) { reg = rl_arg.reg.GetHigh(); } else { - RegisterInfo* info = GetRegInfo(rl_arg.reg); - info = info->FindMatchingView(RegisterInfo::kHighSingleStorageMask); - if (info == nullptr) { + RegisterInfo* reg_info = GetRegInfo(rl_arg.reg); + reg_info = reg_info->FindMatchingView(RegisterInfo::kHighSingleStorageMask); + if (reg_info == nullptr) { // NOTE: For hard float convention we won't split arguments across reg/mem. UNIMPLEMENTED(FATAL) << "Needs hard float api."; } - reg = info->GetReg(); + reg = reg_info->GetReg(); } } else { // kArg2 & rArg3 can safely be used here diff --git a/compiler/dex/quick/mips/assemble_mips.cc b/compiler/dex/quick/mips/assemble_mips.cc index 310e1e980b..ca71c3010a 100644 --- a/compiler/dex/quick/mips/assemble_mips.cc +++ b/compiler/dex/quick/mips/assemble_mips.cc @@ -696,12 +696,12 @@ AssemblerStatus MipsMir2Lir::AssembleInstructions(CodeOffset start_addr) { // TUNING: replace with proper delay slot handling if (encoder->size == 8) { DCHECK(!IsPseudoLirOp(lir->opcode)); - const MipsEncodingMap *encoder = &EncodingMap[kMipsNop]; - uint32_t bits = encoder->skeleton; - code_buffer_.push_back(bits & 0xff); - code_buffer_.push_back((bits >> 8) & 0xff); - code_buffer_.push_back((bits >> 16) & 0xff); - code_buffer_.push_back((bits >> 24) & 0xff); + const MipsEncodingMap *encoder2 = &EncodingMap[kMipsNop]; + uint32_t bits2 = encoder2->skeleton; + code_buffer_.push_back(bits2 & 0xff); + code_buffer_.push_back((bits2 >> 8) & 0xff); + code_buffer_.push_back((bits2 >> 16) & 0xff); + code_buffer_.push_back((bits2 >> 24) & 0xff); } } return res; diff --git a/compiler/dex/quick/x86/int_x86.cc b/compiler/dex/quick/x86/int_x86.cc index 7229318331..26465a5568 100755 --- a/compiler/dex/quick/x86/int_x86.cc +++ b/compiler/dex/quick/x86/int_x86.cc @@ -1362,10 +1362,10 @@ void X86Mir2Lir::GenArrayBoundsCheck(RegStorage index, int len_offset) { class ArrayBoundsCheckSlowPath : public Mir2Lir::LIRSlowPath { public: - ArrayBoundsCheckSlowPath(Mir2Lir* m2l, LIR* branch, - RegStorage index, RegStorage array_base, int32_t len_offset) - : LIRSlowPath(m2l, m2l->GetCurrentDexPc(), branch), - index_(index), array_base_(array_base), len_offset_(len_offset) { + ArrayBoundsCheckSlowPath(Mir2Lir* m2l, LIR* branch_in, + RegStorage index_in, RegStorage array_base_in, int32_t len_offset_in) + : LIRSlowPath(m2l, m2l->GetCurrentDexPc(), branch_in), + index_(index_in), array_base_(array_base_in), len_offset_(len_offset_in) { } void Compile() OVERRIDE { @@ -1410,10 +1410,10 @@ void X86Mir2Lir::GenArrayBoundsCheck(int32_t index, int32_t len_offset) { class ArrayBoundsCheckSlowPath : public Mir2Lir::LIRSlowPath { public: - ArrayBoundsCheckSlowPath(Mir2Lir* m2l, LIR* branch, - int32_t index, RegStorage array_base, int32_t len_offset) - : LIRSlowPath(m2l, m2l->GetCurrentDexPc(), branch), - index_(index), array_base_(array_base), len_offset_(len_offset) { + ArrayBoundsCheckSlowPath(Mir2Lir* m2l, LIR* branch_in, + int32_t index_in, RegStorage array_base_in, int32_t len_offset_in) + : LIRSlowPath(m2l, m2l->GetCurrentDexPc(), branch_in), + index_(index_in), array_base_(array_base_in), len_offset_(len_offset_in) { } void Compile() OVERRIDE { diff --git a/compiler/dex/quick/x86/target_x86.cc b/compiler/dex/quick/x86/target_x86.cc index 9616d8fa71..270a4e5007 100755 --- a/compiler/dex/quick/x86/target_x86.cc +++ b/compiler/dex/quick/x86/target_x86.cc @@ -2703,7 +2703,7 @@ int X86Mir2Lir::GenDalvikArgsRange(CallInfo* info, int call_state, bool src_is_8b_aligned = (current_src_offset & 0x7) == 0; bool dest_is_8b_aligned = (current_dest_offset & 0x7) == 0; - ScopedMemRefType mem_ref_type(this, ResourceMask::kDalvikReg); + ScopedMemRefType mem_ref_type2(this, ResourceMask::kDalvikReg); if (src_is_16b_aligned) { ld1 = OpMovRegMem(temp, rs_rX86_SP, current_src_offset, kMovA128FP); } else if (src_is_8b_aligned) { diff --git a/compiler/dex/ssa_transformation.cc b/compiler/dex/ssa_transformation.cc index 412f85d5dd..d3d76badd0 100644 --- a/compiler/dex/ssa_transformation.cc +++ b/compiler/dex/ssa_transformation.cc @@ -539,8 +539,7 @@ bool MIRGraph::InsertPhiNodeOperands(BasicBlock* bb) { for (BasicBlockId pred_id : bb->predecessors) { BasicBlock* pred_bb = GetBasicBlock(pred_id); DCHECK(pred_bb != nullptr); - int ssa_reg = pred_bb->data_flow_info->vreg_to_ssa_map_exit[v_reg]; - uses[idx] = ssa_reg; + uses[idx] = pred_bb->data_flow_info->vreg_to_ssa_map_exit[v_reg]; incoming[idx] = pred_id; idx++; } diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc index 05785a89fa..aab94c000f 100644 --- a/compiler/driver/compiler_driver.cc +++ b/compiler/driver/compiler_driver.cc @@ -718,9 +718,9 @@ void CompilerDriver::LoadImageClasses(TimingLogger* timings) for (const std::pair<uint16_t, const DexFile*>& exception_type : unresolved_exception_types) { uint16_t exception_type_idx = exception_type.first; const DexFile* dex_file = exception_type.second; - StackHandleScope<2> hs(self); - Handle<mirror::DexCache> dex_cache(hs.NewHandle(class_linker->FindDexCache(*dex_file))); - Handle<mirror::Class> klass(hs.NewHandle( + StackHandleScope<2> hs2(self); + Handle<mirror::DexCache> dex_cache(hs2.NewHandle(class_linker->FindDexCache(*dex_file))); + Handle<mirror::Class> klass(hs2.NewHandle( class_linker->ResolveType(*dex_file, exception_type_idx, dex_cache, NullHandle<mirror::ClassLoader>()))); if (klass.Get() == nullptr) { @@ -757,13 +757,13 @@ static void MaybeAddToImageClasses(Handle<mirror::Class> c, std::set<std::string } VLOG(compiler) << "Adding " << descriptor << " to image classes"; for (size_t i = 0; i < klass->NumDirectInterfaces(); ++i) { - StackHandleScope<1> hs(self); - MaybeAddToImageClasses(hs.NewHandle(mirror::Class::GetDirectInterface(self, klass, i)), + StackHandleScope<1> hs2(self); + MaybeAddToImageClasses(hs2.NewHandle(mirror::Class::GetDirectInterface(self, klass, i)), image_classes); } if (klass->IsArrayClass()) { - StackHandleScope<1> hs(self); - MaybeAddToImageClasses(hs.NewHandle(klass->GetComponentType()), image_classes); + StackHandleScope<1> hs2(self); + MaybeAddToImageClasses(hs2.NewHandle(klass->GetComponentType()), image_classes); } klass.Assign(klass->GetSuperClass()); } diff --git a/compiler/driver/compiler_driver_test.cc b/compiler/driver/compiler_driver_test.cc index 9ae9bd400a..5a0ec2fa57 100644 --- a/compiler/driver/compiler_driver_test.cc +++ b/compiler/driver/compiler_driver_test.cc @@ -86,11 +86,11 @@ class CompilerDriverTest : public CommonCompilerTest { hs.NewHandle(soa.Decode<mirror::ClassLoader*>(class_loader))); mirror::Class* c = class_linker->FindClass(soa.Self(), descriptor, loader); CHECK(c != NULL); - for (size_t i = 0; i < c->NumDirectMethods(); i++) { - MakeExecutable(c->GetDirectMethod(i)); + for (size_t j = 0; j < c->NumDirectMethods(); j++) { + MakeExecutable(c->GetDirectMethod(j)); } - for (size_t i = 0; i < c->NumVirtualMethods(); i++) { - MakeExecutable(c->GetVirtualMethod(i)); + for (size_t j = 0; j < c->NumVirtualMethods(); j++) { + MakeExecutable(c->GetVirtualMethod(j)); } } } diff --git a/compiler/jni/jni_compiler_test.cc b/compiler/jni/jni_compiler_test.cc index 113204635c..27554423ca 100644 --- a/compiler/jni/jni_compiler_test.cc +++ b/compiler/jni/jni_compiler_test.cc @@ -785,9 +785,9 @@ jint Java_MyClassNatives_nativeUpCall(JNIEnv* env, jobject thisObj, jint i) { EXPECT_EQ(11, trace_array->GetLength()); // Check stack trace entries have expected values - for (int32_t i = 0; i < trace_array->GetLength(); ++i) { - EXPECT_EQ(-2, trace_array->Get(i)->GetLineNumber()); - mirror::StackTraceElement* ste = trace_array->Get(i); + for (int32_t j = 0; j < trace_array->GetLength(); ++j) { + EXPECT_EQ(-2, trace_array->Get(j)->GetLineNumber()); + mirror::StackTraceElement* ste = trace_array->Get(j); EXPECT_STREQ("MyClassNatives.java", ste->GetFileName()->ToModifiedUtf8().c_str()); EXPECT_STREQ("MyClassNatives", ste->GetDeclaringClass()->ToModifiedUtf8().c_str()); EXPECT_STREQ("fooI", ste->GetMethodName()->ToModifiedUtf8().c_str()); diff --git a/compiler/oat_test.cc b/compiler/oat_test.cc index 4cb7d9cdd6..97b7cc90dd 100644 --- a/compiler/oat_test.cc +++ b/compiler/oat_test.cc @@ -113,8 +113,8 @@ TEST_F(OatTest, WriteRead) { timer_.get(), "")); jobject class_loader = nullptr; if (kCompile) { - TimingLogger timings("OatTest::WriteRead", false, false); - compiler_driver_->CompileAll(class_loader, class_linker->GetBootClassPath(), &timings); + TimingLogger timings2("OatTest::WriteRead", false, false); + compiler_driver_->CompileAll(class_loader, class_linker->GetBootClassPath(), &timings2); } ScratchFile tmp; @@ -174,12 +174,12 @@ TEST_F(OatTest, WriteRead) { oat_class.GetType()) << descriptor; size_t method_index = 0; - for (size_t i = 0; i < klass->NumDirectMethods(); i++, method_index++) { - CheckMethod(klass->GetDirectMethod(i), + for (size_t j = 0; j < klass->NumDirectMethods(); j++, method_index++) { + CheckMethod(klass->GetDirectMethod(j), oat_class.GetOatMethod(method_index), dex_file); } - for (size_t i = 0; i < num_virtual_methods; i++, method_index++) { - CheckMethod(klass->GetVirtualMethod(i), + for (size_t j = 0; j < num_virtual_methods; j++, method_index++) { + CheckMethod(klass->GetVirtualMethod(j), oat_class.GetOatMethod(method_index), dex_file); } } diff --git a/compiler/oat_writer.cc b/compiler/oat_writer.cc index 6138411b11..659c3328fc 100644 --- a/compiler/oat_writer.cc +++ b/compiler/oat_writer.cc @@ -1294,9 +1294,9 @@ size_t OatWriter::InitOatClasses(size_t offset) { // Update oat_dex_files_. auto oat_class_it = oat_classes_.begin(); for (OatDexFile* oat_dex_file : oat_dex_files_) { - for (uint32_t& offset : oat_dex_file->methods_offsets_) { + for (uint32_t& method_offset : oat_dex_file->methods_offsets_) { DCHECK(oat_class_it != oat_classes_.end()); - offset = (*oat_class_it)->offset_; + method_offset = (*oat_class_it)->offset_; ++oat_class_it; } oat_dex_file->UpdateChecksum(oat_header_); diff --git a/compiler/optimizing/code_generator_arm.cc b/compiler/optimizing/code_generator_arm.cc index 0cec4b404a..5513c62d17 100644 --- a/compiler/optimizing/code_generator_arm.cc +++ b/compiler/optimizing/code_generator_arm.cc @@ -1561,7 +1561,6 @@ void LocationsBuilderARM::VisitCompare(HCompare* compare) { } void InstructionCodeGeneratorARM::VisitCompare(HCompare* compare) { - Label greater, done; LocationSummary* locations = compare->GetLocations(); switch (compare->InputAt(0)->GetType()) { case Primitive::kPrimLong: { diff --git a/compiler/optimizing/code_generator_arm64.cc b/compiler/optimizing/code_generator_arm64.cc index 6ac7a31d3f..90d7c35975 100644 --- a/compiler/optimizing/code_generator_arm64.cc +++ b/compiler/optimizing/code_generator_arm64.cc @@ -760,16 +760,16 @@ void InstructionCodeGeneratorARM64::VisitIf(HIf* if_instr) { // the comparison and its condition as the branch condition. Register lhs = InputRegisterAt(condition, 0); Operand rhs = InputOperandAt(condition, 1); - Condition cond = ARM64Condition(condition->GetCondition()); - if ((cond == eq || cond == ne) && rhs.IsImmediate() && (rhs.immediate() == 0)) { - if (cond == eq) { + Condition arm64_cond = ARM64Condition(condition->GetCondition()); + if ((arm64_cond == eq || arm64_cond == ne) && rhs.IsImmediate() && (rhs.immediate() == 0)) { + if (arm64_cond == eq) { __ Cbz(lhs, true_target); } else { __ Cbnz(lhs, true_target); } } else { __ Cmp(lhs, rhs); - __ B(cond, true_target); + __ B(arm64_cond, true_target); } } diff --git a/compiler/optimizing/code_generator_x86.cc b/compiler/optimizing/code_generator_x86.cc index ac328c319c..ff852512c5 100644 --- a/compiler/optimizing/code_generator_x86.cc +++ b/compiler/optimizing/code_generator_x86.cc @@ -1507,7 +1507,6 @@ void LocationsBuilderX86::VisitCompare(HCompare* compare) { } void InstructionCodeGeneratorX86::VisitCompare(HCompare* compare) { - Label greater, done; LocationSummary* locations = compare->GetLocations(); switch (compare->InputAt(0)->GetType()) { case Primitive::kPrimLong: { diff --git a/compiler/optimizing/codegen_test.cc b/compiler/optimizing/codegen_test.cc index 803a09b733..68fcb25036 100644 --- a/compiler/optimizing/codegen_test.cc +++ b/compiler/optimizing/codegen_test.cc @@ -373,9 +373,9 @@ TEST(CodegenTest, NonMaterializedCondition) { PrepareForRegisterAllocation(graph).Run(); ASSERT_FALSE(equal->NeedsMaterialization()); - auto hook_before_codegen = [](HGraph* graph) { - HBasicBlock* block = graph->GetEntryBlock()->GetSuccessors().Get(0); - HParallelMove* move = new (graph->GetArena()) HParallelMove(graph->GetArena()); + auto hook_before_codegen = [](HGraph* graph_in) { + HBasicBlock* block = graph_in->GetEntryBlock()->GetSuccessors().Get(0); + HParallelMove* move = new (graph_in->GetArena()) HParallelMove(graph_in->GetArena()); block->InsertInstructionBefore(move, block->GetLastInstruction()); }; @@ -463,9 +463,9 @@ TEST(CodegenTest, MaterializedCondition1) { HReturn ret(&cmp_lt); code_block->AddInstruction(&ret); - auto hook_before_codegen = [](HGraph* graph) { - HBasicBlock* block = graph->GetEntryBlock()->GetSuccessors().Get(0); - HParallelMove* move = new (graph->GetArena()) HParallelMove(graph->GetArena()); + auto hook_before_codegen = [](HGraph* graph_in) { + HBasicBlock* block = graph_in->GetEntryBlock()->GetSuccessors().Get(0); + HParallelMove* move = new (graph_in->GetArena()) HParallelMove(graph_in->GetArena()); block->InsertInstructionBefore(move, block->GetLastInstruction()); }; @@ -533,9 +533,9 @@ TEST(CodegenTest, MaterializedCondition2) { HReturn ret_ge(&cst_ge); if_false_block->AddInstruction(&ret_ge); - auto hook_before_codegen = [](HGraph* graph) { - HBasicBlock* block = graph->GetEntryBlock()->GetSuccessors().Get(0); - HParallelMove* move = new (graph->GetArena()) HParallelMove(graph->GetArena()); + auto hook_before_codegen = [](HGraph* graph_in) { + HBasicBlock* block = graph_in->GetEntryBlock()->GetSuccessors().Get(0); + HParallelMove* move = new (graph_in->GetArena()) HParallelMove(graph_in->GetArena()); block->InsertInstructionBefore(move, block->GetLastInstruction()); }; diff --git a/compiler/optimizing/constant_folding.cc b/compiler/optimizing/constant_folding.cc index 10a7e46299..fca9933872 100644 --- a/compiler/optimizing/constant_folding.cc +++ b/compiler/optimizing/constant_folding.cc @@ -28,9 +28,9 @@ void HConstantFolding::Run() { // Traverse this block's instructions in (forward) order and // replace the ones that can be statically evaluated by a // compile-time counterpart. - for (HInstructionIterator it(block->GetInstructions()); - !it.Done(); it.Advance()) { - HInstruction* inst = it.Current(); + for (HInstructionIterator inst_it(block->GetInstructions()); + !inst_it.Done(); inst_it.Advance()) { + HInstruction* inst = inst_it.Current(); if (inst->IsBinaryOperation()) { // Constant folding: replace `op(a, b)' with a constant at // compile time if `a' and `b' are both constants. diff --git a/compiler/optimizing/gvn.cc b/compiler/optimizing/gvn.cc index 027b3d4ff3..25168b5b0c 100644 --- a/compiler/optimizing/gvn.cc +++ b/compiler/optimizing/gvn.cc @@ -54,8 +54,9 @@ void GlobalValueNumberer::ComputeSideEffects() { SideEffects effects = SideEffects::None(); // Update `effects` with the side effects of all instructions in this block. - for (HInstructionIterator it(block->GetInstructions()); !it.Done(); it.Advance()) { - HInstruction* instruction = it.Current(); + for (HInstructionIterator inst_it(block->GetInstructions()); !inst_it.Done(); + inst_it.Advance()) { + HInstruction* instruction = inst_it.Current(); effects = effects.Union(instruction->GetSideEffects()); if (effects.HasAllSideEffects()) { break; diff --git a/compiler/optimizing/parallel_move_resolver.cc b/compiler/optimizing/parallel_move_resolver.cc index c71d93ebe5..1e93ece2ef 100644 --- a/compiler/optimizing/parallel_move_resolver.cc +++ b/compiler/optimizing/parallel_move_resolver.cc @@ -130,13 +130,13 @@ void ParallelMoveResolver::PerformMove(size_t index) { // this move's source or destination needs to have their source // changed to reflect the state of affairs after the swap. Location source = move->GetSource(); - Location destination = move->GetDestination(); + Location swap_destination = move->GetDestination(); move->Eliminate(); for (size_t i = 0; i < moves_.Size(); ++i) { const MoveOperands& other_move = *moves_.Get(i); if (other_move.Blocks(source)) { - moves_.Get(i)->SetSource(destination); - } else if (other_move.Blocks(destination)) { + moves_.Get(i)->SetSource(swap_destination); + } else if (other_move.Blocks(swap_destination)) { moves_.Get(i)->SetSource(source); } } diff --git a/compiler/optimizing/prepare_for_register_allocation.cc b/compiler/optimizing/prepare_for_register_allocation.cc index 2387141a39..35d56f3ccb 100644 --- a/compiler/optimizing/prepare_for_register_allocation.cc +++ b/compiler/optimizing/prepare_for_register_allocation.cc @@ -23,8 +23,9 @@ void PrepareForRegisterAllocation::Run() { for (HReversePostOrderIterator it(*GetGraph()); !it.Done(); it.Advance()) { HBasicBlock* block = it.Current(); // No need to visit the phis. - for (HInstructionIterator it(block->GetInstructions()); !it.Done(); it.Advance()) { - it.Current()->Accept(this); + for (HInstructionIterator inst_it(block->GetInstructions()); !inst_it.Done(); + inst_it.Advance()) { + inst_it.Current()->Accept(this); } } } diff --git a/compiler/optimizing/register_allocator.cc b/compiler/optimizing/register_allocator.cc index c98b82a6ed..2a9c88506d 100644 --- a/compiler/optimizing/register_allocator.cc +++ b/compiler/optimizing/register_allocator.cc @@ -126,11 +126,12 @@ void RegisterAllocator::AllocateRegistersInternal() { // is the one with the lowest start position. for (HLinearPostOrderIterator it(liveness_); !it.Done(); it.Advance()) { HBasicBlock* block = it.Current(); - for (HBackwardInstructionIterator it(block->GetInstructions()); !it.Done(); it.Advance()) { - ProcessInstruction(it.Current()); + for (HBackwardInstructionIterator back_it(block->GetInstructions()); !back_it.Done(); + back_it.Advance()) { + ProcessInstruction(back_it.Current()); } - for (HInstructionIterator it(block->GetPhis()); !it.Done(); it.Advance()) { - ProcessInstruction(it.Current()); + for (HInstructionIterator inst_it(block->GetPhis()); !inst_it.Done(); inst_it.Advance()) { + ProcessInstruction(inst_it.Current()); } } @@ -1201,8 +1202,8 @@ void RegisterAllocator::Resolve() { // Resolve phi inputs. Order does not matter. for (HLinearOrderIterator it(liveness_); !it.Done(); it.Advance()) { HBasicBlock* current = it.Current(); - for (HInstructionIterator it(current->GetPhis()); !it.Done(); it.Advance()) { - HInstruction* phi = it.Current(); + for (HInstructionIterator inst_it(current->GetPhis()); !inst_it.Done(); inst_it.Advance()) { + HInstruction* phi = inst_it.Current(); for (size_t i = 0, e = current->GetPredecessors().Size(); i < e; ++i) { HBasicBlock* predecessor = current->GetPredecessors().Get(i); DCHECK_EQ(predecessor->GetSuccessors().Size(), 1u); diff --git a/compiler/optimizing/ssa_builder.cc b/compiler/optimizing/ssa_builder.cc index a0cc8a94ee..e83c528fab 100644 --- a/compiler/optimizing/ssa_builder.cc +++ b/compiler/optimizing/ssa_builder.cc @@ -109,8 +109,8 @@ void SsaBuilder::VisitBasicBlock(HBasicBlock* block) { HPhi* phi = new (GetGraph()->GetArena()) HPhi( GetGraph()->GetArena(), local, block->GetPredecessors().Size(), Primitive::kPrimVoid); for (size_t i = 0; i < block->GetPredecessors().Size(); i++) { - HInstruction* value = ValueOfLocal(block->GetPredecessors().Get(i), local); - phi->SetRawInputAt(i, value); + HInstruction* pred_value = ValueOfLocal(block->GetPredecessors().Get(i), local); + phi->SetRawInputAt(i, pred_value); } block->AddPhi(phi); value = phi; diff --git a/compiler/optimizing/ssa_liveness_analysis.cc b/compiler/optimizing/ssa_liveness_analysis.cc index 97bc7f3dfd..0085b27c58 100644 --- a/compiler/optimizing/ssa_liveness_analysis.cc +++ b/compiler/optimizing/ssa_liveness_analysis.cc @@ -107,8 +107,8 @@ void SsaLivenessAnalysis::NumberInstructions() { HBasicBlock* block = it.Current(); block->SetLifetimeStart(lifetime_position); - for (HInstructionIterator it(block->GetPhis()); !it.Done(); it.Advance()) { - HInstruction* current = it.Current(); + for (HInstructionIterator inst_it(block->GetPhis()); !inst_it.Done(); inst_it.Advance()) { + HInstruction* current = inst_it.Current(); current->Accept(location_builder); LocationSummary* locations = current->GetLocations(); if (locations != nullptr && locations->Out().IsValid()) { @@ -124,8 +124,9 @@ void SsaLivenessAnalysis::NumberInstructions() { // Add a null marker to notify we are starting a block. instructions_from_lifetime_position_.Add(nullptr); - for (HInstructionIterator it(block->GetInstructions()); !it.Done(); it.Advance()) { - HInstruction* current = it.Current(); + for (HInstructionIterator inst_it(block->GetInstructions()); !inst_it.Done(); + inst_it.Advance()) { + HInstruction* current = inst_it.Current(); current->Accept(codegen_->GetLocationBuilder()); LocationSummary* locations = current->GetLocations(); if (locations != nullptr && locations->Out().IsValid()) { @@ -178,8 +179,8 @@ void SsaLivenessAnalysis::ComputeLiveRanges() { HBasicBlock* successor = block->GetSuccessors().Get(i); live_in->Union(GetLiveInSet(*successor)); size_t phi_input_index = successor->GetPredecessorIndexOf(block); - for (HInstructionIterator it(successor->GetPhis()); !it.Done(); it.Advance()) { - HInstruction* phi = it.Current(); + for (HInstructionIterator inst_it(successor->GetPhis()); !inst_it.Done(); inst_it.Advance()) { + HInstruction* phi = inst_it.Current(); HInstruction* input = phi->InputAt(phi_input_index); input->GetLiveInterval()->AddPhiUse(phi, phi_input_index, block); // A phi input whose last user is the phi dies at the end of the predecessor block, @@ -195,8 +196,9 @@ void SsaLivenessAnalysis::ComputeLiveRanges() { current->GetLiveInterval()->AddRange(block->GetLifetimeStart(), block->GetLifetimeEnd()); } - for (HBackwardInstructionIterator it(block->GetInstructions()); !it.Done(); it.Advance()) { - HInstruction* current = it.Current(); + for (HBackwardInstructionIterator back_it(block->GetInstructions()); !back_it.Done(); + back_it.Advance()) { + HInstruction* current = back_it.Current(); if (current->HasSsaIndex()) { // Kill the instruction and shorten its interval. kill->SetBit(current->GetSsaIndex()); @@ -230,8 +232,8 @@ void SsaLivenessAnalysis::ComputeLiveRanges() { } // Kill phis defined in this block. - for (HInstructionIterator it(block->GetPhis()); !it.Done(); it.Advance()) { - HInstruction* current = it.Current(); + for (HInstructionIterator inst_it(block->GetPhis()); !inst_it.Done(); inst_it.Advance()) { + HInstruction* current = inst_it.Current(); if (current->HasSsaIndex()) { kill->SetBit(current->GetSsaIndex()); live_in->ClearBit(current->GetSsaIndex()); diff --git a/compiler/optimizing/ssa_phi_elimination.cc b/compiler/optimizing/ssa_phi_elimination.cc index 4eda0f3757..56979e1c6a 100644 --- a/compiler/optimizing/ssa_phi_elimination.cc +++ b/compiler/optimizing/ssa_phi_elimination.cc @@ -22,10 +22,10 @@ void SsaDeadPhiElimination::Run() { // Add to the worklist phis referenced by non-phi instructions. for (HReversePostOrderIterator it(*graph_); !it.Done(); it.Advance()) { HBasicBlock* block = it.Current(); - for (HInstructionIterator it(block->GetPhis()); !it.Done(); it.Advance()) { - HPhi* phi = it.Current()->AsPhi(); - for (HUseIterator<HInstruction> it(phi->GetUses()); !it.Done(); it.Advance()) { - HUseListNode<HInstruction>* current = it.Current(); + for (HInstructionIterator inst_it(block->GetPhis()); !inst_it.Done(); inst_it.Advance()) { + HPhi* phi = inst_it.Current()->AsPhi(); + for (HUseIterator<HInstruction> use_it(phi->GetUses()); !use_it.Done(); use_it.Advance()) { + HUseListNode<HInstruction>* current = use_it.Current(); HInstruction* user = current->GetUser(); if (!user->IsPhi()) { worklist_.Add(phi); @@ -61,8 +61,9 @@ void SsaDeadPhiElimination::Run() { next = current->GetNext(); if (current->AsPhi()->IsDead()) { if (current->HasUses()) { - for (HUseIterator<HInstruction> it(current->GetUses()); !it.Done(); it.Advance()) { - HUseListNode<HInstruction>* user_node = it.Current(); + for (HUseIterator<HInstruction> use_it(current->GetUses()); !use_it.Done(); + use_it.Advance()) { + HUseListNode<HInstruction>* user_node = use_it.Current(); HInstruction* user = user_node->GetUser(); DCHECK(user->IsLoopHeaderPhi()); DCHECK(user->AsPhi()->IsDead()); @@ -72,8 +73,9 @@ void SsaDeadPhiElimination::Run() { } } if (current->HasEnvironmentUses()) { - for (HUseIterator<HEnvironment> it(current->GetEnvUses()); !it.Done(); it.Advance()) { - HUseListNode<HEnvironment>* user_node = it.Current(); + for (HUseIterator<HEnvironment> use_it(current->GetEnvUses()); !use_it.Done(); + use_it.Advance()) { + HUseListNode<HEnvironment>* user_node = use_it.Current(); HEnvironment* user = user_node->GetUser(); user->SetRawEnvAt(user_node->GetIndex(), nullptr); current->RemoveEnvironmentUser(user, user_node->GetIndex()); @@ -90,8 +92,8 @@ void SsaRedundantPhiElimination::Run() { // Add all phis in the worklist. for (HReversePostOrderIterator it(*graph_); !it.Done(); it.Advance()) { HBasicBlock* block = it.Current(); - for (HInstructionIterator it(block->GetPhis()); !it.Done(); it.Advance()) { - worklist_.Add(it.Current()->AsPhi()); + for (HInstructionIterator inst_it(block->GetPhis()); !inst_it.Done(); inst_it.Advance()) { + worklist_.Add(inst_it.Current()->AsPhi()); } } diff --git a/compiler/optimizing/stack_map_stream.h b/compiler/optimizing/stack_map_stream.h index 5f74c33643..9cfa71c13f 100644 --- a/compiler/optimizing/stack_map_stream.h +++ b/compiler/optimizing/stack_map_stream.h @@ -167,33 +167,33 @@ class StackMapStream : public ValueObject { } // Set the register map. - MemoryRegion region = dex_register_maps_region.Subregion( + MemoryRegion register_region = dex_register_maps_region.Subregion( next_dex_register_map_offset, DexRegisterMap::kFixedSize + entry.num_dex_registers * DexRegisterMap::SingleEntrySize()); - next_dex_register_map_offset += region.size(); - DexRegisterMap dex_register_map(region); - stack_map.SetDexRegisterMapOffset(region.start() - memory_start); + next_dex_register_map_offset += register_region.size(); + DexRegisterMap dex_register_map(register_region); + stack_map.SetDexRegisterMapOffset(register_region.start() - memory_start); - for (size_t i = 0; i < entry.num_dex_registers; ++i) { + for (size_t j = 0; j < entry.num_dex_registers; ++j) { DexRegisterEntry register_entry = - dex_register_maps_.Get(i + entry.dex_register_maps_start_index); - dex_register_map.SetRegisterInfo(i, register_entry.kind, register_entry.value); + dex_register_maps_.Get(j + entry.dex_register_maps_start_index); + dex_register_map.SetRegisterInfo(j, register_entry.kind, register_entry.value); } // Set the inlining info. if (entry.inlining_depth != 0) { - MemoryRegion region = inline_infos_region.Subregion( + MemoryRegion inline_region = inline_infos_region.Subregion( next_inline_info_offset, InlineInfo::kFixedSize + entry.inlining_depth * InlineInfo::SingleEntrySize()); - next_inline_info_offset += region.size(); - InlineInfo inline_info(region); + next_inline_info_offset += inline_region.size(); + InlineInfo inline_info(inline_region); - stack_map.SetInlineDescriptorOffset(region.start() - memory_start); + stack_map.SetInlineDescriptorOffset(inline_region.start() - memory_start); inline_info.SetDepth(entry.inlining_depth); - for (size_t i = 0; i < entry.inlining_depth; ++i) { - InlineInfoEntry inline_entry = inline_infos_.Get(i + entry.inline_infos_start_index); - inline_info.SetMethodReferenceIndexAtDepth(i, inline_entry.method_index); + for (size_t j = 0; j < entry.inlining_depth; ++j) { + InlineInfoEntry inline_entry = inline_infos_.Get(j + entry.inline_infos_start_index); + inline_info.SetMethodReferenceIndexAtDepth(j, inline_entry.method_index); } } else { stack_map.SetInlineDescriptorOffset(InlineInfo::kNoInlineInfo); diff --git a/compiler/utils/arm/assembler_arm.cc b/compiler/utils/arm/assembler_arm.cc index e9788f91ba..591d461244 100644 --- a/compiler/utils/arm/assembler_arm.cc +++ b/compiler/utils/arm/assembler_arm.cc @@ -301,11 +301,11 @@ uint32_t Address::vencoding() const { CHECK(IsAbsoluteUint(10, offset)); // In the range -1020 to +1020. CHECK_ALIGNED(offset, 2); // Multiple of 4. CHECK((am_ == Offset) || (am_ == NegOffset)); - uint32_t vencoding = (encoding & (0xf << kRnShift)) | (offset >> 2); + uint32_t vencoding_value = (encoding & (0xf << kRnShift)) | (offset >> 2); if (am_ == Offset) { - vencoding |= 1 << 23; + vencoding_value |= 1 << 23; } - return vencoding; + return vencoding_value; } diff --git a/compiler/utils/arm/assembler_thumb2.cc b/compiler/utils/arm/assembler_thumb2.cc index fd2613a89e..71d6e7ead8 100644 --- a/compiler/utils/arm/assembler_thumb2.cc +++ b/compiler/utils/arm/assembler_thumb2.cc @@ -2121,8 +2121,8 @@ void Thumb2Assembler::Bind(Label* label) { branch->ResetSize(Branch::k16Bit); // Now add a compare instruction in the place the branch was. - int16_t cmp = B13 | B11 | static_cast<int16_t>(branch->GetRegister()) << 8; - buffer_.Store<int16_t>(branch_location, cmp); + buffer_.Store<int16_t>(branch_location, + B13 | B11 | static_cast<int16_t>(branch->GetRegister()) << 8); // Since have moved made a hole in the code we need to reload the // current pc. diff --git a/compiler/utils/arm64/assembler_arm64.h b/compiler/utils/arm64/assembler_arm64.h index 1b1d121725..a69be2599e 100644 --- a/compiler/utils/arm64/assembler_arm64.h +++ b/compiler/utils/arm64/assembler_arm64.h @@ -27,8 +27,13 @@ #include "utils/assembler.h" #include "offsets.h" #include "utils.h" + +// TODO: make vixl clean wrt -Wshadow. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wshadow" #include "a64/macro-assembler-a64.h" #include "a64/disasm-a64.h" +#pragma GCC diagnostic pop namespace art { namespace arm64 { diff --git a/compiler/utils/array_ref.h b/compiler/utils/array_ref.h index c137e46804..1a7f2e8c02 100644 --- a/compiler/utils/array_ref.h +++ b/compiler/utils/array_ref.h @@ -73,8 +73,8 @@ class ArrayRef { : array_(array), size_(size) { } - constexpr ArrayRef(T* array, size_t size) - : array_(array), size_(size) { + constexpr ArrayRef(T* array_in, size_t size_in) + : array_(array_in), size_(size_in) { } template <typename Alloc> diff --git a/compiler/utils/assembler.h b/compiler/utils/assembler.h index e1b6d7c21d..ad7e98d906 100644 --- a/compiler/utils/assembler.h +++ b/compiler/utils/assembler.h @@ -56,9 +56,9 @@ namespace x86_64 { class ExternalLabel { public: - ExternalLabel(const char* name, uintptr_t address) - : name_(name), address_(address) { - DCHECK(name != nullptr); + ExternalLabel(const char* name_in, uintptr_t address_in) + : name_(name_in), address_(address_in) { + DCHECK(name_in != nullptr); } const char* name() const { return name_; } @@ -140,10 +140,10 @@ class AssemblerFixup { int position_; AssemblerFixup* previous() const { return previous_; } - void set_previous(AssemblerFixup* previous) { previous_ = previous; } + void set_previous(AssemblerFixup* previous_in) { previous_ = previous_in; } int position() const { return position_; } - void set_position(int position) { position_ = position; } + void set_position(int position_in) { position_ = position_in; } friend class AssemblerBuffer; }; diff --git a/compiler/utils/x86/assembler_x86.h b/compiler/utils/x86/assembler_x86.h index b5bf31bbd6..de4e6de878 100644 --- a/compiler/utils/x86/assembler_x86.h +++ b/compiler/utils/x86/assembler_x86.h @@ -31,7 +31,7 @@ namespace x86 { class Immediate : public ValueObject { public: - explicit Immediate(int32_t value) : value_(value) {} + explicit Immediate(int32_t value_in) : value_(value_in) {} int32_t value() const { return value_; } @@ -90,16 +90,16 @@ class Operand : public ValueObject { // Operand can be sub classed (e.g: Address). Operand() : length_(0) { } - void SetModRM(int mod, Register rm) { - CHECK_EQ(mod & ~3, 0); - encoding_[0] = (mod << 6) | rm; + void SetModRM(int mod_in, Register rm_in) { + CHECK_EQ(mod_in & ~3, 0); + encoding_[0] = (mod_in << 6) | rm_in; length_ = 1; } - void SetSIB(ScaleFactor scale, Register index, Register base) { + void SetSIB(ScaleFactor scale_in, Register index_in, Register base_in) { CHECK_EQ(length_, 1); - CHECK_EQ(scale & ~3, 0); - encoding_[1] = (scale << 6) | (index << 3) | base; + CHECK_EQ(scale_in & ~3, 0); + encoding_[1] = (scale_in << 6) | (index_in << 3) | base_in; length_ = 2; } @@ -122,10 +122,10 @@ class Operand : public ValueObject { explicit Operand(Register reg) { SetModRM(3, reg); } // Get the operand encoding byte at the given index. - uint8_t encoding_at(int index) const { - CHECK_GE(index, 0); - CHECK_LT(index, length_); - return encoding_[index]; + uint8_t encoding_at(int index_in) const { + CHECK_GE(index_in, 0); + CHECK_LT(index_in, length_); + return encoding_[index_in]; } friend class X86Assembler; @@ -134,57 +134,57 @@ class Operand : public ValueObject { class Address : public Operand { public: - Address(Register base, int32_t disp) { - Init(base, disp); + Address(Register base_in, int32_t disp) { + Init(base_in, disp); } - Address(Register base, Offset disp) { - Init(base, disp.Int32Value()); + Address(Register base_in, Offset disp) { + Init(base_in, disp.Int32Value()); } - Address(Register base, FrameOffset disp) { - CHECK_EQ(base, ESP); + Address(Register base_in, FrameOffset disp) { + CHECK_EQ(base_in, ESP); Init(ESP, disp.Int32Value()); } - Address(Register base, MemberOffset disp) { - Init(base, disp.Int32Value()); + Address(Register base_in, MemberOffset disp) { + Init(base_in, disp.Int32Value()); } - void Init(Register base, int32_t disp) { - if (disp == 0 && base != EBP) { - SetModRM(0, base); - if (base == ESP) SetSIB(TIMES_1, ESP, base); + void Init(Register base_in, int32_t disp) { + if (disp == 0 && base_in != EBP) { + SetModRM(0, base_in); + if (base_in == ESP) SetSIB(TIMES_1, ESP, base_in); } else if (disp >= -128 && disp <= 127) { - SetModRM(1, base); - if (base == ESP) SetSIB(TIMES_1, ESP, base); + SetModRM(1, base_in); + if (base_in == ESP) SetSIB(TIMES_1, ESP, base_in); SetDisp8(disp); } else { - SetModRM(2, base); - if (base == ESP) SetSIB(TIMES_1, ESP, base); + SetModRM(2, base_in); + if (base_in == ESP) SetSIB(TIMES_1, ESP, base_in); SetDisp32(disp); } } - Address(Register index, ScaleFactor scale, int32_t disp) { - CHECK_NE(index, ESP); // Illegal addressing mode. + Address(Register index_in, ScaleFactor scale_in, int32_t disp) { + CHECK_NE(index_in, ESP); // Illegal addressing mode. SetModRM(0, ESP); - SetSIB(scale, index, EBP); + SetSIB(scale_in, index_in, EBP); SetDisp32(disp); } - Address(Register base, Register index, ScaleFactor scale, int32_t disp) { - CHECK_NE(index, ESP); // Illegal addressing mode. - if (disp == 0 && base != EBP) { + Address(Register base_in, Register index_in, ScaleFactor scale_in, int32_t disp) { + CHECK_NE(index_in, ESP); // Illegal addressing mode. + if (disp == 0 && base_in != EBP) { SetModRM(0, ESP); - SetSIB(scale, index, base); + SetSIB(scale_in, index_in, base_in); } else if (disp >= -128 && disp <= 127) { SetModRM(1, ESP); - SetSIB(scale, index, base); + SetSIB(scale_in, index_in, base_in); SetDisp8(disp); } else { SetModRM(2, ESP); - SetSIB(scale, index, base); + SetSIB(scale_in, index_in, base_in); SetDisp32(disp); } } diff --git a/compiler/utils/x86_64/assembler_x86_64.h b/compiler/utils/x86_64/assembler_x86_64.h index 2de3ce53f6..5b16f0891c 100644 --- a/compiler/utils/x86_64/assembler_x86_64.h +++ b/compiler/utils/x86_64/assembler_x86_64.h @@ -38,7 +38,7 @@ namespace x86_64 { // conversion rules in expressions regarding negation, especially size_t on 32b. class Immediate : public ValueObject { public: - explicit Immediate(int64_t value) : value_(value) {} + explicit Immediate(int64_t value_in) : value_(value_in) {} int64_t value() const { return value_; } @@ -105,26 +105,26 @@ class Operand : public ValueObject { // Operand can be sub classed (e.g: Address). Operand() : rex_(0), length_(0) { } - void SetModRM(uint8_t mod, CpuRegister rm) { - CHECK_EQ(mod & ~3, 0); - if (rm.NeedsRex()) { + void SetModRM(uint8_t mod_in, CpuRegister rm_in) { + CHECK_EQ(mod_in & ~3, 0); + if (rm_in.NeedsRex()) { rex_ |= 0x41; // REX.000B } - encoding_[0] = (mod << 6) | rm.LowBits(); + encoding_[0] = (mod_in << 6) | rm_in.LowBits(); length_ = 1; } - void SetSIB(ScaleFactor scale, CpuRegister index, CpuRegister base) { + void SetSIB(ScaleFactor scale_in, CpuRegister index_in, CpuRegister base_in) { CHECK_EQ(length_, 1); - CHECK_EQ(scale & ~3, 0); - if (base.NeedsRex()) { + CHECK_EQ(scale_in & ~3, 0); + if (base_in.NeedsRex()) { rex_ |= 0x41; // REX.000B } - if (index.NeedsRex()) { + if (index_in.NeedsRex()) { rex_ |= 0x42; // REX.00X0 } - encoding_[1] = (scale << 6) | (static_cast<uint8_t>(index.LowBits()) << 3) | - static_cast<uint8_t>(base.LowBits()); + encoding_[1] = (scale_in << 6) | (static_cast<uint8_t>(index_in.LowBits()) << 3) | + static_cast<uint8_t>(base_in.LowBits()); length_ = 2; } @@ -148,10 +148,10 @@ class Operand : public ValueObject { explicit Operand(CpuRegister reg) : rex_(0), length_(0) { SetModRM(3, reg); } // Get the operand encoding byte at the given index. - uint8_t encoding_at(int index) const { - CHECK_GE(index, 0); - CHECK_LT(index, length_); - return encoding_[index]; + uint8_t encoding_at(int index_in) const { + CHECK_GE(index_in, 0); + CHECK_LT(index_in, length_); + return encoding_[index_in]; } friend class X86_64Assembler; @@ -160,64 +160,64 @@ class Operand : public ValueObject { class Address : public Operand { public: - Address(CpuRegister base, int32_t disp) { - Init(base, disp); + Address(CpuRegister base_in, int32_t disp) { + Init(base_in, disp); } - Address(CpuRegister base, Offset disp) { - Init(base, disp.Int32Value()); + Address(CpuRegister base_in, Offset disp) { + Init(base_in, disp.Int32Value()); } - Address(CpuRegister base, FrameOffset disp) { - CHECK_EQ(base.AsRegister(), RSP); + Address(CpuRegister base_in, FrameOffset disp) { + CHECK_EQ(base_in.AsRegister(), RSP); Init(CpuRegister(RSP), disp.Int32Value()); } - Address(CpuRegister base, MemberOffset disp) { - Init(base, disp.Int32Value()); + Address(CpuRegister base_in, MemberOffset disp) { + Init(base_in, disp.Int32Value()); } - void Init(CpuRegister base, int32_t disp) { - if (disp == 0 && base.AsRegister() != RBP) { - SetModRM(0, base); - if (base.AsRegister() == RSP) { - SetSIB(TIMES_1, CpuRegister(RSP), base); + void Init(CpuRegister base_in, int32_t disp) { + if (disp == 0 && base_in.AsRegister() != RBP) { + SetModRM(0, base_in); + if (base_in.AsRegister() == RSP) { + SetSIB(TIMES_1, CpuRegister(RSP), base_in); } } else if (disp >= -128 && disp <= 127) { - SetModRM(1, base); - if (base.AsRegister() == RSP) { - SetSIB(TIMES_1, CpuRegister(RSP), base); + SetModRM(1, base_in); + if (base_in.AsRegister() == RSP) { + SetSIB(TIMES_1, CpuRegister(RSP), base_in); } SetDisp8(disp); } else { - SetModRM(2, base); - if (base.AsRegister() == RSP) { - SetSIB(TIMES_1, CpuRegister(RSP), base); + SetModRM(2, base_in); + if (base_in.AsRegister() == RSP) { + SetSIB(TIMES_1, CpuRegister(RSP), base_in); } SetDisp32(disp); } } - Address(CpuRegister index, ScaleFactor scale, int32_t disp) { - CHECK_NE(index.AsRegister(), RSP); // Illegal addressing mode. + Address(CpuRegister index_in, ScaleFactor scale_in, int32_t disp) { + CHECK_NE(index_in.AsRegister(), RSP); // Illegal addressing mode. SetModRM(0, CpuRegister(RSP)); - SetSIB(scale, index, CpuRegister(RBP)); + SetSIB(scale_in, index_in, CpuRegister(RBP)); SetDisp32(disp); } - Address(CpuRegister base, CpuRegister index, ScaleFactor scale, int32_t disp) { - CHECK_NE(index.AsRegister(), RSP); // Illegal addressing mode. - if (disp == 0 && base.AsRegister() != RBP) { + Address(CpuRegister base_in, CpuRegister index_in, ScaleFactor scale_in, int32_t disp) { + CHECK_NE(index_in.AsRegister(), RSP); // Illegal addressing mode. + if (disp == 0 && base_in.AsRegister() != RBP) { SetModRM(0, CpuRegister(RSP)); - SetSIB(scale, index, base); + SetSIB(scale_in, index_in, base_in); } else if (disp >= -128 && disp <= 127) { SetModRM(1, CpuRegister(RSP)); - SetSIB(scale, index, base); + SetSIB(scale_in, index_in, base_in); SetDisp8(disp); } else { SetModRM(2, CpuRegister(RSP)); - SetSIB(scale, index, base); + SetSIB(scale_in, index_in, base_in); SetDisp32(disp); } } |