summaryrefslogtreecommitdiff
path: root/compiler/optimizing/instruction_builder.cc
diff options
context:
space:
mode:
authorMathieu Chartier <mathieuc@google.com>2017-09-23 16:11:06 -0700
committerMathieu Chartier <mathieuc@google.com>2017-09-27 11:51:53 -0700
commit1d2d4ff8570bb88d9d2d4633706fd7f6fb18d75e (patch)
treecbe67e8e9214828656314117121e8ce906a762ab /compiler/optimizing/instruction_builder.cc
parente5b35ed787fbfb388d162361310bae5b0e7682a7 (diff)
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
Diffstat (limited to 'compiler/optimizing/instruction_builder.cc')
-rw-r--r--compiler/optimizing/instruction_builder.cc13
1 files changed, 6 insertions, 7 deletions
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<DexInstructionIterator> 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;