diff options
author | Vladimir Marko <vmarko@google.com> | 2014-01-27 19:08:16 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2014-01-27 19:08:17 +0000 |
commit | 6e65720d99bd3387b72d528a46291f1ed8184ede (patch) | |
tree | ce1397f0f02213112ba8841ccad52d74ac29d318 /compiler | |
parent | b429d1dc99b39eadd11f228e520e08b34ba3caf9 (diff) | |
parent | 4376c87eb45b287fad77a16738e76ba28956ab7d (diff) | |
download | android_art-6e65720d99bd3387b72d528a46291f1ed8184ede.tar.gz android_art-6e65720d99bd3387b72d528a46291f1ed8184ede.tar.bz2 android_art-6e65720d99bd3387b72d528a46291f1ed8184ede.zip |
Merge "Remove the link from dalvik instruction back to kMirOpCheck."
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/dex/local_value_numbering.cc | 12 | ||||
-rw-r--r-- | compiler/dex/mir_graph.cc | 26 | ||||
-rw-r--r-- | compiler/dex/mir_graph.h | 2 | ||||
-rw-r--r-- | compiler/dex/quick/mir_to_lir.cc | 2 |
4 files changed, 19 insertions, 23 deletions
diff --git a/compiler/dex/local_value_numbering.cc b/compiler/dex/local_value_numbering.cc index 75883b7bd6..9e83210012 100644 --- a/compiler/dex/local_value_numbering.cc +++ b/compiler/dex/local_value_numbering.cc @@ -380,9 +380,6 @@ uint16_t LocalValueNumbering::GetValueNumber(MIR* mir) { } mir->optimization_flags |= MIR_IGNORE_RANGE_CHECK; } - if (mir->meta.throw_insn != NULL) { - mir->meta.throw_insn->optimization_flags |= mir->optimization_flags; - } // Use side effect to note range check completed. (void)LookupValue(ARRAY_REF, array, index, NO_VALUE); // Establish value number for loaded register. Note use of memory version. @@ -421,9 +418,6 @@ uint16_t LocalValueNumbering::GetValueNumber(MIR* mir) { } mir->optimization_flags |= MIR_IGNORE_RANGE_CHECK; } - if (mir->meta.throw_insn != NULL) { - mir->meta.throw_insn->optimization_flags |= mir->optimization_flags; - } // Use side effect to note range check completed. (void)LookupValue(ARRAY_REF, array, index, NO_VALUE); // Rev the memory version @@ -447,9 +441,6 @@ uint16_t LocalValueNumbering::GetValueNumber(MIR* mir) { } else { null_checked_.insert(base); } - if (mir->meta.throw_insn != NULL) { - mir->meta.throw_insn->optimization_flags |= mir->optimization_flags; - } uint16_t field_ref = mir->dalvikInsn.vC; uint16_t memory_version = GetMemoryVersion(base, field_ref); if (opcode == Instruction::IGET_WIDE) { @@ -479,9 +470,6 @@ uint16_t LocalValueNumbering::GetValueNumber(MIR* mir) { } else { null_checked_.insert(base); } - if (mir->meta.throw_insn != NULL) { - mir->meta.throw_insn->optimization_flags |= mir->optimization_flags; - } uint16_t field_ref = mir->dalvikInsn.vC; AdvanceMemoryVersion(base, field_ref); } diff --git a/compiler/dex/mir_graph.cc b/compiler/dex/mir_graph.cc index f321cdaf4d..8c90edb1f4 100644 --- a/compiler/dex/mir_graph.cc +++ b/compiler/dex/mir_graph.cc @@ -126,9 +126,6 @@ BasicBlock* MIRGraph::SplitBlock(DexOffset code_offset, bottom_block->terminated_by_return = orig_block->terminated_by_return; orig_block->terminated_by_return = false; - /* Add it to the quick lookup cache */ - dex_pc_to_block_map_.Put(bottom_block->start_offset, bottom_block->id); - /* Handle the taken path */ bottom_block->taken = orig_block->taken; if (bottom_block->taken != NullBasicBlockId) { @@ -177,19 +174,29 @@ BasicBlock* MIRGraph::SplitBlock(DexOffset code_offset, } // Associate dex instructions in the bottom block with the new container. - MIR* p = bottom_block->first_mir_insn; - while (p != NULL) { + DCHECK(insn != nullptr); + DCHECK(insn != orig_block->first_mir_insn); + DCHECK(insn == bottom_block->first_mir_insn); + DCHECK_EQ(insn->offset, bottom_block->start_offset); + DCHECK(static_cast<int>(insn->dalvikInsn.opcode) == kMirOpCheck || + !IsPseudoMirOp(insn->dalvikInsn.opcode)); + DCHECK_EQ(dex_pc_to_block_map_.Get(insn->offset), orig_block->id); + MIR* p = insn; + dex_pc_to_block_map_.Put(p->offset, bottom_block->id); + while (p != bottom_block->last_mir_insn) { + p = p->next; + DCHECK(p != nullptr); int opcode = p->dalvikInsn.opcode; /* * Some messiness here to ensure that we only enter real opcodes and only the * first half of a potentially throwing instruction that has been split into - * CHECK and work portions. The 2nd half of a split operation will have a non-null - * throw_insn pointer that refers to the 1st half. + * CHECK and work portions. Since the 2nd half of a split operation is always + * the first in a BasicBlock, we can't hit it here. */ - if ((opcode == kMirOpCheck) || (!IsPseudoMirOp(opcode) && (p->meta.throw_insn == NULL))) { + if ((opcode == kMirOpCheck) || !IsPseudoMirOp(opcode)) { + DCHECK_EQ(dex_pc_to_block_map_.Get(p->offset), orig_block->id); dex_pc_to_block_map_.Put(p->offset, bottom_block->id); } - p = (p == bottom_block->last_mir_insn) ? NULL : p->next; } return bottom_block; @@ -508,7 +515,6 @@ BasicBlock* MIRGraph::ProcessCanThrow(BasicBlock* cur_block, MIR* insn, DexOffse static_cast<Instruction::Code>(kMirOpCheck); // Associate the two halves insn->meta.throw_insn = new_insn; - new_insn->meta.throw_insn = insn; AppendMIR(new_block, new_insn); return new_block; } diff --git a/compiler/dex/mir_graph.h b/compiler/dex/mir_graph.h index bbcea10230..4666d1e47a 100644 --- a/compiler/dex/mir_graph.h +++ b/compiler/dex/mir_graph.h @@ -253,7 +253,7 @@ struct MIR { union { // Incoming edges for phi node. BasicBlockId* phi_incoming; - // Establish link between two halves of throwing instructions. + // Establish link from check instruction (kMirOpCheck) to the actual throwing instruction. MIR* throw_insn; // Fused cmp branch condition. ConditionCode ccode; diff --git a/compiler/dex/quick/mir_to_lir.cc b/compiler/dex/quick/mir_to_lir.cc index 6281eff873..0a470a5b31 100644 --- a/compiler/dex/quick/mir_to_lir.cc +++ b/compiler/dex/quick/mir_to_lir.cc @@ -762,11 +762,13 @@ bool Mir2Lir::MethodBlockCodeGen(BasicBlock* bb) { // Combine check and work halves of throwing instruction. MIR* work_half = mir->meta.throw_insn; mir->dalvikInsn.opcode = work_half->dalvikInsn.opcode; + mir->meta = work_half->meta; // Whatever the work_half had, we need to copy it. opcode = work_half->dalvikInsn.opcode; SSARepresentation* ssa_rep = work_half->ssa_rep; work_half->ssa_rep = mir->ssa_rep; mir->ssa_rep = ssa_rep; work_half->dalvikInsn.opcode = static_cast<Instruction::Code>(kMirOpCheckPart2); + work_half->meta.throw_insn = mir; } if (opcode >= kMirOpFirst) { |