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
diff --git a/compiler/optimizing/dominator_test.cc b/compiler/optimizing/dominator_test.cc
index 78ae1dd..6b18650 100644
--- a/compiler/optimizing/dominator_test.cc
+++ b/compiler/optimizing/dominator_test.cc
@@ -24,7 +24,7 @@
namespace art {
-static void TestCode(const uint16_t* data, const int* blocks, size_t blocks_length) {
+static void TestCode(const uint16_t* data, const uint32_t* blocks, size_t blocks_length) {
ArenaPool pool;
ArenaAllocator allocator(&pool);
HGraph* graph = CreateGraph(&allocator);
@@ -33,19 +33,19 @@
bool graph_built = builder.BuildGraph(*item);
ASSERT_TRUE(graph_built);
graph->BuildDominatorTree();
- ASSERT_EQ(graph->GetBlocks().Size(), blocks_length);
+ ASSERT_EQ(graph->GetBlocks().size(), blocks_length);
for (size_t i = 0, e = blocks_length; i < e; ++i) {
- if (blocks[i] == -1) {
- if (graph->GetBlocks().Get(i) == nullptr) {
+ if (blocks[i] == kInvalidBlockId) {
+ if (graph->GetBlock(i) == nullptr) {
// Dead block.
} else {
// Only the entry block has no dominator.
- ASSERT_EQ(nullptr, graph->GetBlocks().Get(i)->GetDominator());
- ASSERT_TRUE(graph->GetBlocks().Get(i)->IsEntryBlock());
+ ASSERT_EQ(nullptr, graph->GetBlock(i)->GetDominator());
+ ASSERT_TRUE(graph->GetBlock(i)->IsEntryBlock());
}
} else {
- ASSERT_NE(nullptr, graph->GetBlocks().Get(i)->GetDominator());
- ASSERT_EQ(blocks[i], graph->GetBlocks().Get(i)->GetDominator()->GetBlockId());
+ ASSERT_NE(nullptr, graph->GetBlock(i)->GetDominator());
+ ASSERT_EQ(blocks[i], graph->GetBlock(i)->GetDominator()->GetBlockId());
}
}
}
@@ -54,10 +54,10 @@
const uint16_t data[] = ZERO_REGISTER_CODE_ITEM(
Instruction::RETURN_VOID); // Block number 1
- const int dominators[] = {
- -1,
- 0,
- 1
+ const uint32_t dominators[] = {
+ kInvalidBlockId,
+ 0,
+ 1
};
TestCode(data, dominators, sizeof(dominators) / sizeof(int));
@@ -68,11 +68,11 @@
Instruction::GOTO | 0x100, // Block number 1
Instruction::RETURN_VOID); // Block number 2
- const int dominators[] = {
- -1,
- 0,
- 1,
- 2
+ const uint32_t dominators[] = {
+ kInvalidBlockId,
+ 0,
+ 1,
+ 2
};
TestCode(data, dominators, sizeof(dominators) / sizeof(int));
@@ -84,12 +84,12 @@
Instruction::GOTO | 0x100, // Block number 2
Instruction::RETURN_VOID); // Block number 3
- const int dominators[] = {
- -1,
- 0,
- 1,
- 2,
- 3
+ const uint32_t dominators[] = {
+ kInvalidBlockId,
+ 0,
+ 1,
+ 2,
+ 3
};
TestCode(data, dominators, sizeof(dominators) / sizeof(int));
@@ -101,12 +101,12 @@
Instruction::RETURN_VOID, // Block number 2
Instruction::GOTO | 0xFF00); // Block number 3
- const int dominators[] = {
- -1,
- 0,
- 3,
- 1,
- 2
+ const uint32_t dominators[] = {
+ kInvalidBlockId,
+ 0,
+ 3,
+ 1,
+ 2
};
TestCode(data1, dominators, sizeof(dominators) / sizeof(int));
@@ -131,10 +131,10 @@
Instruction::NOP,
Instruction::GOTO | 0xFF00);
- const int dominators[] = {
- -1,
- 0,
- -1
+ const uint32_t dominators[] = {
+ kInvalidBlockId,
+ 0,
+ kInvalidBlockId
};
TestCode(data1, dominators, sizeof(dominators) / sizeof(int));
@@ -152,11 +152,11 @@
Instruction::GOTO | 0xFE00); // Block number 2
- const int dominators[] = {
- -1,
- 0,
- -1,
- 1
+ const uint32_t dominators[] = {
+ kInvalidBlockId,
+ 0,
+ kInvalidBlockId,
+ 1
};
TestCode(data, dominators, sizeof(dominators) / sizeof(int));
@@ -169,13 +169,13 @@
Instruction::GOTO | 0x100,
Instruction::RETURN_VOID);
- const int dominators[] = {
- -1,
- 0,
- 1,
- 1,
- 3,
- 1, // Synthesized block to avoid critical edge.
+ const uint32_t dominators[] = {
+ kInvalidBlockId,
+ 0,
+ 1,
+ 1,
+ 3,
+ 1, // Synthesized block to avoid critical edge.
};
TestCode(data, dominators, sizeof(dominators) / sizeof(int));
@@ -188,14 +188,14 @@
Instruction::GOTO | 0x100, // Block number 2
Instruction::GOTO | 0xFF00); // Block number 3
- const int dominators[] = {
- -1,
- 0,
- 1,
- 1,
- -1, // exit block is not dominated by any block due to the spin loop.
- 1, // block to avoid critical edge.
- 1 // block to avoid critical edge.
+ const uint32_t dominators[] = {
+ kInvalidBlockId,
+ 0,
+ 1,
+ 1,
+ kInvalidBlockId, // exit block is not dominated by any block due to the spin loop.
+ 1, // block to avoid critical edge.
+ 1 // block to avoid critical edge.
};
TestCode(data, dominators, sizeof(dominators) / sizeof(int));
@@ -209,14 +209,14 @@
Instruction::GOTO | 0x100, // Block number 3
Instruction::GOTO | 0xFF00); // Block number 4
- const int dominators[] = {
- -1,
- 0,
- 1,
- 1,
- 1,
- -1, // exit block is not dominated by any block due to the spin loop.
- 1 // block to avoid critical edge.
+ const uint32_t dominators[] = {
+ kInvalidBlockId,
+ 0,
+ 1,
+ 1,
+ 1,
+ kInvalidBlockId, // exit block is not dominated by any block due to the spin loop.
+ 1 // block to avoid critical edge.
};
TestCode(data, dominators, sizeof(dominators) / sizeof(int));
@@ -230,14 +230,14 @@
Instruction::GOTO | 0x100, // Block number 3
Instruction::GOTO | 0xFE00); // Block number 4
- const int dominators[] = {
- -1,
- 0,
- 1,
- 1,
- 1,
- -1, // exit block is not dominated by any block due to the spin loop.
- 1 // block to avoid critical edge.
+ const uint32_t dominators[] = {
+ kInvalidBlockId,
+ 0,
+ 1,
+ 1,
+ 1,
+ kInvalidBlockId, // exit block is not dominated by any block due to the spin loop.
+ 1 // block to avoid critical edge.
};
TestCode(data, dominators, sizeof(dominators) / sizeof(int));
@@ -252,16 +252,16 @@
Instruction::GOTO | 0x100, // Block number 4
Instruction::RETURN_VOID); // Block number 5
- const int dominators[] = {
- -1,
- 0,
- 1,
- 2,
- 2,
- 1,
- 5, // Block number 5 dominates exit block
- 1, // block to avoid critical edge.
- 2 // block to avoid critical edge.
+ const uint32_t dominators[] = {
+ kInvalidBlockId,
+ 0,
+ 1,
+ 2,
+ 2,
+ 1,
+ 5, // Block number 5 dominates exit block
+ 1, // block to avoid critical edge.
+ 2 // block to avoid critical edge.
};
TestCode(data, dominators, sizeof(dominators) / sizeof(int));