From 700a402244a1a423da4f3ba8032459f4b65fa18f Mon Sep 17 00:00:00 2001 From: Ian Rogers Date: Mon, 19 May 2014 16:49:03 -0700 Subject: Now we have a proper C++ library, use std::unique_ptr. Also remove the Android.libcxx.mk and other bits of stlport compatibility mechanics. Change-Id: Icdf7188ba3c79cdf5617672c1cfd0a68ae596a61 --- runtime/gc/accounting/atomic_stack.h | 6 +++--- runtime/gc/accounting/card_table.cc | 2 +- runtime/gc/accounting/card_table.h | 5 +++-- runtime/gc/accounting/gc_allocator.h | 2 +- runtime/gc/accounting/mod_union_table.cc | 3 ++- runtime/gc/accounting/mod_union_table.h | 4 ++-- runtime/gc/accounting/remembered_set.cc | 3 ++- runtime/gc/accounting/remembered_set.h | 2 +- runtime/gc/accounting/space_bitmap-inl.h | 3 ++- runtime/gc/accounting/space_bitmap.cc | 4 ++-- runtime/gc/accounting/space_bitmap.h | 14 +++++++------- runtime/gc/accounting/space_bitmap_test.cc | 8 ++++---- 12 files changed, 30 insertions(+), 26 deletions(-) (limited to 'runtime/gc/accounting') diff --git a/runtime/gc/accounting/atomic_stack.h b/runtime/gc/accounting/atomic_stack.h index 7d8b584fc9..f3ed8d32c0 100644 --- a/runtime/gc/accounting/atomic_stack.h +++ b/runtime/gc/accounting/atomic_stack.h @@ -18,12 +18,12 @@ #define ART_RUNTIME_GC_ACCOUNTING_ATOMIC_STACK_H_ #include +#include #include #include "atomic.h" #include "base/logging.h" #include "base/macros.h" -#include "UniquePtrCompat.h" #include "mem_map.h" #include "utils.h" @@ -36,7 +36,7 @@ class AtomicStack { public: // Capacity is how many elements we can store in the stack. static AtomicStack* Create(const std::string& name, size_t capacity) { - UniquePtr mark_stack(new AtomicStack(name, capacity)); + std::unique_ptr mark_stack(new AtomicStack(name, capacity)); mark_stack->Init(); return mark_stack.release(); } @@ -215,7 +215,7 @@ class AtomicStack { std::string name_; // Memory mapping of the atomic stack. - UniquePtr mem_map_; + std::unique_ptr mem_map_; // Back index (index after the last element pushed). AtomicInteger back_index_; diff --git a/runtime/gc/accounting/card_table.cc b/runtime/gc/accounting/card_table.cc index 714e6f7123..43a173e2be 100644 --- a/runtime/gc/accounting/card_table.cc +++ b/runtime/gc/accounting/card_table.cc @@ -55,7 +55,7 @@ CardTable* CardTable::Create(const byte* heap_begin, size_t heap_capacity) { size_t capacity = heap_capacity / kCardSize; /* Allocate an extra 256 bytes to allow fixed low-byte of base */ std::string error_msg; - UniquePtr mem_map(MemMap::MapAnonymous("card table", NULL, + std::unique_ptr mem_map(MemMap::MapAnonymous("card table", NULL, capacity + 256, PROT_READ | PROT_WRITE, false, &error_msg)); CHECK(mem_map.get() != NULL) << "couldn't allocate card table: " << error_msg; diff --git a/runtime/gc/accounting/card_table.h b/runtime/gc/accounting/card_table.h index 17e62a6153..7934974081 100644 --- a/runtime/gc/accounting/card_table.h +++ b/runtime/gc/accounting/card_table.h @@ -17,10 +17,11 @@ #ifndef ART_RUNTIME_GC_ACCOUNTING_CARD_TABLE_H_ #define ART_RUNTIME_GC_ACCOUNTING_CARD_TABLE_H_ +#include + #include "base/mutex.h" #include "globals.h" #include "mem_map.h" -#include "UniquePtrCompat.h" namespace art { @@ -141,7 +142,7 @@ class CardTable { void VerifyCardTable(); // Mmapped pages for the card table - UniquePtr mem_map_; + std::unique_ptr mem_map_; // Value used to compute card table addresses from object addresses, see GetBiasedBegin byte* const biased_begin_; // Card table doesn't begin at the beginning of the mem_map_, instead it is displaced by offset diff --git a/runtime/gc/accounting/gc_allocator.h b/runtime/gc/accounting/gc_allocator.h index 7dd7cca1fd..1d96112b0c 100644 --- a/runtime/gc/accounting/gc_allocator.h +++ b/runtime/gc/accounting/gc_allocator.h @@ -73,7 +73,7 @@ class GcAllocatorImpl : public std::allocator { // GCAllocatorImpl if kMeasureGCMemoryOverhead is true, std::allocator otherwise. template class GcAllocator : public TypeStaticIf, - std::allocator >::type { + std::allocator>::type { }; } // namespace accounting diff --git a/runtime/gc/accounting/mod_union_table.cc b/runtime/gc/accounting/mod_union_table.cc index ef5653a3bf..228d1dc668 100644 --- a/runtime/gc/accounting/mod_union_table.cc +++ b/runtime/gc/accounting/mod_union_table.cc @@ -16,6 +16,8 @@ #include "mod_union_table.h" +#include + #include "base/stl_util.h" #include "card_table-inl.h" #include "heap_bitmap.h" @@ -30,7 +32,6 @@ #include "mirror/object_array-inl.h" #include "space_bitmap-inl.h" #include "thread.h" -#include "UniquePtrCompat.h" using ::art::mirror::Object; diff --git a/runtime/gc/accounting/mod_union_table.h b/runtime/gc/accounting/mod_union_table.h index 5ae7c77c19..449e171b64 100644 --- a/runtime/gc/accounting/mod_union_table.h +++ b/runtime/gc/accounting/mod_union_table.h @@ -50,7 +50,7 @@ class HeapBitmap; // cleared between GC phases, reducing the number of dirty cards that need to be scanned. class ModUnionTable { public: - typedef std::set, GcAllocator > CardSet; + typedef std::set, GcAllocator> CardSet; explicit ModUnionTable(const std::string& name, Heap* heap, space::ContinuousSpace* space) : name_(name), @@ -126,7 +126,7 @@ class ModUnionTableReferenceCache : public ModUnionTable { // Maps from dirty cards to their corresponding alloc space references. SafeMap*>, std::less, - GcAllocator*> > > > + GcAllocator*>>> > references_; }; diff --git a/runtime/gc/accounting/remembered_set.cc b/runtime/gc/accounting/remembered_set.cc index 1def334a48..3ff5874854 100644 --- a/runtime/gc/accounting/remembered_set.cc +++ b/runtime/gc/accounting/remembered_set.cc @@ -16,6 +16,8 @@ #include "remembered_set.h" +#include + #include "base/stl_util.h" #include "card_table-inl.h" #include "heap_bitmap.h" @@ -30,7 +32,6 @@ #include "mirror/object_array-inl.h" #include "space_bitmap-inl.h" #include "thread.h" -#include "UniquePtrCompat.h" namespace art { namespace gc { diff --git a/runtime/gc/accounting/remembered_set.h b/runtime/gc/accounting/remembered_set.h index e3d853742f..706cf35dc0 100644 --- a/runtime/gc/accounting/remembered_set.h +++ b/runtime/gc/accounting/remembered_set.h @@ -43,7 +43,7 @@ namespace accounting { // from the free list spaces to the bump pointer spaces. class RememberedSet { public: - typedef std::set, GcAllocator > CardSet; + typedef std::set, GcAllocator> CardSet; explicit RememberedSet(const std::string& name, Heap* heap, space::ContinuousSpace* space) : name_(name), heap_(heap), space_(space) {} diff --git a/runtime/gc/accounting/space_bitmap-inl.h b/runtime/gc/accounting/space_bitmap-inl.h index a4394622e8..7f1da796b1 100644 --- a/runtime/gc/accounting/space_bitmap-inl.h +++ b/runtime/gc/accounting/space_bitmap-inl.h @@ -19,6 +19,8 @@ #include "space_bitmap.h" +#include + #include "base/logging.h" #include "dex_file-inl.h" #include "heap_bitmap.h" @@ -28,7 +30,6 @@ #include "mirror/object_array-inl.h" #include "object_utils.h" #include "space_bitmap-inl.h" -#include "UniquePtrCompat.h" #include "utils.h" namespace art { diff --git a/runtime/gc/accounting/space_bitmap.cc b/runtime/gc/accounting/space_bitmap.cc index 66f9a3a9ce..8e817e5bc5 100644 --- a/runtime/gc/accounting/space_bitmap.cc +++ b/runtime/gc/accounting/space_bitmap.cc @@ -51,7 +51,7 @@ SpaceBitmap* SpaceBitmap::Create( // Round up since heap_capacity is not necessarily a multiple of kAlignment * kBitsPerWord. const size_t bitmap_size = ComputeBitmapSize(heap_capacity); std::string error_msg; - UniquePtr mem_map(MemMap::MapAnonymous(name.c_str(), nullptr, bitmap_size, + std::unique_ptr mem_map(MemMap::MapAnonymous(name.c_str(), nullptr, bitmap_size, PROT_READ | PROT_WRITE, false, &error_msg)); if (UNLIKELY(mem_map.get() == nullptr)) { LOG(ERROR) << "Failed to allocate bitmap " << name << ": " << error_msg; @@ -226,7 +226,7 @@ void SpaceBitmap::WalkFieldsInOrder(SpaceBitmap* visited template void SpaceBitmap::InOrderWalk(ObjectCallback* callback, void* arg) { - UniquePtr> visited( + std::unique_ptr> visited( Create("bitmap for in-order walk", reinterpret_cast(heap_begin_), IndexToOffset(bitmap_size_ / kWordSize))); CHECK(bitmap_begin_ != nullptr); diff --git a/runtime/gc/accounting/space_bitmap.h b/runtime/gc/accounting/space_bitmap.h index 1ccebf53d9..50d15c613d 100644 --- a/runtime/gc/accounting/space_bitmap.h +++ b/runtime/gc/accounting/space_bitmap.h @@ -17,17 +17,17 @@ #ifndef ART_RUNTIME_GC_ACCOUNTING_SPACE_BITMAP_H_ #define ART_RUNTIME_GC_ACCOUNTING_SPACE_BITMAP_H_ +#include +#include +#include +#include +#include + #include "base/mutex.h" #include "gc_allocator.h" #include "globals.h" #include "mem_map.h" #include "object_callbacks.h" -#include "UniquePtrCompat.h" - -#include -#include -#include -#include namespace art { @@ -217,7 +217,7 @@ class SpaceBitmap { SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); // Backing storage for bitmap. - UniquePtr mem_map_; + std::unique_ptr mem_map_; // This bitmap itself, word sized for efficiency in scanning. uword* const bitmap_begin_; diff --git a/runtime/gc/accounting/space_bitmap_test.cc b/runtime/gc/accounting/space_bitmap_test.cc index 71db44bad2..a30bb253e3 100644 --- a/runtime/gc/accounting/space_bitmap_test.cc +++ b/runtime/gc/accounting/space_bitmap_test.cc @@ -17,11 +17,11 @@ #include "space_bitmap.h" #include +#include #include "common_runtime_test.h" #include "globals.h" #include "space_bitmap-inl.h" -#include "UniquePtrCompat.h" namespace art { namespace gc { @@ -32,7 +32,7 @@ class SpaceBitmapTest : public CommonRuntimeTest {}; TEST_F(SpaceBitmapTest, Init) { byte* heap_begin = reinterpret_cast(0x10000000); size_t heap_capacity = 16 * MB; - UniquePtr space_bitmap( + std::unique_ptr space_bitmap( ContinuousSpaceBitmap::Create("test bitmap", heap_begin, heap_capacity)); EXPECT_TRUE(space_bitmap.get() != NULL); } @@ -60,7 +60,7 @@ TEST_F(SpaceBitmapTest, ScanRange) { byte* heap_begin = reinterpret_cast(0x10000000); size_t heap_capacity = 16 * MB; - UniquePtr space_bitmap( + std::unique_ptr space_bitmap( ContinuousSpaceBitmap::Create("test bitmap", heap_begin, heap_capacity)); EXPECT_TRUE(space_bitmap.get() != NULL); @@ -120,7 +120,7 @@ void RunTest() NO_THREAD_SAFETY_ANALYSIS { for (int i = 0; i < 5 ; ++i) { - UniquePtr space_bitmap( + std::unique_ptr space_bitmap( ContinuousSpaceBitmap::Create("test bitmap", heap_begin, heap_capacity)); for (int j = 0; j < 10000; ++j) { -- cgit v1.2.3