Reduce Partial LSE memory usage.
Instantiate ExecutionSubgraph only for partial singleton
candidates (currently NewInstance, possibly NewArray in the
future). This reduces "LSA" allocations.
Reserve memory for PartialLoadStoreEliminationHelper members
based on the number of partial singletons instead of the
number of reference infos. This reduces "LSE" allocations.
The peak scoped arena allocation for one compiled method
is reduced from
MEM: used: 97424004, allocated: 99006568, lost: 1115968
LSA 46015104
LSE 51408900
down to
MEM: used: 17000744, allocated: 26713880, lost: 3332496
GVN 17000744
where the LSA+LSE memory use is lower than GVN use.
Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Bug: 33650849
Change-Id: I323b9f144b258f0fab034794770971547ce94b59
diff --git a/compiler/optimizing/load_store_analysis.cc b/compiler/optimizing/load_store_analysis.cc
index 38ed98a..3fe42af 100644
--- a/compiler/optimizing/load_store_analysis.cc
+++ b/compiler/optimizing/load_store_analysis.cc
@@ -94,7 +94,8 @@
// Make sure we mark any writes/potential writes to heap-locations within partially
// escaped values as escaping.
void ReferenceInfo::PrunePartialEscapeWrites() {
- if (!subgraph_.IsValid()) {
+ DCHECK(subgraph_ != nullptr);
+ if (!subgraph_->IsValid()) {
// All paths escape.
return;
}
@@ -104,12 +105,12 @@
for (const HUseListNode<HInstruction*>& use : reference_->GetUses()) {
const HInstruction* user = use.GetUser();
if (!additional_exclusions.IsBitSet(user->GetBlock()->GetBlockId()) &&
- subgraph_.ContainsBlock(user->GetBlock()) &&
+ subgraph_->ContainsBlock(user->GetBlock()) &&
(user->IsUnresolvedInstanceFieldSet() || user->IsUnresolvedStaticFieldSet() ||
user->IsInstanceFieldSet() || user->IsStaticFieldSet() || user->IsArraySet()) &&
(reference_ == user->InputAt(0)) &&
- std::any_of(subgraph_.UnreachableBlocks().begin(),
- subgraph_.UnreachableBlocks().end(),
+ std::any_of(subgraph_->UnreachableBlocks().begin(),
+ subgraph_->UnreachableBlocks().end(),
[&](const HBasicBlock* excluded) -> bool {
return reference_->GetBlock()->GetGraph()->PathBetween(excluded,
user->GetBlock());
@@ -122,7 +123,7 @@
}
if (UNLIKELY(additional_exclusions.IsAnyBitSet())) {
for (uint32_t exc : additional_exclusions.Indexes()) {
- subgraph_.RemoveBlock(graph->GetBlocks()[exc]);
+ subgraph_->RemoveBlock(graph->GetBlocks()[exc]);
}
}
}