summaryrefslogtreecommitdiff
path: root/compiler/optimizing/nodes_test.cc
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2016-03-29 12:21:58 +0100
committer Vladimir Marko <vmarko@google.com> 2016-04-19 18:33:06 +0100
commit46817b876ab00d6b78905b80ed12b4344c522b6c (patch)
tree6715bee60b0682a10437866c9617cb442146aa2f /compiler/optimizing/nodes_test.cc
parentf59149a151ee694484e21da7b3b207920dead5a6 (diff)
Use iterators "before" the use node in HUserRecord<>.
Create a new template class IntrusiveForwardList<> that mimicks std::forward_list<> except that all allocations are handled externally. This is essentially the same as boost::intrusive::slist<> but since we're not using Boost we have to reinvent the wheel. Use the new container to replace the HUseList and use the iterators to "before" use nodes in HUserRecord<> to avoid the extra pointer to the previous node which was used exclusively for removing nodes from the list. This reduces the size of the HUseListNode by 25%, 32B to 24B in 64-bit compiler, 16B to 12B in 32-bit compiler. This translates directly to overall memory savings for the 64-bit compiler but due to rounding up of the arena allocations to 8B, we do not get any improvement in the 32-bit compiler. Compiling the Nexus 5 boot image with the 64-bit dex2oat on host this CL reduces the memory used for compiling the most hungry method, BatteryStats.dumpLocked(), by ~3.3MiB: Before: MEM: used: 47829200, allocated: 48769120, lost: 939920 Number of arenas allocated: 345, Number of allocations: 815492, avg size: 58 ... UseListNode 13744640 ... After: MEM: used: 44393040, allocated: 45361248, lost: 968208 Number of arenas allocated: 319, Number of allocations: 815492, avg size: 54 ... UseListNode 10308480 ... Note that while we do not ship the 64-bit dex2oat to the device, the JIT compilation for 64-bit processes is using the 64-bit libart-compiler. Bug: 28173563 Change-Id: I985eabd4816f845372d8aaa825a1489cf9569208
Diffstat (limited to 'compiler/optimizing/nodes_test.cc')
-rw-r--r--compiler/optimizing/nodes_test.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/optimizing/nodes_test.cc b/compiler/optimizing/nodes_test.cc
index 764f5fec5b..d4e2a58103 100644
--- a/compiler/optimizing/nodes_test.cc
+++ b/compiler/optimizing/nodes_test.cc
@@ -91,7 +91,7 @@ TEST(Node, InsertInstruction) {
entry->InsertInstructionBefore(to_insert, parameter2);
ASSERT_TRUE(parameter1->HasUses());
- ASSERT_TRUE(parameter1->GetUses().HasOnlyOneUse());
+ ASSERT_TRUE(parameter1->GetUses().HasExactlyOneElement());
}
/**
@@ -115,7 +115,7 @@ TEST(Node, AddInstruction) {
entry->AddInstruction(to_add);
ASSERT_TRUE(parameter->HasUses());
- ASSERT_TRUE(parameter->GetUses().HasOnlyOneUse());
+ ASSERT_TRUE(parameter->GetUses().HasExactlyOneElement());
}
TEST(Node, ParentEnvironment) {
@@ -134,7 +134,7 @@ TEST(Node, ParentEnvironment) {
entry->AddInstruction(new (&allocator) HExit());
ASSERT_TRUE(parameter1->HasUses());
- ASSERT_TRUE(parameter1->GetUses().HasOnlyOneUse());
+ ASSERT_TRUE(parameter1->GetUses().HasExactlyOneElement());
HEnvironment* environment = new (&allocator) HEnvironment(
&allocator, 1, graph->GetDexFile(), graph->GetMethodIdx(), 0, kStatic, with_environment);
@@ -145,7 +145,7 @@ TEST(Node, ParentEnvironment) {
with_environment->SetRawEnvironment(environment);
ASSERT_TRUE(parameter1->HasEnvironmentUses());
- ASSERT_TRUE(parameter1->GetEnvUses().HasOnlyOneUse());
+ ASSERT_TRUE(parameter1->GetEnvUses().HasExactlyOneElement());
HEnvironment* parent1 = new (&allocator) HEnvironment(
&allocator, 1, graph->GetDexFile(), graph->GetMethodIdx(), 0, kStatic, nullptr);