From ca6fff898afcb62491458ae8bcd428bfb3043da1 Mon Sep 17 00:00:00 2001 From: Vladimir Marko Date: Tue, 3 Oct 2017 14:49:14 +0100 Subject: 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 --- compiler/optimizing/ssa_builder.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'compiler/optimizing/ssa_builder.cc') 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* worklist) { } void SsaBuilder::RunPrimitiveTypePropagation() { - ArenaVector worklist(graph_->GetArena()->Adapter(kArenaAllocGraphBuilder)); + ArenaVector 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 worklist(graph_->GetArena()->Adapter(kArenaAllocGraphBuilder)); + ArenaVector 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(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(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); -- cgit v1.2.3-59-g8ed1b