diff options
author | 2017-10-03 14:49:14 +0100 | |
---|---|---|
committer | 2017-10-06 17:53:50 +0100 | |
commit | ca6fff898afcb62491458ae8bcd428bfb3043da1 (patch) | |
tree | 195a6b16d3a4b34acc2faf91ce56f448efb15e07 /compiler/optimizing/ssa_builder.cc | |
parent | aa7273e56fbafc2692c8d20a31b50d2f4bdd2aa1 (diff) |
ART: Use ScopedArenaAllocator for pass-local data.
Passes using local ArenaAllocator were hiding their memory
usage from the allocation counting, making it difficult to
track down where memory was used. Using ScopedArenaAllocator
reveals the memory usage.
This changes the HGraph constructor which requires a lot of
changes in tests. Refactor these tests to limit the amount
of work needed the next time we change that constructor.
Test: m test-art-host-gtest
Test: testrunner.py --host
Test: Build with kArenaAllocatorCountAllocations = true.
Bug: 64312607
Change-Id: I34939e4086b500d6e827ff3ef2211d1a421ac91a
Diffstat (limited to 'compiler/optimizing/ssa_builder.cc')
-rw-r--r-- | compiler/optimizing/ssa_builder.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/compiler/optimizing/ssa_builder.cc b/compiler/optimizing/ssa_builder.cc index 23563168a0..f4a8a17131 100644 --- a/compiler/optimizing/ssa_builder.cc +++ b/compiler/optimizing/ssa_builder.cc @@ -233,7 +233,7 @@ bool SsaBuilder::UpdatePrimitiveType(HPhi* phi, ArenaVector<HPhi*>* worklist) { } void SsaBuilder::RunPrimitiveTypePropagation() { - ArenaVector<HPhi*> worklist(graph_->GetArena()->Adapter(kArenaAllocGraphBuilder)); + ArenaVector<HPhi*> worklist(graph_->GetAllocator()->Adapter(kArenaAllocGraphBuilder)); for (HBasicBlock* block : graph_->GetReversePostOrder()) { if (block->IsLoopHeader()) { @@ -293,7 +293,7 @@ static HArrayGet* CreateFloatOrDoubleEquivalentOfArrayGet(HArrayGet* aget) { DCHECK(DataType::IsIntOrLongType(type)); DCHECK(FindFloatOrDoubleEquivalentOfArrayGet(aget) == nullptr); - HArrayGet* equivalent = new (aget->GetBlock()->GetGraph()->GetArena()) HArrayGet( + HArrayGet* equivalent = new (aget->GetBlock()->GetGraph()->GetAllocator()) HArrayGet( aget->GetArray(), aget->GetIndex(), type == DataType::Type::kInt32 ? DataType::Type::kFloat32 : DataType::Type::kFloat64, @@ -319,7 +319,7 @@ bool SsaBuilder::FixAmbiguousArrayOps() { // uses (because they are untyped) and environment uses (if --debuggable). // After resolving all ambiguous ArrayGets, we will re-run primitive type // propagation on the Phis which need to be updated. - ArenaVector<HPhi*> worklist(graph_->GetArena()->Adapter(kArenaAllocGraphBuilder)); + ArenaVector<HPhi*> worklist(graph_->GetAllocator()->Adapter(kArenaAllocGraphBuilder)); { ScopedObjectAccess soa(Thread::Current()); @@ -566,7 +566,7 @@ HFloatConstant* SsaBuilder::GetFloatEquivalent(HIntConstant* constant) { HFloatConstant* result = constant->GetNext()->AsFloatConstant(); if (result == nullptr) { float value = bit_cast<float, int32_t>(constant->GetValue()); - result = new (graph_->GetArena()) HFloatConstant(value); + result = new (graph_->GetAllocator()) HFloatConstant(value); constant->GetBlock()->InsertInstructionBefore(result, constant->GetNext()); graph_->CacheFloatConstant(result); } else { @@ -588,7 +588,7 @@ HDoubleConstant* SsaBuilder::GetDoubleEquivalent(HLongConstant* constant) { HDoubleConstant* result = constant->GetNext()->AsDoubleConstant(); if (result == nullptr) { double value = bit_cast<double, int64_t>(constant->GetValue()); - result = new (graph_->GetArena()) HDoubleConstant(value); + result = new (graph_->GetAllocator()) HDoubleConstant(value); constant->GetBlock()->InsertInstructionBefore(result, constant->GetNext()); graph_->CacheDoubleConstant(result); } else { @@ -621,7 +621,7 @@ HPhi* SsaBuilder::GetFloatDoubleOrReferenceEquivalentOfPhi(HPhi* phi, DataType:: if (next == nullptr || (next->AsPhi()->GetRegNumber() != phi->GetRegNumber()) || (next->GetType() != type)) { - ArenaAllocator* allocator = graph_->GetArena(); + ArenaAllocator* allocator = graph_->GetAllocator(); HInputsRef inputs = phi->GetInputs(); HPhi* new_phi = new (allocator) HPhi(allocator, phi->GetRegNumber(), inputs.size(), type); |