diff options
author | 2015-12-27 13:36:12 +0000 | |
---|---|---|
committer | 2016-01-06 10:33:30 +0000 | |
commit | f555258861aea7df8af9c2241ab761227fd2f66a (patch) | |
tree | 1317545f50f78eb7c9e4dd44ebfb256bdff0af11 /compiler/optimizing/builder.cc | |
parent | c917d195d8d8d05f90796b1e0842883fc608346d (diff) |
ART: Create BoundType for CheckCast early
ReferenceTypePropagation creates a BoundType for each CheckCast and
replaces all dominated uses of the casted object with it. This does
not include Phi uses on the boundary of the dominated scope, reducing
typing precision. This patch creates the BoundType in Builder, causing
SsaBuilder to replace uses of the object automatically.
Bug: 26081304
Change-Id: I083979155cccb348071ff58cb9060a896ed7d2ac
Diffstat (limited to 'compiler/optimizing/builder.cc')
-rw-r--r-- | compiler/optimizing/builder.cc | 5 |
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); } } |