summaryrefslogtreecommitdiff
path: root/compiler/optimizing/instruction_builder.cc
diff options
context:
space:
mode:
author Treehugger Robot <treehugger-gerrit@google.com> 2016-09-06 19:24:44 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2016-09-06 19:24:44 +0000
commit888c2f9361fb4b322513cb592fb12e480799ae9c (patch)
tree61dc29fa4dafd1f23be4d0ed01068e057e4b9d36 /compiler/optimizing/instruction_builder.cc
parent22d7ae26348fc66a96fb6eb83bf1b963b33f9e49 (diff)
parentc69fba293481af4a0963ec656c3aa9b959d44e01 (diff)
Merge "Optimizing: Fix handling empty fill-array-data."
Diffstat (limited to 'compiler/optimizing/instruction_builder.cc')
-rw-r--r--compiler/optimizing/instruction_builder.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/compiler/optimizing/instruction_builder.cc b/compiler/optimizing/instruction_builder.cc
index 453068b560..32dcc2814b 100644
--- a/compiler/optimizing/instruction_builder.cc
+++ b/compiler/optimizing/instruction_builder.cc
@@ -1545,8 +1545,6 @@ void HInstructionBuilder::BuildFillArrayData(HInstruction* object,
void HInstructionBuilder::BuildFillArrayData(const Instruction& instruction, uint32_t dex_pc) {
HInstruction* array = LoadNullCheckedLocal(instruction.VRegA_31t(), dex_pc);
- HInstruction* length = new (arena_) HArrayLength(array, dex_pc);
- AppendInstruction(length);
int32_t payload_offset = instruction.VRegB_31t() + dex_pc;
const Instruction::ArrayDataPayload* payload =
@@ -1554,6 +1552,14 @@ void HInstructionBuilder::BuildFillArrayData(const Instruction& instruction, uin
const uint8_t* data = payload->data;
uint32_t element_count = payload->element_count;
+ if (element_count == 0u) {
+ // For empty payload we emit only the null check above.
+ return;
+ }
+
+ HInstruction* length = new (arena_) HArrayLength(array, dex_pc);
+ AppendInstruction(length);
+
// Implementation of this DEX instruction seems to be that the bounds check is
// done before doing any stores.
HInstruction* last_index = graph_->GetIntConstant(payload->element_count - 1, dex_pc);