Move ArenaBitVector into the runtime
Motivation is using arenas in the verifier.
Bug: 10921004
Change-Id: I3c7ed369194b2309a47b12a621e897e0f2f65fcf
diff --git a/compiler/Android.mk b/compiler/Android.mk
index 58f70fa..17f9d12 100644
--- a/compiler/Android.mk
+++ b/compiler/Android.mk
@@ -94,7 +94,6 @@
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 4de3410..445859c 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 097abdc..2da8a98 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 0a1758a..c36de84 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 cadb24c..7aa933d 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 c4a3b28..560502f 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 7065527..7f67ef1 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 fbbfd84..0000000
--- 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 f2a7452..0000000
--- 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_