From 1d2d4ff8570bb88d9d2d4633706fd7f6fb18d75e Mon Sep 17 00:00:00 2001 From: Mathieu Chartier Date: Sat, 23 Sep 2017 16:11:06 -0700 Subject: Add DexInstructionIterator and use it a few places Motivation: Want to start abstracting away dex specific functionality to enable CompactDex. Adding an iterator will enable CompactDex iteration to work differently than normal dex iteration. Will eventually replace CodeItemIterator. Bug: 63756964 Test: test-art-host Change-Id: I90e67c1a994b7698aaac0523a82816b0a003fbdc --- compiler/optimizing/instruction_builder.cc | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'compiler/optimizing/instruction_builder.cc') diff --git a/compiler/optimizing/instruction_builder.cc b/compiler/optimizing/instruction_builder.cc index e832b10b79..6ad8036870 100644 --- a/compiler/optimizing/instruction_builder.cc +++ b/compiler/optimizing/instruction_builder.cc @@ -368,17 +368,16 @@ void HInstructionBuilder::FindNativeDebugInfoLocations(ArenaBitVector* locations }; dex_file_->DecodeDebugPositionInfo(&code_item_, Callback::Position, locations); // Instruction-specific tweaks. - const Instruction* const begin = Instruction::At(code_item_.insns_); - const Instruction* const end = begin->RelativeAt(code_item_.insns_size_in_code_units_); - for (const Instruction* inst = begin; inst < end; inst = inst->Next()) { - switch (inst->Opcode()) { + IterationRange instructions = code_item_.Instructions(); + for (const Instruction& inst : instructions) { + switch (inst.Opcode()) { case Instruction::MOVE_EXCEPTION: { // Stop in native debugger after the exception has been moved. // The compiler also expects the move at the start of basic block so // we do not want to interfere by inserting native-debug-info before it. - locations->ClearBit(inst->GetDexPc(code_item_.insns_)); - const Instruction* next = inst->Next(); - if (next < end) { + locations->ClearBit(inst.GetDexPc(code_item_.insns_)); + const Instruction* next = inst.Next(); + if (DexInstructionIterator(next) != instructions.end()) { locations->SetBit(next->GetDexPc(code_item_.insns_)); } break; -- cgit v1.2.3-59-g8ed1b