From fa6b93c4b69e6d7ddfa2a4ed0aff01b0608c5a3a Mon Sep 17 00:00:00 2001 From: Vladimir Marko Date: Tue, 15 Sep 2015 10:15:55 +0100 Subject: Optimizing: Tag arena allocations in HGraph. Replace GrowableArray with ArenaVector in HGraph and related classes HEnvironment, HLoopInformation, HInvoke and HPhi, and tag allocations with new arena allocation types. Change-Id: I3d79897af405b9a1a5b98bfc372e70fe0b3bc40d --- compiler/optimizing/linearize_test.cc | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) (limited to 'compiler/optimizing/linearize_test.cc') diff --git a/compiler/optimizing/linearize_test.cc b/compiler/optimizing/linearize_test.cc index 4f259b5095..a059766e00 100644 --- a/compiler/optimizing/linearize_test.cc +++ b/compiler/optimizing/linearize_test.cc @@ -36,7 +36,8 @@ namespace art { -static void TestCode(const uint16_t* data, const int* expected_order, size_t number_of_blocks) { +template +static void TestCode(const uint16_t* data, const uint32_t (&expected_order)[number_of_blocks]) { ArenaPool pool; ArenaAllocator allocator(&pool); HGraph* graph = CreateGraph(&allocator); @@ -53,9 +54,9 @@ static void TestCode(const uint16_t* data, const int* expected_order, size_t num SsaLivenessAnalysis liveness(graph, &codegen); liveness.Analyze(); - ASSERT_EQ(graph->GetLinearOrder().Size(), number_of_blocks); + ASSERT_EQ(graph->GetLinearOrder().size(), number_of_blocks); for (size_t i = 0; i < number_of_blocks; ++i) { - ASSERT_EQ(graph->GetLinearOrder().Get(i)->GetBlockId(), expected_order[i]); + ASSERT_EQ(graph->GetLinearOrder()[i]->GetBlockId(), expected_order[i]); } } @@ -80,8 +81,8 @@ TEST(LinearizeTest, CFG1) { Instruction::GOTO | 0xFE00, Instruction::RETURN_VOID); - const int blocks[] = {0, 1, 2, 7, 3, 4, 8, 5, 6}; - TestCode(data, blocks, 9); + const uint32_t blocks[] = {0, 1, 2, 7, 3, 4, 8, 5, 6}; + TestCode(data, blocks); } TEST(LinearizeTest, CFG2) { @@ -105,8 +106,8 @@ TEST(LinearizeTest, CFG2) { Instruction::IF_EQ, 0xFFFD, Instruction::GOTO | 0xFE00); - const int blocks[] = {0, 1, 2, 7, 4, 5, 8, 3, 6}; - TestCode(data, blocks, 9); + const uint32_t blocks[] = {0, 1, 2, 7, 4, 5, 8, 3, 6}; + TestCode(data, blocks); } TEST(LinearizeTest, CFG3) { @@ -132,8 +133,8 @@ TEST(LinearizeTest, CFG3) { Instruction::IF_EQ, 0xFFFC, Instruction::GOTO | 0xFD00); - const int blocks[] = {0, 1, 2, 8, 5, 6, 4, 9, 3, 7}; - TestCode(data, blocks, 10); + const uint32_t blocks[] = {0, 1, 2, 8, 5, 6, 4, 9, 3, 7}; + TestCode(data, blocks); } TEST(LinearizeTest, CFG4) { @@ -162,8 +163,8 @@ TEST(LinearizeTest, CFG4) { Instruction::GOTO | 0xFE00, Instruction::RETURN_VOID); - const int blocks[] = {0, 1, 2, 8, 3, 10, 4, 5, 11, 9, 6, 7}; - TestCode(data, blocks, 12); + const uint32_t blocks[] = {0, 1, 2, 8, 3, 10, 4, 5, 11, 9, 6, 7}; + TestCode(data, blocks); } TEST(LinearizeTest, CFG5) { @@ -192,8 +193,8 @@ TEST(LinearizeTest, CFG5) { Instruction::IF_EQ, 0xFFFE, Instruction::GOTO | 0xFE00); - const int blocks[] = {0, 1, 2, 8, 4, 10, 5, 6, 11, 9, 3, 7}; - TestCode(data, blocks, 12); + const uint32_t blocks[] = {0, 1, 2, 8, 4, 10, 5, 6, 11, 9, 3, 7}; + TestCode(data, blocks); } TEST(LinearizeTest, CFG6) { @@ -218,8 +219,8 @@ TEST(LinearizeTest, CFG6) { Instruction::RETURN_VOID, Instruction::GOTO | 0xFA00); - const int blocks[] = {0, 1, 2, 3, 4, 6, 9, 8, 5, 7}; - TestCode(data, blocks, arraysize(blocks)); + const uint32_t blocks[] = {0, 1, 2, 3, 4, 6, 9, 8, 5, 7}; + TestCode(data, blocks); } TEST(LinearizeTest, CFG7) { @@ -246,8 +247,8 @@ TEST(LinearizeTest, CFG7) { Instruction::RETURN_VOID, Instruction::GOTO | 0xFA00); - const int blocks[] = {0, 1, 2, 3, 4, 9, 8, 6, 5, 7}; - TestCode(data, blocks, arraysize(blocks)); + const uint32_t blocks[] = {0, 1, 2, 3, 4, 9, 8, 6, 5, 7}; + TestCode(data, blocks); } } // namespace art -- cgit v1.2.3-59-g8ed1b