summaryrefslogtreecommitdiffstats
path: root/runtime/gc/accounting
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2014-05-19 16:49:03 -0700
committerIan Rogers <irogers@google.com>2014-05-19 22:27:39 -0700
commit700a402244a1a423da4f3ba8032459f4b65fa18f (patch)
tree4c22fcda04d271bd55a37aff30650214af17a90c /runtime/gc/accounting
parent047c11adcbcbc0bcf210defdfcbada763961ffee (diff)
downloadandroid_art-700a402244a1a423da4f3ba8032459f4b65fa18f.tar.gz
android_art-700a402244a1a423da4f3ba8032459f4b65fa18f.tar.bz2
android_art-700a402244a1a423da4f3ba8032459f4b65fa18f.zip
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
Diffstat (limited to 'runtime/gc/accounting')
-rw-r--r--runtime/gc/accounting/atomic_stack.h6
-rw-r--r--runtime/gc/accounting/card_table.cc2
-rw-r--r--runtime/gc/accounting/card_table.h5
-rw-r--r--runtime/gc/accounting/gc_allocator.h2
-rw-r--r--runtime/gc/accounting/mod_union_table.cc3
-rw-r--r--runtime/gc/accounting/mod_union_table.h4
-rw-r--r--runtime/gc/accounting/remembered_set.cc3
-rw-r--r--runtime/gc/accounting/remembered_set.h2
-rw-r--r--runtime/gc/accounting/space_bitmap-inl.h3
-rw-r--r--runtime/gc/accounting/space_bitmap.cc4
-rw-r--r--runtime/gc/accounting/space_bitmap.h14
-rw-r--r--runtime/gc/accounting/space_bitmap_test.cc8
12 files changed, 30 insertions, 26 deletions
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 <algorithm>
+#include <memory>
#include <string>
#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<AtomicStack> mark_stack(new AtomicStack(name, capacity));
+ std::unique_ptr<AtomicStack> 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<MemMap> mem_map_;
+ std::unique_ptr<MemMap> 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<MemMap> mem_map(MemMap::MapAnonymous("card table", NULL,
+ std::unique_ptr<MemMap> 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 <memory>
+
#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<MemMap> mem_map_;
+ std::unique_ptr<MemMap> 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<T> {
// GCAllocatorImpl<T> if kMeasureGCMemoryOverhead is true, std::allocator<T> otherwise.
template <typename T>
class GcAllocator : public TypeStaticIf<kMeasureGcMemoryOverhead, GcAllocatorImpl<T>,
- std::allocator<T> >::type {
+ std::allocator<T>>::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 <memory>
+
#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<byte*, std::less<byte*>, GcAllocator<byte*> > CardSet;
+ typedef std::set<byte*, std::less<byte*>, GcAllocator<byte*>> 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<const byte*, std::vector<mirror::HeapReference<mirror::Object>*>, std::less<const byte*>,
- GcAllocator<std::pair<const byte*, std::vector<mirror::HeapReference<mirror::Object>*> > > >
+ GcAllocator<std::pair<const byte*, std::vector<mirror::HeapReference<mirror::Object>*>>> >
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 <memory>
+
#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<byte*, std::less<byte*>, GcAllocator<byte*> > CardSet;
+ typedef std::set<byte*, std::less<byte*>, GcAllocator<byte*>> 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 <memory>
+
#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<kAlignment>* SpaceBitmap<kAlignment>::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<MemMap> mem_map(MemMap::MapAnonymous(name.c_str(), nullptr, bitmap_size,
+ std::unique_ptr<MemMap> 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<kAlignment>::WalkFieldsInOrder(SpaceBitmap<kAlignment>* visited
template<size_t kAlignment>
void SpaceBitmap<kAlignment>::InOrderWalk(ObjectCallback* callback, void* arg) {
- UniquePtr<SpaceBitmap<kAlignment>> visited(
+ std::unique_ptr<SpaceBitmap<kAlignment>> visited(
Create("bitmap for in-order walk", reinterpret_cast<byte*>(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 <limits.h>
+#include <stdint.h>
+#include <memory>
+#include <set>
+#include <vector>
+
#include "base/mutex.h"
#include "gc_allocator.h"
#include "globals.h"
#include "mem_map.h"
#include "object_callbacks.h"
-#include "UniquePtrCompat.h"
-
-#include <limits.h>
-#include <set>
-#include <stdint.h>
-#include <vector>
namespace art {
@@ -217,7 +217,7 @@ class SpaceBitmap {
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
// Backing storage for bitmap.
- UniquePtr<MemMap> mem_map_;
+ std::unique_ptr<MemMap> 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 <stdint.h>
+#include <memory>
#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<byte*>(0x10000000);
size_t heap_capacity = 16 * MB;
- UniquePtr<ContinuousSpaceBitmap> space_bitmap(
+ std::unique_ptr<ContinuousSpaceBitmap> 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<byte*>(0x10000000);
size_t heap_capacity = 16 * MB;
- UniquePtr<ContinuousSpaceBitmap> space_bitmap(
+ std::unique_ptr<ContinuousSpaceBitmap> 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<ContinuousSpaceBitmap> space_bitmap(
+ std::unique_ptr<ContinuousSpaceBitmap> space_bitmap(
ContinuousSpaceBitmap::Create("test bitmap", heap_begin, heap_capacity));
for (int j = 0; j < 10000; ++j) {