From 8c0c91a845568624815df026cfdac8c42ecccdf6 Mon Sep 17 00:00:00 2001 From: Nicolas Geoffray Date: Thu, 7 May 2015 11:46:05 +0100 Subject: Use a growable array instead of an environment during SSA. Using an environment was convenient because it contains a growable array. But there's no need for the environment abstraction when being used as a temporary holder for values of locals. Change-Id: Idf2883fe4b8f97a31ee70b3627c1bdd23ebfff0e --- compiler/optimizing/ssa_builder.h | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'compiler/optimizing/ssa_builder.h') diff --git a/compiler/optimizing/ssa_builder.h b/compiler/optimizing/ssa_builder.h index 265e95b4ac..1c83c4ba48 100644 --- a/compiler/optimizing/ssa_builder.h +++ b/compiler/optimizing/ssa_builder.h @@ -58,14 +58,15 @@ class SsaBuilder : public HGraphVisitor { void BuildSsa(); - HEnvironment* GetLocalsFor(HBasicBlock* block) { - HEnvironment* env = locals_for_.Get(block->GetBlockId()); - if (env == nullptr) { - env = new (GetGraph()->GetArena()) HEnvironment( + GrowableArray* GetLocalsFor(HBasicBlock* block) { + GrowableArray* locals = locals_for_.Get(block->GetBlockId()); + if (locals == nullptr) { + locals = new (GetGraph()->GetArena()) GrowableArray( GetGraph()->GetArena(), GetGraph()->GetNumberOfVRegs()); - locals_for_.Put(block->GetBlockId(), env); + locals->SetSize(GetGraph()->GetNumberOfVRegs()); + locals_for_.Put(block->GetBlockId(), locals); } - return env; + return locals; } HInstruction* ValueOfLocal(HBasicBlock* block, size_t local); @@ -93,14 +94,14 @@ class SsaBuilder : public HGraphVisitor { static HPhi* GetFloatDoubleOrReferenceEquivalentOfPhi(HPhi* phi, Primitive::Type type); // Locals for the current block being visited. - HEnvironment* current_locals_; + GrowableArray* current_locals_; // Keep track of loop headers found. The last phase of the analysis iterates // over these blocks to set the inputs of their phis. GrowableArray loop_headers_; // HEnvironment for each block. - GrowableArray locals_for_; + GrowableArray*> locals_for_; DISALLOW_COPY_AND_ASSIGN(SsaBuilder); }; -- cgit v1.2.3-59-g8ed1b