diff options
author | 2015-01-23 10:39:45 +0000 | |
---|---|---|
committer | 2015-01-26 16:13:57 +0000 | |
commit | ed59619b370ef23ffbb25d1d01f615e60a9262b6 (patch) | |
tree | 6c93bb6ceff95f7aaf232825e050eecc05c7282d /compiler/optimizing/ssa_builder.cc | |
parent | f90eec005997f98c1a9f874fbbf68414e5f9c766 (diff) |
Optimizing: Speed up HEnvironment use removal
Removal of use records from HEnvironment vregs involved iterating over
potentially large linked lists which made compilation of huge methods
very slow. This patch turns use lists into doubly-linked lists, stores
pointers to the relevant nodes inside HEnvironment and subsequently
turns the removals into constant-time operations.
Change-Id: I0e1d4d782fd624e7b8075af75d4adf0a0634a1ee
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 edfafcdd83..4f9c3b87c1 100644 --- a/compiler/optimizing/ssa_builder.cc +++ b/compiler/optimizing/ssa_builder.cc @@ -68,7 +68,7 @@ void SsaBuilder::BuildSsa() { } HInstruction* SsaBuilder::ValueOfLocal(HBasicBlock* block, size_t local) { - return GetLocalsFor(block)->Get(local); + return GetLocalsFor(block)->GetInstructionAt(local); } void SsaBuilder::VisitBasicBlock(HBasicBlock* block) { @@ -85,7 +85,7 @@ void SsaBuilder::VisitBasicBlock(HBasicBlock* block) { HPhi* phi = new (GetGraph()->GetArena()) HPhi( GetGraph()->GetArena(), local, 0, Primitive::kPrimVoid); block->AddPhi(phi); - current_locals_->Put(local, phi); + current_locals_->SetRawEnvAt(local, phi); } } // Save the loop header so that the last phase of the analysis knows which @@ -125,7 +125,7 @@ void SsaBuilder::VisitBasicBlock(HBasicBlock* block) { block->AddPhi(phi); value = phi; } - current_locals_->Put(local, value); + current_locals_->SetRawEnvAt(local, value); } } @@ -235,7 +235,7 @@ HInstruction* SsaBuilder::GetFloatOrDoubleEquivalent(HInstruction* user, } void SsaBuilder::VisitLoadLocal(HLoadLocal* load) { - HInstruction* value = current_locals_->Get(load->GetLocal()->GetRegNumber()); + HInstruction* value = current_locals_->GetInstructionAt(load->GetLocal()->GetRegNumber()); if (load->GetType() != value->GetType() && (load->GetType() == Primitive::kPrimFloat || load->GetType() == Primitive::kPrimDouble)) { // If the operation requests a specific type, we make sure its input is of that type. @@ -246,7 +246,7 @@ void SsaBuilder::VisitLoadLocal(HLoadLocal* load) { } void SsaBuilder::VisitStoreLocal(HStoreLocal* store) { - current_locals_->Put(store->GetLocal()->GetRegNumber(), store->InputAt(1)); + current_locals_->SetRawEnvAt(store->GetLocal()->GetRegNumber(), store->InputAt(1)); store->GetBlock()->RemoveInstruction(store); } @@ -256,7 +256,7 @@ void SsaBuilder::VisitInstruction(HInstruction* instruction) { } HEnvironment* environment = new (GetGraph()->GetArena()) HEnvironment( GetGraph()->GetArena(), current_locals_->Size()); - environment->Populate(*current_locals_); + environment->CopyFrom(current_locals_); instruction->SetEnvironment(environment); } |