From c69fba293481af4a0963ec656c3aa9b959d44e01 Mon Sep 17 00:00:00 2001 From: Vladimir Marko Date: Tue, 6 Sep 2016 16:49:15 +0100 Subject: Optimizing: Fix handling empty fill-array-data. Test: m test-art-host-run-test-412-new-array Bug: 31300081 Change-Id: Id0512fc95a96c37de2ceab481666688435fa30f6 --- compiler/optimizing/instruction_builder.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'compiler/optimizing/instruction_builder.cc') 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); -- cgit v1.2.3-59-g8ed1b