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/builder.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'compiler/optimizing/builder.h') diff --git a/compiler/optimizing/builder.h b/compiler/optimizing/builder.h index ae452f2589..8d40d69a32 100644 --- a/compiler/optimizing/builder.h +++ b/compiler/optimizing/builder.h @@ -17,6 +17,7 @@ #ifndef ART_COMPILER_OPTIMIZING_BUILDER_H_ #define ART_COMPILER_OPTIMIZING_BUILDER_H_ +#include "base/arena_containers.h" #include "base/arena_object.h" #include "dex_file.h" #include "dex_file-inl.h" @@ -24,7 +25,6 @@ #include "driver/dex_compilation_unit.h" #include "optimizing_compiler_stats.h" #include "primitive.h" -#include "utils/growable_array.h" #include "nodes.h" namespace art { @@ -43,8 +43,8 @@ class HGraphBuilder : public ValueObject { const uint8_t* interpreter_metadata, Handle dex_cache) : arena_(graph->GetArena()), - branch_targets_(graph->GetArena(), 0), - locals_(graph->GetArena(), 0), + branch_targets_(graph->GetArena()->Adapter(kArenaAllocGraphBuilder)), + locals_(graph->GetArena()->Adapter(kArenaAllocGraphBuilder)), entry_block_(nullptr), exit_block_(nullptr), current_block_(nullptr), @@ -64,8 +64,8 @@ class HGraphBuilder : public ValueObject { // Only for unit testing. HGraphBuilder(HGraph* graph, Primitive::Type return_type = Primitive::kPrimInt) : arena_(graph->GetArena()), - branch_targets_(graph->GetArena(), 0), - locals_(graph->GetArena(), 0), + branch_targets_(graph->GetArena()->Adapter(kArenaAllocGraphBuilder)), + locals_(graph->GetArena()->Adapter(kArenaAllocGraphBuilder)), entry_block_(nullptr), exit_block_(nullptr), current_block_(nullptr), @@ -130,9 +130,9 @@ class HGraphBuilder : public ValueObject { uint16_t LookupQuickenedInfo(uint32_t dex_pc); void InitializeLocals(uint16_t count); - HLocal* GetLocalAt(int register_index) const; - void UpdateLocal(int register_index, HInstruction* instruction, uint32_t dex_pc) const; - HInstruction* LoadLocal(int register_index, Primitive::Type type, uint32_t dex_pc) const; + HLocal* GetLocalAt(uint32_t register_index) const; + void UpdateLocal(uint32_t register_index, HInstruction* instruction, uint32_t dex_pc) const; + HInstruction* LoadLocal(uint32_t register_index, Primitive::Type type, uint32_t dex_pc) const; void PotentiallyAddSuspendCheck(HBasicBlock* target, uint32_t dex_pc); void InitializeParameters(uint16_t number_of_parameters); bool NeedsAccessCheck(uint32_t type_index) const; @@ -304,9 +304,9 @@ class HGraphBuilder : public ValueObject { // A list of the size of the dex code holding block information for // the method. If an entry contains a block, then the dex instruction // starting at that entry is the first instruction of a new block. - GrowableArray branch_targets_; + ArenaVector branch_targets_; - GrowableArray locals_; + ArenaVector locals_; HBasicBlock* entry_block_; HBasicBlock* exit_block_; -- cgit v1.2.3-59-g8ed1b