diff options
author | 2015-10-15 17:47:48 -0700 | |
---|---|---|
committer | 2015-10-23 11:21:11 -0700 | |
commit | e5d80f83ae53792bc1eebd4e33e4e99f7c031b0c (patch) | |
tree | cc21ac068a5d02349c5b1aaa8c7f61ae777f6cea /compiler | |
parent | a815f17cc82f4f238d8bdec1bd5b70fec720541e (diff) |
Move ArenaBitVector into the runtime
Motivation is using arenas in the verifier.
Bug: 10921004
Change-Id: I3c7ed369194b2309a47b12a621e897e0f2f65fcf
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/Android.mk | 1 | ||||
-rw-r--r-- | compiler/dex/gvn_dead_code_elimination.cc | 2 | ||||
-rw-r--r-- | compiler/dex/mir_graph.h | 2 | ||||
-rw-r--r-- | compiler/optimizing/gvn.cc | 2 | ||||
-rw-r--r-- | compiler/optimizing/nodes.h | 2 | ||||
-rw-r--r-- | compiler/optimizing/stack_map_test.cc | 3 | ||||
-rw-r--r-- | compiler/utils/arena_allocator_test.cc | 2 | ||||
-rw-r--r-- | compiler/utils/arena_bit_vector.cc | 56 | ||||
-rw-r--r-- | compiler/utils/arena_bit_vector.h | 68 |
9 files changed, 7 insertions, 131 deletions
diff --git a/compiler/Android.mk b/compiler/Android.mk index 58f70faca9..17f9d122a7 100644 --- a/compiler/Android.mk +++ b/compiler/Android.mk @@ -94,7 +94,6 @@ LIBART_COMPILER_SRC_FILES := \ optimizing/ssa_phi_elimination.cc \ optimizing/stack_map_stream.cc \ trampolines/trampoline_compiler.cc \ - utils/arena_bit_vector.cc \ utils/assembler.cc \ utils/swap_space.cc \ buffered_output_stream.cc \ diff --git a/compiler/dex/gvn_dead_code_elimination.cc b/compiler/dex/gvn_dead_code_elimination.cc index 4de3410616..445859cc78 100644 --- a/compiler/dex/gvn_dead_code_elimination.cc +++ b/compiler/dex/gvn_dead_code_elimination.cc @@ -18,6 +18,7 @@ #include "gvn_dead_code_elimination.h" +#include "base/arena_bit_vector.h" #include "base/bit_vector-inl.h" #include "base/macros.h" #include "base/allocator.h" @@ -26,7 +27,6 @@ #include "dex_instruction.h" #include "dex/mir_graph.h" #include "local_value_numbering.h" -#include "utils/arena_bit_vector.h" namespace art { diff --git a/compiler/dex/mir_graph.h b/compiler/dex/mir_graph.h index 097abdc018..2da8a98f00 100644 --- a/compiler/dex/mir_graph.h +++ b/compiler/dex/mir_graph.h @@ -19,6 +19,7 @@ #include <stdint.h> +#include "base/arena_bit_vector.h" #include "base/arena_containers.h" #include "base/bit_utils.h" #include "base/scoped_arena_containers.h" @@ -30,7 +31,6 @@ #include "mir_method_info.h" #include "reg_location.h" #include "reg_storage.h" -#include "utils/arena_bit_vector.h" namespace art { diff --git a/compiler/optimizing/gvn.cc b/compiler/optimizing/gvn.cc index 0a1758a936..c36de84064 100644 --- a/compiler/optimizing/gvn.cc +++ b/compiler/optimizing/gvn.cc @@ -16,11 +16,11 @@ #include "gvn.h" +#include "base/arena_bit_vector.h" #include "base/arena_containers.h" #include "base/bit_vector-inl.h" #include "side_effects_analysis.h" #include "utils.h" -#include "utils/arena_bit_vector.h" namespace art { diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h index cadb24c659..7aa933ddf0 100644 --- a/compiler/optimizing/nodes.h +++ b/compiler/optimizing/nodes.h @@ -21,6 +21,7 @@ #include <array> #include <type_traits> +#include "base/arena_bit_vector.h" #include "base/arena_containers.h" #include "base/arena_object.h" #include "base/stl_util.h" @@ -34,7 +35,6 @@ #include "mirror/class.h" #include "offsets.h" #include "primitive.h" -#include "utils/arena_bit_vector.h" namespace art { diff --git a/compiler/optimizing/stack_map_test.cc b/compiler/optimizing/stack_map_test.cc index c4a3b28aed..560502fde6 100644 --- a/compiler/optimizing/stack_map_test.cc +++ b/compiler/optimizing/stack_map_test.cc @@ -15,8 +15,9 @@ */ #include "stack_map.h" + +#include "base/arena_bit_vector.h" #include "stack_map_stream.h" -#include "utils/arena_bit_vector.h" #include "gtest/gtest.h" diff --git a/compiler/utils/arena_allocator_test.cc b/compiler/utils/arena_allocator_test.cc index 706552739f..7f67ef14bd 100644 --- a/compiler/utils/arena_allocator_test.cc +++ b/compiler/utils/arena_allocator_test.cc @@ -15,8 +15,8 @@ */ #include "base/arena_allocator.h" +#include "base/arena_bit_vector.h" #include "gtest/gtest.h" -#include "utils/arena_bit_vector.h" namespace art { diff --git a/compiler/utils/arena_bit_vector.cc b/compiler/utils/arena_bit_vector.cc deleted file mode 100644 index fbbfd84fcf..0000000000 --- a/compiler/utils/arena_bit_vector.cc +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "arena_bit_vector.h" - -#include "base/allocator.h" -#include "base/arena_allocator.h" - -namespace art { - -template <typename ArenaAlloc> -class ArenaBitVectorAllocator FINAL : public Allocator, - public ArenaObject<kArenaAllocGrowableBitMap> { - public: - explicit ArenaBitVectorAllocator(ArenaAlloc* arena) : arena_(arena) {} - ~ArenaBitVectorAllocator() {} - - virtual void* Alloc(size_t size) { - return arena_->Alloc(size, kArenaAllocGrowableBitMap); - } - - virtual void Free(void*) {} // Nop. - - private: - ArenaAlloc* const arena_; - DISALLOW_COPY_AND_ASSIGN(ArenaBitVectorAllocator); -}; - -ArenaBitVector::ArenaBitVector(ArenaAllocator* arena, unsigned int start_bits, - bool expandable, OatBitMapKind kind) - : BitVector(start_bits, expandable, - new (arena) ArenaBitVectorAllocator<ArenaAllocator>(arena)), kind_(kind) { - UNUSED(kind_); -} - -ArenaBitVector::ArenaBitVector(ScopedArenaAllocator* arena, unsigned int start_bits, - bool expandable, OatBitMapKind kind) - : BitVector(start_bits, expandable, - new (arena) ArenaBitVectorAllocator<ScopedArenaAllocator>(arena)), kind_(kind) { - UNUSED(kind_); -} - -} // namespace art diff --git a/compiler/utils/arena_bit_vector.h b/compiler/utils/arena_bit_vector.h deleted file mode 100644 index f2a74527da..0000000000 --- a/compiler/utils/arena_bit_vector.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (C) 2013 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ART_COMPILER_UTILS_ARENA_BIT_VECTOR_H_ -#define ART_COMPILER_UTILS_ARENA_BIT_VECTOR_H_ - -#include "base/arena_object.h" -#include "base/bit_vector.h" - -namespace art { - -class ArenaAllocator; -class ScopedArenaAllocator; - -// Type of growable bitmap for memory tuning. -enum OatBitMapKind { - kBitMapMisc = 0, - kBitMapUse, - kBitMapDef, - kBitMapLiveIn, - kBitMapBMatrix, - kBitMapDominators, - kBitMapIDominated, - kBitMapDomFrontier, - kBitMapRegisterV, - kBitMapTempSSARegisterV, - kBitMapNullCheck, - kBitMapClInitCheck, - kBitMapPredecessors, - kNumBitMapKinds -}; - -std::ostream& operator<<(std::ostream& os, const OatBitMapKind& kind); - -/* - * A BitVector implementation that uses Arena allocation. - */ -class ArenaBitVector : public BitVector, public ArenaObject<kArenaAllocGrowableBitMap> { - public: - ArenaBitVector(ArenaAllocator* arena, uint32_t start_bits, bool expandable, - OatBitMapKind kind = kBitMapMisc); - ArenaBitVector(ScopedArenaAllocator* arena, uint32_t start_bits, bool expandable, - OatBitMapKind kind = kBitMapMisc); - ~ArenaBitVector() {} - - private: - const OatBitMapKind kind_; // for memory use tuning. TODO: currently unused. - - DISALLOW_COPY_AND_ASSIGN(ArenaBitVector); -}; - - -} // namespace art - -#endif // ART_COMPILER_UTILS_ARENA_BIT_VECTOR_H_ |