From 154746b84b407cfd166b45e039b62e6a06dc3f39 Mon Sep 17 00:00:00 2001 From: Calin Juravle Date: Tue, 6 Oct 2015 15:46:54 +0100 Subject: [PATCH] Remove dex_pc's default value from top level HInstruction This clearly hints that the dex_pc is stored in the super class and doesn't need to be reimplemented in subclasses. Change-Id: Ifd4aa95190c4c89367b4dd2cc8ab0ffd263659ac --- compiler/optimizing/bounds_check_elimination.cc | 3 +- .../optimizing/bounds_check_elimination_test.cc | 56 +++++++++++----------- compiler/optimizing/gvn_test.cc | 51 +++++++++++++------- compiler/optimizing/licm_test.cc | 12 ++--- compiler/optimizing/nodes.h | 20 ++++---- compiler/optimizing/nodes_x86.h | 5 +- compiler/optimizing/register_allocator_test.cc | 12 +++-- 7 files changed, 91 insertions(+), 68 deletions(-) diff --git a/compiler/optimizing/bounds_check_elimination.cc b/compiler/optimizing/bounds_check_elimination.cc index 960f4d9b7..2c7c12747 100644 --- a/compiler/optimizing/bounds_check_elimination.cc +++ b/compiler/optimizing/bounds_check_elimination.cc @@ -965,7 +965,8 @@ class MonotonicValueRange : public ValueRange { suspend_check->GetEnvironment(), header); } - HArrayLength* new_array_length = new (graph->GetArena()) HArrayLength(array); + HArrayLength* new_array_length + = new (graph->GetArena()) HArrayLength(array, array->GetDexPc()); deopt_block->InsertInstructionBefore(new_array_length, deopt_block->GetLastInstruction()); if (loop_entry_test_block_added) { diff --git a/compiler/optimizing/bounds_check_elimination_test.cc b/compiler/optimizing/bounds_check_elimination_test.cc index 08e1e3682..ce6dc7574 100644 --- a/compiler/optimizing/bounds_check_elimination_test.cc +++ b/compiler/optimizing/bounds_check_elimination_test.cc @@ -91,7 +91,7 @@ TEST_F(BoundsCheckEliminationTest, NarrowingRangeArrayBoundsElimination) { HBasicBlock* block2 = new (&allocator_) HBasicBlock(graph_); graph_->AddBlock(block2); HNullCheck* null_check = new (&allocator_) HNullCheck(parameter1, 0); - HArrayLength* array_length = new (&allocator_) HArrayLength(null_check); + HArrayLength* array_length = new (&allocator_) HArrayLength(null_check, 0); HBoundsCheck* bounds_check2 = new (&allocator_) HBoundsCheck(parameter2, array_length, 0); HArraySet* array_set = new (&allocator_) HArraySet( @@ -104,7 +104,7 @@ TEST_F(BoundsCheckEliminationTest, NarrowingRangeArrayBoundsElimination) { HBasicBlock* block3 = new (&allocator_) HBasicBlock(graph_); graph_->AddBlock(block3); null_check = new (&allocator_) HNullCheck(parameter1, 0); - array_length = new (&allocator_) HArrayLength(null_check); + array_length = new (&allocator_) HArrayLength(null_check, 0); cmp = new (&allocator_) HLessThan(parameter2, array_length); if_inst = new (&allocator_) HIf(cmp); block3->AddInstruction(null_check); @@ -115,7 +115,7 @@ TEST_F(BoundsCheckEliminationTest, NarrowingRangeArrayBoundsElimination) { HBasicBlock* block4 = new (&allocator_) HBasicBlock(graph_); graph_->AddBlock(block4); null_check = new (&allocator_) HNullCheck(parameter1, 0); - array_length = new (&allocator_) HArrayLength(null_check); + array_length = new (&allocator_) HArrayLength(null_check, 0); HBoundsCheck* bounds_check4 = new (&allocator_) HBoundsCheck(parameter2, array_length, 0); array_set = new (&allocator_) HArraySet( @@ -128,7 +128,7 @@ TEST_F(BoundsCheckEliminationTest, NarrowingRangeArrayBoundsElimination) { HBasicBlock* block5 = new (&allocator_) HBasicBlock(graph_); graph_->AddBlock(block5); null_check = new (&allocator_) HNullCheck(parameter1, 0); - array_length = new (&allocator_) HArrayLength(null_check); + array_length = new (&allocator_) HArrayLength(null_check, 0); HBoundsCheck* bounds_check5 = new (&allocator_) HBoundsCheck(parameter2, array_length, 0); array_set = new (&allocator_) HArraySet( @@ -190,7 +190,7 @@ TEST_F(BoundsCheckEliminationTest, OverflowArrayBoundsElimination) { graph_->AddBlock(block2); HInstruction* add = new (&allocator_) HAdd(Primitive::kPrimInt, parameter2, constant_max_int); HNullCheck* null_check = new (&allocator_) HNullCheck(parameter1, 0); - HArrayLength* array_length = new (&allocator_) HArrayLength(null_check); + HArrayLength* array_length = new (&allocator_) HArrayLength(null_check, 0); HInstruction* cmp2 = new (&allocator_) HGreaterThanOrEqual(add, array_length); if_inst = new (&allocator_) HIf(cmp2); block2->AddInstruction(add); @@ -245,7 +245,7 @@ TEST_F(BoundsCheckEliminationTest, UnderflowArrayBoundsElimination) { HBasicBlock* block1 = new (&allocator_) HBasicBlock(graph_); graph_->AddBlock(block1); HNullCheck* null_check = new (&allocator_) HNullCheck(parameter1, 0); - HArrayLength* array_length = new (&allocator_) HArrayLength(null_check); + HArrayLength* array_length = new (&allocator_) HArrayLength(null_check, 0); HInstruction* cmp = new (&allocator_) HGreaterThanOrEqual(parameter2, array_length); HIf* if_inst = new (&allocator_) HIf(cmp); block1->AddInstruction(null_check); @@ -308,7 +308,7 @@ TEST_F(BoundsCheckEliminationTest, ConstantArrayBoundsElimination) { entry->AddSuccessor(block); HNullCheck* null_check = new (&allocator_) HNullCheck(parameter, 0); - HArrayLength* array_length = new (&allocator_) HArrayLength(null_check); + HArrayLength* array_length = new (&allocator_) HArrayLength(null_check, 0); HBoundsCheck* bounds_check6 = new (&allocator_) HBoundsCheck(constant_6, array_length, 0); HInstruction* array_set = new (&allocator_) HArraySet( @@ -319,7 +319,7 @@ TEST_F(BoundsCheckEliminationTest, ConstantArrayBoundsElimination) { block->AddInstruction(array_set); null_check = new (&allocator_) HNullCheck(parameter, 0); - array_length = new (&allocator_) HArrayLength(null_check); + array_length = new (&allocator_) HArrayLength(null_check, 0); HBoundsCheck* bounds_check5 = new (&allocator_) HBoundsCheck(constant_5, array_length, 0); array_set = new (&allocator_) HArraySet( @@ -330,7 +330,7 @@ TEST_F(BoundsCheckEliminationTest, ConstantArrayBoundsElimination) { block->AddInstruction(array_set); null_check = new (&allocator_) HNullCheck(parameter, 0); - array_length = new (&allocator_) HArrayLength(null_check); + array_length = new (&allocator_) HArrayLength(null_check, 0); HBoundsCheck* bounds_check4 = new (&allocator_) HBoundsCheck(constant_4, array_length, 0); array_set = new (&allocator_) HArraySet( @@ -389,7 +389,7 @@ static HInstruction* BuildSSAGraph1(HGraph* graph, HPhi* phi = new (allocator) HPhi(allocator, 0, 0, Primitive::kPrimInt); HInstruction* null_check = new (allocator) HNullCheck(parameter, 0); - HInstruction* array_length = new (allocator) HArrayLength(null_check); + HInstruction* array_length = new (allocator) HArrayLength(null_check, 0); HInstruction* cmp = nullptr; if (cond == kCondGE) { cmp = new (allocator) HGreaterThanOrEqual(phi, array_length); @@ -406,7 +406,7 @@ static HInstruction* BuildSSAGraph1(HGraph* graph, phi->AddInput(constant_initial); null_check = new (allocator) HNullCheck(parameter, 0); - array_length = new (allocator) HArrayLength(null_check); + array_length = new (allocator) HArrayLength(null_check, 0); HInstruction* bounds_check = new (allocator) HBoundsCheck(phi, array_length, 0); HInstruction* array_set = new (allocator) HArraySet( null_check, bounds_check, constant_10, Primitive::kPrimInt, 0); @@ -489,7 +489,7 @@ static HInstruction* BuildSSAGraph2(HGraph *graph, graph->AddBlock(block); entry->AddSuccessor(block); HInstruction* null_check = new (allocator) HNullCheck(parameter, 0); - HInstruction* array_length = new (allocator) HArrayLength(null_check); + HInstruction* array_length = new (allocator) HArrayLength(null_check, 0); block->AddInstruction(null_check); block->AddInstruction(array_length); block->AddInstruction(new (allocator) HGoto()); @@ -522,7 +522,7 @@ static HInstruction* BuildSSAGraph2(HGraph *graph, HInstruction* add = new (allocator) HAdd(Primitive::kPrimInt, phi, constant_minus_1); null_check = new (allocator) HNullCheck(parameter, 0); - array_length = new (allocator) HArrayLength(null_check); + array_length = new (allocator) HArrayLength(null_check, 0); HInstruction* bounds_check = new (allocator) HBoundsCheck(add, array_length, 0); HInstruction* array_set = new (allocator) HArraySet( null_check, bounds_check, constant_10, Primitive::kPrimInt, 0); @@ -631,7 +631,7 @@ static HInstruction* BuildSSAGraph3(HGraph* graph, phi->AddInput(constant_initial); HNullCheck* null_check = new (allocator) HNullCheck(new_array, 0); - HArrayLength* array_length = new (allocator) HArrayLength(null_check); + HArrayLength* array_length = new (allocator) HArrayLength(null_check, 0); HInstruction* bounds_check = new (allocator) HBoundsCheck(phi, array_length, 0); HInstruction* array_set = new (allocator) HArraySet( null_check, bounds_check, constant_10, Primitive::kPrimInt, 0); @@ -716,7 +716,7 @@ static HInstruction* BuildSSAGraph4(HGraph* graph, HPhi* phi = new (allocator) HPhi(allocator, 0, 0, Primitive::kPrimInt); HInstruction* null_check = new (allocator) HNullCheck(parameter, 0); - HInstruction* array_length = new (allocator) HArrayLength(null_check); + HInstruction* array_length = new (allocator) HArrayLength(null_check, 0); HInstruction* cmp = nullptr; if (cond == kCondGE) { cmp = new (allocator) HGreaterThanOrEqual(phi, array_length); @@ -732,7 +732,7 @@ static HInstruction* BuildSSAGraph4(HGraph* graph, phi->AddInput(constant_initial); null_check = new (allocator) HNullCheck(parameter, 0); - array_length = new (allocator) HArrayLength(null_check); + array_length = new (allocator) HArrayLength(null_check, 0); HInstruction* sub = new (allocator) HSub(Primitive::kPrimInt, array_length, phi); HInstruction* add_minus_1 = new (allocator) HAdd(Primitive::kPrimInt, sub, constant_minus_1); @@ -811,7 +811,7 @@ TEST_F(BoundsCheckEliminationTest, BubbleSortArrayBoundsElimination) { graph_->AddBlock(outer_header); HPhi* phi_i = new (&allocator_) HPhi(&allocator_, 0, 0, Primitive::kPrimInt); HNullCheck* null_check = new (&allocator_) HNullCheck(parameter, 0); - HArrayLength* array_length = new (&allocator_) HArrayLength(null_check); + HArrayLength* array_length = new (&allocator_) HArrayLength(null_check, 0); HAdd* add = new (&allocator_) HAdd(Primitive::kPrimInt, array_length, constant_minus_1); HInstruction* cmp = new (&allocator_) HGreaterThanOrEqual(phi_i, add); HIf* if_inst = new (&allocator_) HIf(cmp); @@ -827,7 +827,7 @@ TEST_F(BoundsCheckEliminationTest, BubbleSortArrayBoundsElimination) { graph_->AddBlock(inner_header); HPhi* phi_j = new (&allocator_) HPhi(&allocator_, 0, 0, Primitive::kPrimInt); null_check = new (&allocator_) HNullCheck(parameter, 0); - array_length = new (&allocator_) HArrayLength(null_check); + array_length = new (&allocator_) HArrayLength(null_check, 0); HSub* sub = new (&allocator_) HSub(Primitive::kPrimInt, array_length, phi_i); add = new (&allocator_) HAdd(Primitive::kPrimInt, sub, constant_minus_1); cmp = new (&allocator_) HGreaterThanOrEqual(phi_j, add); @@ -844,20 +844,20 @@ TEST_F(BoundsCheckEliminationTest, BubbleSortArrayBoundsElimination) { HBasicBlock* inner_body_compare = new (&allocator_) HBasicBlock(graph_); graph_->AddBlock(inner_body_compare); null_check = new (&allocator_) HNullCheck(parameter, 0); - array_length = new (&allocator_) HArrayLength(null_check); + array_length = new (&allocator_) HArrayLength(null_check, 0); HBoundsCheck* bounds_check1 = new (&allocator_) HBoundsCheck(phi_j, array_length, 0); HArrayGet* array_get_j = new (&allocator_) - HArrayGet(null_check, bounds_check1, Primitive::kPrimInt); + HArrayGet(null_check, bounds_check1, Primitive::kPrimInt, 0); inner_body_compare->AddInstruction(null_check); inner_body_compare->AddInstruction(array_length); inner_body_compare->AddInstruction(bounds_check1); inner_body_compare->AddInstruction(array_get_j); HInstruction* j_plus_1 = new (&allocator_) HAdd(Primitive::kPrimInt, phi_j, constant_1); null_check = new (&allocator_) HNullCheck(parameter, 0); - array_length = new (&allocator_) HArrayLength(null_check); + array_length = new (&allocator_) HArrayLength(null_check, 0); HBoundsCheck* bounds_check2 = new (&allocator_) HBoundsCheck(j_plus_1, array_length, 0); HArrayGet* array_get_j_plus_1 = new (&allocator_) - HArrayGet(null_check, bounds_check2, Primitive::kPrimInt); + HArrayGet(null_check, bounds_check2, Primitive::kPrimInt, 0); cmp = new (&allocator_) HGreaterThanOrEqual(array_get_j, array_get_j_plus_1); if_inst = new (&allocator_) HIf(cmp); inner_body_compare->AddInstruction(j_plus_1); @@ -873,10 +873,10 @@ TEST_F(BoundsCheckEliminationTest, BubbleSortArrayBoundsElimination) { j_plus_1 = new (&allocator_) HAdd(Primitive::kPrimInt, phi_j, constant_1); // temp = array[j+1] null_check = new (&allocator_) HNullCheck(parameter, 0); - array_length = new (&allocator_) HArrayLength(null_check); + array_length = new (&allocator_) HArrayLength(null_check, 0); HInstruction* bounds_check3 = new (&allocator_) HBoundsCheck(j_plus_1, array_length, 0); array_get_j_plus_1 = new (&allocator_) - HArrayGet(null_check, bounds_check3, Primitive::kPrimInt); + HArrayGet(null_check, bounds_check3, Primitive::kPrimInt, 0); inner_body_swap->AddInstruction(j_plus_1); inner_body_swap->AddInstruction(null_check); inner_body_swap->AddInstruction(array_length); @@ -884,16 +884,16 @@ TEST_F(BoundsCheckEliminationTest, BubbleSortArrayBoundsElimination) { inner_body_swap->AddInstruction(array_get_j_plus_1); // array[j+1] = array[j] null_check = new (&allocator_) HNullCheck(parameter, 0); - array_length = new (&allocator_) HArrayLength(null_check); + array_length = new (&allocator_) HArrayLength(null_check, 0); HInstruction* bounds_check4 = new (&allocator_) HBoundsCheck(phi_j, array_length, 0); array_get_j = new (&allocator_) - HArrayGet(null_check, bounds_check4, Primitive::kPrimInt); + HArrayGet(null_check, bounds_check4, Primitive::kPrimInt, 0); inner_body_swap->AddInstruction(null_check); inner_body_swap->AddInstruction(array_length); inner_body_swap->AddInstruction(bounds_check4); inner_body_swap->AddInstruction(array_get_j); null_check = new (&allocator_) HNullCheck(parameter, 0); - array_length = new (&allocator_) HArrayLength(null_check); + array_length = new (&allocator_) HArrayLength(null_check, 0); HInstruction* bounds_check5 = new (&allocator_) HBoundsCheck(j_plus_1, array_length, 0); HArraySet* array_set_j_plus_1 = new (&allocator_) HArraySet(null_check, bounds_check5, array_get_j, Primitive::kPrimInt, 0); @@ -903,7 +903,7 @@ TEST_F(BoundsCheckEliminationTest, BubbleSortArrayBoundsElimination) { inner_body_swap->AddInstruction(array_set_j_plus_1); // array[j] = temp null_check = new (&allocator_) HNullCheck(parameter, 0); - array_length = new (&allocator_) HArrayLength(null_check); + array_length = new (&allocator_) HArrayLength(null_check, 0); HInstruction* bounds_check6 = new (&allocator_) HBoundsCheck(phi_j, array_length, 0); HArraySet* array_set_j = new (&allocator_) HArraySet(null_check, bounds_check6, array_get_j_plus_1, Primitive::kPrimInt, 0); diff --git a/compiler/optimizing/gvn_test.cc b/compiler/optimizing/gvn_test.cc index 32f45b566..56f271826 100644 --- a/compiler/optimizing/gvn_test.cc +++ b/compiler/optimizing/gvn_test.cc @@ -47,14 +47,16 @@ TEST(GVNTest, LocalFieldElimination) { false, kUnknownFieldIndex, graph->GetDexFile(), - dex_cache)); + dex_cache, + 0)); block->AddInstruction(new (&allocator) HInstanceFieldGet(parameter, Primitive::kPrimNot, MemberOffset(42), false, kUnknownFieldIndex, graph->GetDexFile(), - dex_cache)); + dex_cache, + 0)); HInstruction* to_remove = block->GetLastInstruction(); block->AddInstruction(new (&allocator) HInstanceFieldGet(parameter, Primitive::kPrimNot, @@ -62,7 +64,8 @@ TEST(GVNTest, LocalFieldElimination) { false, kUnknownFieldIndex, graph->GetDexFile(), - dex_cache)); + dex_cache, + 0)); HInstruction* different_offset = block->GetLastInstruction(); // Kill the value. block->AddInstruction(new (&allocator) HInstanceFieldSet(parameter, @@ -72,14 +75,16 @@ TEST(GVNTest, LocalFieldElimination) { false, kUnknownFieldIndex, graph->GetDexFile(), - dex_cache)); + dex_cache, + 0)); block->AddInstruction(new (&allocator) HInstanceFieldGet(parameter, Primitive::kPrimNot, MemberOffset(42), false, kUnknownFieldIndex, graph->GetDexFile(), - dex_cache)); + dex_cache, + 0)); HInstruction* use_after_kill = block->GetLastInstruction(); block->AddInstruction(new (&allocator) HExit()); @@ -118,7 +123,8 @@ TEST(GVNTest, GlobalFieldElimination) { false, kUnknownFieldIndex, graph->GetDexFile(), - dex_cache)); + dex_cache, + 0)); block->AddInstruction(new (&allocator) HIf(block->GetLastInstruction())); HBasicBlock* then = new (&allocator) HBasicBlock(graph); @@ -139,7 +145,8 @@ TEST(GVNTest, GlobalFieldElimination) { false, kUnknownFieldIndex, graph->GetDexFile(), - dex_cache)); + dex_cache, + 0)); then->AddInstruction(new (&allocator) HGoto()); else_->AddInstruction(new (&allocator) HInstanceFieldGet(parameter, Primitive::kPrimBoolean, @@ -147,7 +154,8 @@ TEST(GVNTest, GlobalFieldElimination) { false, kUnknownFieldIndex, graph->GetDexFile(), - dex_cache)); + dex_cache, + 0)); else_->AddInstruction(new (&allocator) HGoto()); join->AddInstruction(new (&allocator) HInstanceFieldGet(parameter, Primitive::kPrimBoolean, @@ -155,7 +163,8 @@ TEST(GVNTest, GlobalFieldElimination) { false, kUnknownFieldIndex, graph->GetDexFile(), - dex_cache)); + dex_cache, + 0)); join->AddInstruction(new (&allocator) HExit()); graph->TryBuildingSsa(); @@ -191,7 +200,8 @@ TEST(GVNTest, LoopFieldElimination) { false, kUnknownFieldIndex, graph->GetDexFile(), - dex_cache)); + dex_cache, + 0)); block->AddInstruction(new (&allocator) HGoto()); HBasicBlock* loop_header = new (&allocator) HBasicBlock(graph); @@ -212,7 +222,8 @@ TEST(GVNTest, LoopFieldElimination) { false, kUnknownFieldIndex, graph->GetDexFile(), - dex_cache)); + dex_cache, + 0)); HInstruction* field_get_in_loop_header = loop_header->GetLastInstruction(); loop_header->AddInstruction(new (&allocator) HIf(block->GetLastInstruction())); @@ -225,7 +236,8 @@ TEST(GVNTest, LoopFieldElimination) { false, kUnknownFieldIndex, graph->GetDexFile(), - dex_cache)); + dex_cache, + 0)); HInstruction* field_set = loop_body->GetLastInstruction(); loop_body->AddInstruction(new (&allocator) HInstanceFieldGet(parameter, Primitive::kPrimBoolean, @@ -233,7 +245,8 @@ TEST(GVNTest, LoopFieldElimination) { false, kUnknownFieldIndex, graph->GetDexFile(), - dex_cache)); + dex_cache, + 0)); HInstruction* field_get_in_loop_body = loop_body->GetLastInstruction(); loop_body->AddInstruction(new (&allocator) HGoto()); @@ -243,7 +256,8 @@ TEST(GVNTest, LoopFieldElimination) { false, kUnknownFieldIndex, graph->GetDexFile(), - dex_cache)); + dex_cache, + 0)); HInstruction* field_get_in_exit = exit->GetLastInstruction(); exit->AddInstruction(new (&allocator) HExit()); @@ -339,7 +353,8 @@ TEST(GVNTest, LoopSideEffects) { false, kUnknownFieldIndex, graph->GetDexFile(), - dex_cache)); + dex_cache, + 0)); SideEffectsAnalysis side_effects(graph); side_effects.Run(); @@ -362,7 +377,8 @@ TEST(GVNTest, LoopSideEffects) { false, kUnknownFieldIndex, graph->GetDexFile(), - dex_cache), + dex_cache, + 0), outer_loop_body->GetLastInstruction()); SideEffectsAnalysis side_effects(graph); @@ -386,7 +402,8 @@ TEST(GVNTest, LoopSideEffects) { false, kUnknownFieldIndex, graph->GetDexFile(), - dex_cache), + dex_cache, + 0), inner_loop_body->GetLastInstruction()); SideEffectsAnalysis side_effects(graph); diff --git a/compiler/optimizing/licm_test.cc b/compiler/optimizing/licm_test.cc index ec4a9ec91..558892d01 100644 --- a/compiler/optimizing/licm_test.cc +++ b/compiler/optimizing/licm_test.cc @@ -106,11 +106,11 @@ TEST_F(LICMTest, FieldHoisting) { NullHandle dex_cache; HInstruction* get_field = new (&allocator_) HInstanceFieldGet( parameter_, Primitive::kPrimLong, MemberOffset(10), - false, kUnknownFieldIndex, graph_->GetDexFile(), dex_cache); + false, kUnknownFieldIndex, graph_->GetDexFile(), dex_cache, 0); loop_body_->InsertInstructionBefore(get_field, loop_body_->GetLastInstruction()); HInstruction* set_field = new (&allocator_) HInstanceFieldSet( parameter_, constant_, Primitive::kPrimInt, MemberOffset(20), - false, kUnknownFieldIndex, graph_->GetDexFile(), dex_cache); + false, kUnknownFieldIndex, graph_->GetDexFile(), dex_cache, 0); loop_body_->InsertInstructionBefore(set_field, loop_body_->GetLastInstruction()); EXPECT_EQ(get_field->GetBlock(), loop_body_); @@ -127,11 +127,11 @@ TEST_F(LICMTest, NoFieldHoisting) { NullHandle dex_cache; HInstruction* get_field = new (&allocator_) HInstanceFieldGet( parameter_, Primitive::kPrimLong, MemberOffset(10), - false, kUnknownFieldIndex, graph_->GetDexFile(), dex_cache); + false, kUnknownFieldIndex, graph_->GetDexFile(), dex_cache, 0); loop_body_->InsertInstructionBefore(get_field, loop_body_->GetLastInstruction()); HInstruction* set_field = new (&allocator_) HInstanceFieldSet( parameter_, get_field, Primitive::kPrimLong, MemberOffset(10), - false, kUnknownFieldIndex, graph_->GetDexFile(), dex_cache); + false, kUnknownFieldIndex, graph_->GetDexFile(), dex_cache, 0); loop_body_->InsertInstructionBefore(set_field, loop_body_->GetLastInstruction()); EXPECT_EQ(get_field->GetBlock(), loop_body_); @@ -146,7 +146,7 @@ TEST_F(LICMTest, ArrayHoisting) { // Populate the loop with instructions: set/get array with different types. HInstruction* get_array = new (&allocator_) HArrayGet( - parameter_, constant_, Primitive::kPrimLong); + parameter_, constant_, Primitive::kPrimLong, 0); loop_body_->InsertInstructionBefore(get_array, loop_body_->GetLastInstruction()); HInstruction* set_array = new (&allocator_) HArraySet( parameter_, constant_, constant_, Primitive::kPrimInt, 0); @@ -164,7 +164,7 @@ TEST_F(LICMTest, NoArrayHoisting) { // Populate the loop with instructions: set/get array with same types. HInstruction* get_array = new (&allocator_) HArrayGet( - parameter_, constant_, Primitive::kPrimLong); + parameter_, constant_, Primitive::kPrimLong, 0); loop_body_->InsertInstructionBefore(get_array, loop_body_->GetLastInstruction()); HInstruction* set_array = new (&allocator_) HArraySet( parameter_, get_array, constant_, Primitive::kPrimLong, 0); diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h index 489f71de7..dbf46ce3f 100644 --- a/compiler/optimizing/nodes.h +++ b/compiler/optimizing/nodes.h @@ -1715,7 +1715,7 @@ std::ostream& operator<<(std::ostream& os, const ReferenceTypeInfo& rhs); class HInstruction : public ArenaObject { public: - HInstruction(SideEffects side_effects, uint32_t dex_pc = kNoDexPc) + HInstruction(SideEffects side_effects, uint32_t dex_pc) : previous_(nullptr), next_(nullptr), block_(nullptr), @@ -2072,7 +2072,7 @@ class HBackwardInstructionIterator : public ValueObject { template class HTemplateInstruction: public HInstruction { public: - HTemplateInstruction(SideEffects side_effects, uint32_t dex_pc = kNoDexPc) + HTemplateInstruction(SideEffects side_effects, uint32_t dex_pc) : HInstruction(side_effects, dex_pc), inputs_() {} virtual ~HTemplateInstruction() {} @@ -2099,7 +2099,7 @@ class HTemplateInstruction: public HInstruction { template<> class HTemplateInstruction<0>: public HInstruction { public: - explicit HTemplateInstruction<0>(SideEffects side_effects, uint32_t dex_pc = kNoDexPc) + explicit HTemplateInstruction<0>(SideEffects side_effects, uint32_t dex_pc) : HInstruction(side_effects, dex_pc) {} virtual ~HTemplateInstruction() {} @@ -2125,7 +2125,7 @@ class HTemplateInstruction<0>: public HInstruction { template class HExpression : public HTemplateInstruction { public: - HExpression(Primitive::Type type, SideEffects side_effects, uint32_t dex_pc = kNoDexPc) + HExpression(Primitive::Type type, SideEffects side_effects, uint32_t dex_pc) : HTemplateInstruction(side_effects, dex_pc), type_(type) {} virtual ~HExpression() {} @@ -4210,7 +4210,7 @@ class HInstanceFieldGet : public HExpression<1> { uint32_t field_idx, const DexFile& dex_file, Handle dex_cache, - uint32_t dex_pc = kNoDexPc) + uint32_t dex_pc) : HExpression( field_type, SideEffects::FieldReadOfType(field_type, is_volatile), dex_pc), @@ -4256,7 +4256,7 @@ class HInstanceFieldSet : public HTemplateInstruction<2> { uint32_t field_idx, const DexFile& dex_file, Handle dex_cache, - uint32_t dex_pc = kNoDexPc) + uint32_t dex_pc) : HTemplateInstruction( SideEffects::FieldWriteOfType(field_type, is_volatile), dex_pc), field_info_(field_offset, field_type, is_volatile, field_idx, dex_file, dex_cache), @@ -4291,7 +4291,7 @@ class HArrayGet : public HExpression<2> { HArrayGet(HInstruction* array, HInstruction* index, Primitive::Type type, - uint32_t dex_pc = kNoDexPc) + uint32_t dex_pc) : HExpression(type, SideEffects::ArrayReadOfType(type), dex_pc) { SetRawInputAt(0, array); SetRawInputAt(1, index); @@ -4407,7 +4407,7 @@ class HArraySet : public HTemplateInstruction<3> { class HArrayLength : public HExpression<1> { public: - explicit HArrayLength(HInstruction* array, uint32_t dex_pc = kNoDexPc) + explicit HArrayLength(HInstruction* array, uint32_t dex_pc) : HExpression(Primitive::kPrimInt, SideEffects::None(), dex_pc) { // Note that arrays do not change length, so the instruction does not // depend on any write. @@ -4675,7 +4675,7 @@ class HStaticFieldGet : public HExpression<1> { uint32_t field_idx, const DexFile& dex_file, Handle dex_cache, - uint32_t dex_pc = kNoDexPc) + uint32_t dex_pc) : HExpression( field_type, SideEffects::FieldReadOfType(field_type, is_volatile), dex_pc), @@ -4718,7 +4718,7 @@ class HStaticFieldSet : public HTemplateInstruction<2> { uint32_t field_idx, const DexFile& dex_file, Handle dex_cache, - uint32_t dex_pc = kNoDexPc) + uint32_t dex_pc) : HTemplateInstruction( SideEffects::FieldWriteOfType(field_type, is_volatile), dex_pc), field_info_(field_offset, field_type, is_volatile, field_idx, dex_file, dex_cache), diff --git a/compiler/optimizing/nodes_x86.h b/compiler/optimizing/nodes_x86.h index ddc573021..f7cc87241 100644 --- a/compiler/optimizing/nodes_x86.h +++ b/compiler/optimizing/nodes_x86.h @@ -23,7 +23,8 @@ namespace art { class HX86ComputeBaseMethodAddress : public HExpression<0> { public: // Treat the value as an int32_t, but it is really a 32 bit native pointer. - HX86ComputeBaseMethodAddress() : HExpression(Primitive::kPrimInt, SideEffects::None()) {} + HX86ComputeBaseMethodAddress() + : HExpression(Primitive::kPrimInt, SideEffects::None(), kNoDexPc) {} DECLARE_INSTRUCTION(X86ComputeBaseMethodAddress); @@ -37,7 +38,7 @@ class HX86LoadFromConstantTable : public HExpression<2> { HX86LoadFromConstantTable(HX86ComputeBaseMethodAddress* method_base, HConstant* constant, bool needs_materialization = true) - : HExpression(constant->GetType(), SideEffects::None()), + : HExpression(constant->GetType(), SideEffects::None(), kNoDexPc), needs_materialization_(needs_materialization) { SetRawInputAt(0, method_base); SetRawInputAt(1, constant); diff --git a/compiler/optimizing/register_allocator_test.cc b/compiler/optimizing/register_allocator_test.cc index 2bb5a8bb0..21b36cb54 100644 --- a/compiler/optimizing/register_allocator_test.cc +++ b/compiler/optimizing/register_allocator_test.cc @@ -488,7 +488,8 @@ static HGraph* BuildIfElseWithPhi(ArenaAllocator* allocator, false, kUnknownFieldIndex, graph->GetDexFile(), - dex_cache); + dex_cache, + 0); block->AddInstruction(test); block->AddInstruction(new (allocator) HIf(test)); HBasicBlock* then = new (allocator) HBasicBlock(graph); @@ -513,14 +514,16 @@ static HGraph* BuildIfElseWithPhi(ArenaAllocator* allocator, false, kUnknownFieldIndex, graph->GetDexFile(), - dex_cache); + dex_cache, + 0); *input2 = new (allocator) HInstanceFieldGet(parameter, Primitive::kPrimInt, MemberOffset(42), false, kUnknownFieldIndex, graph->GetDexFile(), - dex_cache); + dex_cache, + 0); then->AddInstruction(*input1); else_->AddInstruction(*input2); join->AddInstruction(new (allocator) HExit()); @@ -634,7 +637,8 @@ static HGraph* BuildFieldReturn(ArenaAllocator* allocator, false, kUnknownFieldIndex, graph->GetDexFile(), - dex_cache); + dex_cache, + 0); block->AddInstruction(*field); *ret = new (allocator) HReturn(*field); block->AddInstruction(*ret); -- 2.11.0