summaryrefslogtreecommitdiff
path: root/compiler/optimizing/builder.cc
diff options
context:
space:
mode:
author David Brazdil <dbrazdil@google.com> 2016-01-06 10:34:16 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2016-01-06 10:34:16 +0000
commit87bafaf563d35616804dd0cc0dbde176aac87817 (patch)
tree1317545f50f78eb7c9e4dd44ebfb256bdff0af11 /compiler/optimizing/builder.cc
parentc917d195d8d8d05f90796b1e0842883fc608346d (diff)
parentf555258861aea7df8af9c2241ab761227fd2f66a (diff)
Merge "ART: Create BoundType for CheckCast early"
Diffstat (limited to 'compiler/optimizing/builder.cc')
-rw-r--r--compiler/optimizing/builder.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/optimizing/builder.cc b/compiler/optimizing/builder.cc
index 4dd0d26b89..1af684683b 100644
--- a/compiler/optimizing/builder.cc
+++ b/compiler/optimizing/builder.cc
@@ -1817,7 +1817,12 @@ void HGraphBuilder::BuildTypeCheck(const Instruction& instruction,
UpdateLocal(destination, current_block_->GetLastInstruction(), dex_pc);
} else {
DCHECK_EQ(instruction.Opcode(), Instruction::CHECK_CAST);
+ // We emit a CheckCast followed by a BoundType. CheckCast is a statement
+ // which may throw. If it succeeds BoundType sets the new type of `object`
+ // for all subsequent uses.
current_block_->AddInstruction(new (arena_) HCheckCast(object, cls, check_kind, dex_pc));
+ current_block_->AddInstruction(new (arena_) HBoundType(object, dex_pc));
+ UpdateLocal(reference, current_block_->GetLastInstruction(), dex_pc);
}
}