From 2aaa4b5532d30c4e65d8892b556400bb61f9dc8c Mon Sep 17 00:00:00 2001 From: Vladimir Marko Date: Thu, 17 Sep 2015 17:03:26 +0100 Subject: Optimizing: Tag more arena allocations. Replace GrowableArray with ArenaVector and tag arena allocations with new allocation types. As part of this, make the register allocator a bit more efficient, doing bulk insert/erase. Some loops are now O(n) instead of O(n^2). Change-Id: Ifac0871ffb34b121cc0447801a2d07eefd308c14 --- compiler/optimizing/side_effects_analysis.cc | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'compiler/optimizing/side_effects_analysis.cc') diff --git a/compiler/optimizing/side_effects_analysis.cc b/compiler/optimizing/side_effects_analysis.cc index 1956781b79..338a3aaad0 100644 --- a/compiler/optimizing/side_effects_analysis.cc +++ b/compiler/optimizing/side_effects_analysis.cc @@ -21,8 +21,8 @@ namespace art { void SideEffectsAnalysis::Run() { // Inlining might have created more blocks, so we need to increase the size // if needed. - block_effects_.SetSize(graph_->GetBlocks().size()); - loop_effects_.SetSize(graph_->GetBlocks().size()); + block_effects_.resize(graph_->GetBlocks().size()); + loop_effects_.resize(graph_->GetBlocks().size()); // In DEBUG mode, ensure side effects are properly initialized to empty. if (kIsDebugBuild) { @@ -54,7 +54,7 @@ void SideEffectsAnalysis::Run() { } } - block_effects_.Put(block->GetBlockId(), effects); + block_effects_[block->GetBlockId()] = effects; if (block->IsLoopHeader()) { // The side effects of the loop header are part of the loop. @@ -76,16 +76,19 @@ void SideEffectsAnalysis::Run() { SideEffects SideEffectsAnalysis::GetLoopEffects(HBasicBlock* block) const { DCHECK(block->IsLoopHeader()); - return loop_effects_.Get(block->GetBlockId()); + DCHECK_LT(block->GetBlockId(), loop_effects_.size()); + return loop_effects_[block->GetBlockId()]; } SideEffects SideEffectsAnalysis::GetBlockEffects(HBasicBlock* block) const { - return block_effects_.Get(block->GetBlockId()); + DCHECK_LT(block->GetBlockId(), block_effects_.size()); + return block_effects_[block->GetBlockId()]; } void SideEffectsAnalysis::UpdateLoopEffects(HLoopInformation* info, SideEffects effects) { - int id = info->GetHeader()->GetBlockId(); - loop_effects_.Put(id, loop_effects_.Get(id).Union(effects)); + uint32_t id = info->GetHeader()->GetBlockId(); + DCHECK_LT(id, loop_effects_.size()); + loop_effects_[id] = loop_effects_[id].Union(effects); } } // namespace art -- cgit v1.2.3-59-g8ed1b