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
diff --git a/runtime/Android.mk b/runtime/Android.mk
index bb79198..a64e137 100644
--- a/runtime/Android.mk
+++ b/runtime/Android.mk
@@ -353,8 +353,6 @@
LOCAL_IS_HOST_MODULE := true
endif
- include art/build/Android.libcxx.mk
-
GENERATED_SRC_DIR := $$(call local-generated-sources-dir)
ENUM_OPERATOR_OUT_CC_FILES := $$(patsubst %.h,%_operator_out.cc,$$(LIBART_ENUM_OPERATOR_OUT_HEADER_FILES))
ENUM_OPERATOR_OUT_GEN := $$(addprefix $$(GENERATED_SRC_DIR)/,$$(ENUM_OPERATOR_OUT_CC_FILES))
@@ -399,6 +397,7 @@
LOCAL_C_INCLUDES += $(ART_C_INCLUDES)
LOCAL_SHARED_LIBRARIES += liblog libnativehelper
ifeq ($$(art_target_or_host),target)
+ include external/libcxx/libcxx.mk
LOCAL_SHARED_LIBRARIES += libbacktrace_libc++
else
LOCAL_SHARED_LIBRARIES += libbacktrace
diff --git a/runtime/UniquePtrCompat.h b/runtime/UniquePtrCompat.h
deleted file mode 100644
index 4a45616..0000000
--- a/runtime/UniquePtrCompat.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2014 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_RUNTIME_UNIQUEPTRCOMPAT_H_
-#define ART_RUNTIME_UNIQUEPTRCOMPAT_H_
-
-// Stlport doesn't declare std::unique_ptr. UniquePtr.h declares an incompatible std::swap
-// prototype with libc++. This compatibility header file resolves differences between the two, in
-// the future UniquePtr will become std::unique_ptr.
-
-#ifdef ART_WITH_STLPORT
-
-#include "UniquePtr.h"
-
-#else // ART_WITH_STLPORT
-
-#include <memory>
-
-template <typename T>
-using UniquePtr = typename std::unique_ptr<T>;
-
-#endif // ART_WITH_STLPORT
-
-#endif // ART_RUNTIME_UNIQUEPTRCOMPAT_H_
diff --git a/runtime/arch/stub_test.cc b/runtime/arch/stub_test.cc
index d9bc105..32f313f 100644
--- a/runtime/arch/stub_test.cc
+++ b/runtime/arch/stub_test.cc
@@ -843,7 +843,7 @@
// Use arbitrary large amount for now.
static const size_t kMaxHandles = 1000000;
- UniquePtr<StackHandleScope<kMaxHandles> > hsp(new StackHandleScope<kMaxHandles>(self));
+ std::unique_ptr<StackHandleScope<kMaxHandles>> hsp(new StackHandleScope<kMaxHandles>(self));
std::vector<Handle<mirror::Object>> handles;
// Start allocating with 128K
diff --git a/runtime/barrier.h b/runtime/barrier.h
index d3e6bae..a433cac 100644
--- a/runtime/barrier.h
+++ b/runtime/barrier.h
@@ -17,8 +17,8 @@
#ifndef ART_RUNTIME_BARRIER_H_
#define ART_RUNTIME_BARRIER_H_
+#include <memory>
#include "base/mutex.h"
-#include "UniquePtrCompat.h"
namespace art {
diff --git a/runtime/barrier_test.cc b/runtime/barrier_test.cc
index a02c4c7..331d0c0 100644
--- a/runtime/barrier_test.cc
+++ b/runtime/barrier_test.cc
@@ -22,7 +22,6 @@
#include "common_runtime_test.h"
#include "mirror/object_array-inl.h"
#include "thread_pool.h"
-#include "UniquePtrCompat.h"
namespace art {
class CheckWaitTask : public Task {
diff --git a/runtime/base/bit_vector_test.cc b/runtime/base/bit_vector_test.cc
index 990d1db..0f866a4 100644
--- a/runtime/base/bit_vector_test.cc
+++ b/runtime/base/bit_vector_test.cc
@@ -14,7 +14,8 @@
* limitations under the License.
*/
-#include "UniquePtrCompat.h"
+#include <memory>
+
#include "bit_vector.h"
#include "gtest/gtest.h"
@@ -40,7 +41,7 @@
BitVector::Iterator empty_iterator(&bv);
EXPECT_EQ(-1, empty_iterator.Next());
- UniquePtr<BitVector::Iterator> empty_iterator_on_heap(bv.GetIterator());
+ std::unique_ptr<BitVector::Iterator> empty_iterator_on_heap(bv.GetIterator());
EXPECT_EQ(-1, empty_iterator_on_heap->Next());
bv.SetBit(0);
diff --git a/runtime/base/histogram_test.cc b/runtime/base/histogram_test.cc
index d72ae47..454f2ab 100644
--- a/runtime/base/histogram_test.cc
+++ b/runtime/base/histogram_test.cc
@@ -14,11 +14,11 @@
* limitations under the License.
*/
+#include <memory>
+#include <sstream>
+
#include "gtest/gtest.h"
#include "histogram-inl.h"
-#include "UniquePtrCompat.h"
-
-#include <sstream>
namespace art {
@@ -34,7 +34,7 @@
// PerValue = hist->PercentileVal(0.50); finds the 50th percentile(median).
TEST(Histtest, MeanTest) {
- UniquePtr<Histogram<uint64_t> > hist(new Histogram<uint64_t>("MeanTest", 5));
+ std::unique_ptr<Histogram<uint64_t>> hist(new Histogram<uint64_t>("MeanTest", 5));
double mean;
for (size_t Idx = 0; Idx < 90; Idx++) {
@@ -52,7 +52,7 @@
}
TEST(Histtest, VarianceTest) {
- UniquePtr<Histogram<uint64_t> > hist(new Histogram<uint64_t>("VarianceTest", 5));
+ std::unique_ptr<Histogram<uint64_t>> hist(new Histogram<uint64_t>("VarianceTest", 5));
double variance;
hist->AddValue(9);
@@ -64,7 +64,7 @@
}
TEST(Histtest, Percentile) {
- UniquePtr<Histogram<uint64_t> > hist(new Histogram<uint64_t>("Percentile", 5));
+ std::unique_ptr<Histogram<uint64_t>> hist(new Histogram<uint64_t>("Percentile", 5));
Histogram<uint64_t>::CumulativeData data;
double PerValue;
@@ -91,7 +91,7 @@
}
TEST(Histtest, UpdateRange) {
- UniquePtr<Histogram<uint64_t> > hist(new Histogram<uint64_t>("UpdateRange", 5));
+ std::unique_ptr<Histogram<uint64_t>> hist(new Histogram<uint64_t>("UpdateRange", 5));
Histogram<uint64_t>::CumulativeData data;
double PerValue;
@@ -131,7 +131,7 @@
}
TEST(Histtest, Reset) {
- UniquePtr<Histogram<uint64_t> > hist(new Histogram<uint64_t>("Reset", 5));
+ std::unique_ptr<Histogram<uint64_t>> hist(new Histogram<uint64_t>("Reset", 5));
double PerValue;
hist->AddValue(0);
@@ -174,7 +174,7 @@
}
TEST(Histtest, MultipleCreateHist) {
- UniquePtr<Histogram<uint64_t> > hist(new Histogram<uint64_t>("MultipleCreateHist", 5));
+ std::unique_ptr<Histogram<uint64_t>> hist(new Histogram<uint64_t>("MultipleCreateHist", 5));
Histogram<uint64_t>::CumulativeData data;
double PerValue;
@@ -213,7 +213,7 @@
}
TEST(Histtest, SingleValue) {
- UniquePtr<Histogram<uint64_t> > hist(new Histogram<uint64_t>("SingleValue", 5));
+ std::unique_ptr<Histogram<uint64_t>> hist(new Histogram<uint64_t>("SingleValue", 5));
Histogram<uint64_t>::CumulativeData data;
hist->AddValue(1);
@@ -225,7 +225,7 @@
}
TEST(Histtest, CappingPercentiles) {
- UniquePtr<Histogram<uint64_t> > hist(new Histogram<uint64_t>("CappingPercentiles", 5));
+ std::unique_ptr<Histogram<uint64_t>> hist(new Histogram<uint64_t>("CappingPercentiles", 5));
Histogram<uint64_t>::CumulativeData data;
double per_995;
@@ -251,7 +251,7 @@
}
TEST(Histtest, SpikyValues) {
- UniquePtr<Histogram<uint64_t> > hist(new Histogram<uint64_t>("SpikyValues", 5, 4096));
+ std::unique_ptr<Histogram<uint64_t>> hist(new Histogram<uint64_t>("SpikyValues", 5, 4096));
Histogram<uint64_t>::CumulativeData data;
for (uint64_t idx = 0ull; idx < 30ull; idx++) {
diff --git a/runtime/base/logging.cc b/runtime/base/logging.cc
index b6c6b9b..b2ad1d0 100644
--- a/runtime/base/logging.cc
+++ b/runtime/base/logging.cc
@@ -19,7 +19,6 @@
#include "base/mutex.h"
#include "runtime.h"
#include "thread-inl.h"
-#include "UniquePtrCompat.h"
#include "utils.h"
namespace art {
@@ -31,9 +30,9 @@
unsigned int gAborting = 0;
static LogSeverity gMinimumLogSeverity = INFO;
-static UniquePtr<std::string> gCmdLine;
-static UniquePtr<std::string> gProgramInvocationName;
-static UniquePtr<std::string> gProgramInvocationShortName;
+static std::unique_ptr<std::string> gCmdLine;
+static std::unique_ptr<std::string> gProgramInvocationName;
+static std::unique_ptr<std::string> gProgramInvocationShortName;
const char* GetCmdLine() {
return (gCmdLine.get() != nullptr) ? gCmdLine->c_str() : nullptr;
diff --git a/runtime/base/logging.h b/runtime/base/logging.h
index 7800cfe..814195c 100644
--- a/runtime/base/logging.h
+++ b/runtime/base/logging.h
@@ -20,12 +20,13 @@
#include <cerrno>
#include <cstring>
#include <iostream> // NOLINT
+#include <memory>
#include <sstream>
#include <signal.h>
#include <vector>
+
#include "base/macros.h"
#include "log_severity.h"
-#include "UniquePtrCompat.h"
#define CHECK(x) \
if (UNLIKELY(!(x))) \
@@ -202,7 +203,7 @@
private:
static void LogLine(const LogMessageData& data, const char*);
- const UniquePtr<LogMessageData> data_;
+ const std::unique_ptr<LogMessageData> data_;
friend void HandleUnexpectedSignal(int signal_number, siginfo_t* info, void* raw_context);
friend class Mutex;
diff --git a/runtime/base/unix_file/random_access_file_test.h b/runtime/base/unix_file/random_access_file_test.h
index 67e8c22..1d0b866 100644
--- a/runtime/base/unix_file/random_access_file_test.h
+++ b/runtime/base/unix_file/random_access_file_test.h
@@ -18,11 +18,10 @@
#define ART_RUNTIME_BASE_UNIX_FILE_RANDOM_ACCESS_FILE_TEST_H_
#include <errno.h>
-
+#include <memory>
#include <string>
#include "common_runtime_test.h"
-#include "UniquePtrCompat.h"
namespace unix_file {
@@ -62,7 +61,7 @@
void TestRead() {
char buf[256];
- UniquePtr<RandomAccessFile> file(MakeTestFile());
+ std::unique_ptr<RandomAccessFile> file(MakeTestFile());
// Reading from the start of an empty file gets you zero bytes, however many
// you ask for.
@@ -77,7 +76,7 @@
void TestReadContent(const std::string& content, RandomAccessFile* file) {
const int buf_size = content.size() + 10;
- UniquePtr<char> buf(new char[buf_size]);
+ std::unique_ptr<char> buf(new char[buf_size]);
// Can't read from a negative offset.
ASSERT_EQ(-EINVAL, file->Read(buf.get(), 0, -123));
@@ -107,7 +106,7 @@
void TestSetLength() {
const std::string content("hello");
- UniquePtr<RandomAccessFile> file(MakeTestFile());
+ std::unique_ptr<RandomAccessFile> file(MakeTestFile());
ASSERT_EQ(content.size(), static_cast<uint64_t>(file->Write(content.data(), content.size(), 0)));
ASSERT_EQ(content.size(), static_cast<uint64_t>(file->GetLength()));
@@ -132,7 +131,7 @@
void TestWrite() {
const std::string content("hello");
- UniquePtr<RandomAccessFile> file(MakeTestFile());
+ std::unique_ptr<RandomAccessFile> file(MakeTestFile());
// Can't write to a negative offset.
ASSERT_EQ(-EINVAL, file->Write(content.data(), 0, -123));
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 3c620de..def98dd 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -19,8 +19,8 @@
#include <fcntl.h>
#include <sys/file.h>
#include <sys/stat.h>
-
#include <deque>
+#include <memory>
#include <string>
#include <utility>
#include <vector>
@@ -62,7 +62,6 @@
#include "scoped_thread_state_change.h"
#include "handle_scope-inl.h"
#include "thread.h"
-#include "UniquePtrCompat.h"
#include "utils.h"
#include "verifier/method_verifier.h"
#include "well_known_classes.h"
@@ -647,7 +646,7 @@
uint32_t dex_location_checksum,
const char* oat_location,
std::string* error_msg) {
- UniquePtr<OatFile> oat_file(OatFile::Open(oat_location, oat_location, NULL,
+ std::unique_ptr<OatFile> oat_file(OatFile::Open(oat_location, oat_location, NULL,
!Runtime::Current()->IsCompiler(),
error_msg));
if (oat_file.get() == nullptr) {
@@ -745,7 +744,7 @@
}
private:
- UniquePtr<File> file_;
+ std::unique_ptr<File> file_;
DISALLOW_COPY_AND_ASSIGN(ScopedFlock);
};
@@ -784,7 +783,7 @@
error_msgs->push_back(error_msg);
return nullptr;
}
- UniquePtr<OatFile> oat_file(OatFile::Open(oat_location, oat_location, NULL,
+ std::unique_ptr<OatFile> oat_file(OatFile::Open(oat_location, oat_location, NULL,
!Runtime::Current()->IsCompiler(),
&error_msg));
if (oat_file.get() == nullptr) {
@@ -829,7 +828,7 @@
image_oat_checksum = image_header.GetOatChecksum();
image_oat_data_begin = reinterpret_cast<uintptr_t>(image_header.GetOatDataBegin());
} else {
- UniquePtr<ImageHeader> image_header(gc::space::ImageSpace::ReadImageHeaderOrDie(
+ std::unique_ptr<ImageHeader> image_header(gc::space::ImageSpace::ReadImageHeaderOrDie(
image_space->GetImageLocation().c_str(), instruction_set));
image_oat_checksum = image_header->GetOatChecksum();
image_oat_data_begin = reinterpret_cast<uintptr_t>(image_header->GetOatDataBegin());
@@ -878,7 +877,7 @@
const char* dex_location,
std::string* error_msg,
bool* open_failed) {
- UniquePtr<const OatFile> oat_file(FindOatFileFromOatLocation(oat_file_location, error_msg));
+ std::unique_ptr<const OatFile> oat_file(FindOatFileFromOatLocation(oat_file_location, error_msg));
if (oat_file.get() == nullptr) {
*open_failed = true;
return nullptr;
@@ -1240,22 +1239,22 @@
if (location.Get() == NULL) {
return NULL;
}
- Handle<mirror::ObjectArray<mirror::String> >
+ Handle<mirror::ObjectArray<mirror::String>>
strings(hs.NewHandle(AllocStringArray(self, dex_file.NumStringIds())));
if (strings.Get() == NULL) {
return NULL;
}
- Handle<mirror::ObjectArray<mirror::Class> >
+ Handle<mirror::ObjectArray<mirror::Class>>
types(hs.NewHandle(AllocClassArray(self, dex_file.NumTypeIds())));
if (types.Get() == NULL) {
return NULL;
}
- Handle<mirror::ObjectArray<mirror::ArtMethod> >
+ Handle<mirror::ObjectArray<mirror::ArtMethod>>
methods(hs.NewHandle(AllocArtMethodArray(self, dex_file.NumMethodIds())));
if (methods.Get() == NULL) {
return NULL;
}
- Handle<mirror::ObjectArray<mirror::ArtField> >
+ Handle<mirror::ObjectArray<mirror::ArtField>>
fields(hs.NewHandle(AllocArtFieldArray(self, dex_file.NumFieldIds())));
if (fields.Get() == NULL) {
return NULL;
@@ -2901,7 +2900,7 @@
{
ObjectLock<mirror::Class> lock(self, klass); // Must hold lock on object when resolved.
// Link the fields and virtual methods, creating vtable and iftables
- Handle<mirror::ObjectArray<mirror::Class> > h_interfaces(
+ Handle<mirror::ObjectArray<mirror::Class>> h_interfaces(
hs.NewHandle(soa.Decode<mirror::ObjectArray<mirror::Class>*>(interfaces)));
if (!LinkClass(self, klass, h_interfaces)) {
klass->SetStatus(mirror::Class::kStatusError, self);
@@ -2909,7 +2908,7 @@
}
interfaces_sfield->SetObject<false>(klass.Get(), soa.Decode<mirror::ObjectArray<mirror::Class>*>(interfaces));
- throws_sfield->SetObject<false>(klass.Get(), soa.Decode<mirror::ObjectArray<mirror::ObjectArray<mirror::Class> >*>(throws));
+ throws_sfield->SetObject<false>(klass.Get(), soa.Decode<mirror::ObjectArray<mirror::ObjectArray<mirror::Class>>*>(throws));
klass->SetStatus(mirror::Class::kStatusInitialized, self);
}
@@ -2937,7 +2936,7 @@
mirror::SynthesizedProxyClass* synth_proxy_class =
down_cast<mirror::SynthesizedProxyClass*>(klass.Get());
CHECK_EQ(synth_proxy_class->GetInterfaces(), soa.Decode<mirror::ObjectArray<mirror::Class>*>(interfaces));
- CHECK_EQ(synth_proxy_class->GetThrows(), soa.Decode<mirror::ObjectArray<mirror::ObjectArray<mirror::Class> >*>(throws));
+ CHECK_EQ(synth_proxy_class->GetThrows(), soa.Decode<mirror::ObjectArray<mirror::ObjectArray<mirror::Class>>*>(throws));
}
std::string descriptor(GetDescriptorForProxy(klass.Get()));
mirror::Class* existing = InsertClass(descriptor.c_str(), klass.Get(), Hash(descriptor.c_str()));
@@ -3375,7 +3374,7 @@
}
bool ClassLinker::LinkClass(Thread* self, const Handle<mirror::Class>& klass,
- const Handle<mirror::ObjectArray<mirror::Class> >& interfaces) {
+ const Handle<mirror::ObjectArray<mirror::Class>>& interfaces) {
CHECK_EQ(mirror::Class::kStatusLoaded, klass->GetStatus());
if (!LinkSuperClass(klass)) {
return false;
@@ -3500,7 +3499,7 @@
// Populate the class vtable and itable. Compute return type indices.
bool ClassLinker::LinkMethods(const Handle<mirror::Class>& klass,
- const Handle<mirror::ObjectArray<mirror::Class> >& interfaces) {
+ const Handle<mirror::ObjectArray<mirror::Class>>& interfaces) {
if (klass->IsInterface()) {
// No vtable.
size_t count = klass->NumVirtualMethods();
@@ -3589,7 +3588,7 @@
return false;
}
StackHandleScope<1> hs(self);
- Handle<mirror::ObjectArray<mirror::ArtMethod> >
+ Handle<mirror::ObjectArray<mirror::ArtMethod>>
vtable(hs.NewHandle(AllocArtMethodArray(self, num_virtual_methods)));
if (UNLIKELY(vtable.Get() == NULL)) {
CHECK(self->IsExceptionPending()); // OOME.
@@ -3606,7 +3605,7 @@
}
bool ClassLinker::LinkInterfaceMethods(const Handle<mirror::Class>& klass,
- const Handle<mirror::ObjectArray<mirror::Class> >& interfaces) {
+ const Handle<mirror::ObjectArray<mirror::Class>>& interfaces) {
Thread* const self = Thread::Current();
// Set the imt table to be all conflicts by default.
klass->SetImTable(Runtime::Current()->GetDefaultImt());
@@ -3721,7 +3720,7 @@
}
// Allocate imtable
bool imtable_changed = false;
- Handle<mirror::ObjectArray<mirror::ArtMethod> > imtable(
+ Handle<mirror::ObjectArray<mirror::ArtMethod>> imtable(
hs.NewHandle(AllocArtMethodArray(self, kImtSize)));
if (UNLIKELY(imtable.Get() == NULL)) {
CHECK(self->IsExceptionPending()); // OOME.
@@ -3732,14 +3731,14 @@
size_t num_methods = iftable->GetInterface(i)->NumVirtualMethods();
if (num_methods > 0) {
StackHandleScope<2> hs(self);
- Handle<mirror::ObjectArray<mirror::ArtMethod> >
+ Handle<mirror::ObjectArray<mirror::ArtMethod>>
method_array(hs.NewHandle(AllocArtMethodArray(self, num_methods)));
if (UNLIKELY(method_array.Get() == nullptr)) {
CHECK(self->IsExceptionPending()); // OOME.
return false;
}
iftable->SetMethodArray(i, method_array.Get());
- Handle<mirror::ObjectArray<mirror::ArtMethod> > vtable(
+ Handle<mirror::ObjectArray<mirror::ArtMethod>> vtable(
hs.NewHandle(klass->GetVTableDuringLinking()));
for (size_t j = 0; j < num_methods; ++j) {
mirror::ArtMethod* interface_method = iftable->GetInterface(i)->GetVirtualMethod(j);
@@ -3828,7 +3827,7 @@
klass->SetVirtualMethods(virtuals);
StackHandleScope<1> hs(self);
- Handle<mirror::ObjectArray<mirror::ArtMethod> > vtable(
+ Handle<mirror::ObjectArray<mirror::ArtMethod>> vtable(
hs.NewHandle(klass->GetVTableDuringLinking()));
CHECK(vtable.Get() != NULL);
int old_vtable_count = vtable->GetLength();
diff --git a/runtime/class_linker.h b/runtime/class_linker.h
index 0811266..c89fedf 100644
--- a/runtime/class_linker.h
+++ b/runtime/class_linker.h
@@ -486,7 +486,7 @@
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
bool LinkClass(Thread* self, const Handle<mirror::Class>& klass,
- const Handle<mirror::ObjectArray<mirror::Class> >& interfaces)
+ const Handle<mirror::ObjectArray<mirror::Class>>& interfaces)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
bool LinkSuperClass(const Handle<mirror::Class>& klass)
@@ -496,14 +496,14 @@
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
bool LinkMethods(const Handle<mirror::Class>& klass,
- const Handle<mirror::ObjectArray<mirror::Class> >& interfaces)
+ const Handle<mirror::ObjectArray<mirror::Class>>& interfaces)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
bool LinkVirtualMethods(const Handle<mirror::Class>& klass)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
bool LinkInterfaceMethods(const Handle<mirror::Class>& klass,
- const Handle<mirror::ObjectArray<mirror::Class> >& interfaces)
+ const Handle<mirror::ObjectArray<mirror::Class>>& interfaces)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
bool LinkStaticFields(const Handle<mirror::Class>& klass)
@@ -570,7 +570,7 @@
// Class::descriptor_ and Class::class_loader_.
typedef std::multimap<size_t, mirror::Class*> Table;
Table class_table_ GUARDED_BY(Locks::classlinker_classes_lock_);
- std::vector<std::pair<size_t, mirror::Class*> > new_class_roots_;
+ std::vector<std::pair<size_t, mirror::Class*>> new_class_roots_;
// Do we need to search dex caches to find image classes?
bool dex_cache_image_class_lookup_required_;
diff --git a/runtime/class_linker_test.cc b/runtime/class_linker_test.cc
index ff90f41..d04f02b 100644
--- a/runtime/class_linker_test.cc
+++ b/runtime/class_linker_test.cc
@@ -16,9 +16,9 @@
#include "class_linker.h"
+#include <memory>
#include <string>
-#include "UniquePtrCompat.h"
#include "class_linker-inl.h"
#include "common_runtime_test.h"
#include "dex_file.h"
diff --git a/runtime/common_runtime_test.h b/runtime/common_runtime_test.h
index 54ef68d..bac212a 100644
--- a/runtime/common_runtime_test.h
+++ b/runtime/common_runtime_test.h
@@ -24,6 +24,7 @@
#include <sys/stat.h>
#include <sys/types.h>
#include <fstream>
+#include <memory>
#include "../../external/icu4c/common/unicode/uvernum.h"
#include "base/macros.h"
@@ -47,7 +48,6 @@
#include "ScopedLocalRef.h"
#include "thread.h"
#include "utils.h"
-#include "UniquePtrCompat.h"
#include "verifier/method_verifier.h"
#include "verifier/method_verifier-inl.h"
#include "well_known_classes.h"
@@ -107,7 +107,7 @@
private:
std::string filename_;
- UniquePtr<File> file_;
+ std::unique_ptr<File> file_;
};
class CommonRuntimeTest : public testing::Test {
@@ -304,7 +304,7 @@
std::string dalvik_cache_;
const DexFile* java_lang_dex_file_; // owned by runtime_
std::vector<const DexFile*> boot_class_path_;
- UniquePtr<Runtime> runtime_;
+ std::unique_ptr<Runtime> runtime_;
// Owned by the runtime
ClassLinker* class_linker_;
diff --git a/runtime/debugger.cc b/runtime/debugger.cc
index 2cbff79..7136c67 100644
--- a/runtime/debugger.cc
+++ b/runtime/debugger.cc
@@ -884,7 +884,7 @@
std::vector<mirror::Object*> monitors;
std::vector<uint32_t> stack_depths;
};
- UniquePtr<Context> context(Context::Create());
+ std::unique_ptr<Context> context(Context::Create());
OwnedMonitorVisitor visitor(thread, context.get());
visitor.WalkStack();
@@ -2247,7 +2247,7 @@
return JDWP::ERR_THREAD_NOT_SUSPENDED;
}
}
- UniquePtr<Context> context(Context::Create());
+ std::unique_ptr<Context> context(Context::Create());
GetThisVisitor visitor(thread, context.get(), frame_id);
visitor.WalkStack();
*result = gRegistry->Add(visitor.this_object);
@@ -2395,7 +2395,7 @@
return error;
}
// TODO check thread is suspended by the debugger ?
- UniquePtr<Context> context(Context::Create());
+ std::unique_ptr<Context> context(Context::Create());
GetLocalVisitor visitor(soa, thread, context.get(), frame_id, slot, tag, buf, width);
visitor.WalkStack();
return visitor.error_;
@@ -2492,7 +2492,7 @@
return error;
}
// TODO check thread is suspended by the debugger ?
- UniquePtr<Context> context(Context::Create());
+ std::unique_ptr<Context> context(Context::Create());
SetLocalVisitor visitor(thread, context.get(), frame_id, slot, tag, value, width);
visitor.WalkStack();
return visitor.error_;
@@ -4275,7 +4275,7 @@
for (const std::string& str : table_) {
const char* s = str.c_str();
size_t s_len = CountModifiedUtf8Chars(s);
- UniquePtr<uint16_t> s_utf16(new uint16_t[s_len]);
+ std::unique_ptr<uint16_t> s_utf16(new uint16_t[s_len]);
ConvertModifiedUtf8ToUtf16(s_utf16.get(), s);
JDWP::AppendUtf16BE(bytes, s_utf16.get(), s_len);
}
diff --git a/runtime/dex_file.cc b/runtime/dex_file.cc
index 26b7d07..43ae308 100644
--- a/runtime/dex_file.cc
+++ b/runtime/dex_file.cc
@@ -23,6 +23,7 @@
#include <string.h>
#include <sys/file.h>
#include <sys/stat.h>
+#include <memory>
#include "base/logging.h"
#include "base/stringprintf.h"
@@ -39,7 +40,6 @@
#include "ScopedFd.h"
#include "handle_scope-inl.h"
#include "thread.h"
-#include "UniquePtrCompat.h"
#include "utf-inl.h"
#include "utils.h"
#include "well_known_classes.h"
@@ -93,12 +93,12 @@
return false;
}
if (IsZipMagic(magic)) {
- UniquePtr<ZipArchive> zip_archive(ZipArchive::OpenFromFd(fd.release(), filename, error_msg));
+ std::unique_ptr<ZipArchive> zip_archive(ZipArchive::OpenFromFd(fd.release(), filename, error_msg));
if (zip_archive.get() == NULL) {
*error_msg = StringPrintf("Failed to open zip archive '%s'", filename);
return false;
}
- UniquePtr<ZipEntry> zip_entry(zip_archive->Find(kClassesDex, error_msg));
+ std::unique_ptr<ZipEntry> zip_entry(zip_archive->Find(kClassesDex, error_msg));
if (zip_entry.get() == NULL) {
*error_msg = StringPrintf("Zip archive '%s' doesn't contain %s (error msg: %s)", filename,
kClassesDex, error_msg->c_str());
@@ -108,7 +108,7 @@
return true;
}
if (IsDexMagic(magic)) {
- UniquePtr<const DexFile> dex_file(DexFile::OpenFile(fd.release(), filename, false, error_msg));
+ std::unique_ptr<const DexFile> dex_file(DexFile::OpenFile(fd.release(), filename, false, error_msg));
if (dex_file.get() == NULL) {
return false;
}
@@ -171,7 +171,7 @@
const DexFile* DexFile::OpenFile(int fd, const char* location, bool verify,
std::string* error_msg) {
CHECK(location != nullptr);
- UniquePtr<MemMap> map;
+ std::unique_ptr<MemMap> map;
{
ScopedFd delayed_close(fd);
struct stat sbuf;
@@ -218,7 +218,7 @@
const char* DexFile::kClassesDex = "classes.dex";
const DexFile* DexFile::OpenZip(int fd, const std::string& location, std::string* error_msg) {
- UniquePtr<ZipArchive> zip_archive(ZipArchive::OpenFromFd(fd, location.c_str(), error_msg));
+ std::unique_ptr<ZipArchive> zip_archive(ZipArchive::OpenFromFd(fd, location.c_str(), error_msg));
if (zip_archive.get() == nullptr) {
DCHECK(!error_msg->empty());
return nullptr;
@@ -241,17 +241,17 @@
const DexFile* DexFile::Open(const ZipArchive& zip_archive, const std::string& location,
std::string* error_msg) {
CHECK(!location.empty());
- UniquePtr<ZipEntry> zip_entry(zip_archive.Find(kClassesDex, error_msg));
+ std::unique_ptr<ZipEntry> zip_entry(zip_archive.Find(kClassesDex, error_msg));
if (zip_entry.get() == NULL) {
return nullptr;
}
- UniquePtr<MemMap> map(zip_entry->ExtractToMemMap(kClassesDex, error_msg));
+ std::unique_ptr<MemMap> map(zip_entry->ExtractToMemMap(kClassesDex, error_msg));
if (map.get() == NULL) {
*error_msg = StringPrintf("Failed to extract '%s' from '%s': %s", kClassesDex, location.c_str(),
error_msg->c_str());
return nullptr;
}
- UniquePtr<const DexFile> dex_file(OpenMemory(location, zip_entry->GetCrc32(), map.release(),
+ std::unique_ptr<const DexFile> dex_file(OpenMemory(location, zip_entry->GetCrc32(), map.release(),
error_msg));
if (dex_file.get() == nullptr) {
*error_msg = StringPrintf("Failed to open dex file '%s' from memory: %s", location.c_str(),
@@ -276,7 +276,7 @@
uint32_t location_checksum,
MemMap* mem_map, std::string* error_msg) {
CHECK_ALIGNED(base, 4); // various dex file structures must be word aligned
- UniquePtr<DexFile> dex_file(new DexFile(base, size, location, location_checksum, mem_map));
+ std::unique_ptr<DexFile> dex_file(new DexFile(base, size, location, location_checksum, mem_map));
if (!dex_file->Init(error_msg)) {
return nullptr;
} else {
@@ -838,7 +838,7 @@
void* context) const {
DCHECK(code_item != nullptr);
const byte* stream = GetDebugInfoStream(code_item);
- UniquePtr<LocalInfo[]> local_in_reg(local_cb != NULL ?
+ std::unique_ptr<LocalInfo[]> local_in_reg(local_cb != NULL ?
new LocalInfo[code_item->registers_size_] :
NULL);
if (stream != NULL) {
diff --git a/runtime/dex_file.h b/runtime/dex_file.h
index 0146f31..1d5032d 100644
--- a/runtime/dex_file.h
+++ b/runtime/dex_file.h
@@ -17,6 +17,7 @@
#ifndef ART_RUNTIME_DEX_FILE_H_
#define ART_RUNTIME_DEX_FILE_H_
+#include <memory>
#include <string>
#include <vector>
@@ -28,7 +29,6 @@
#include "mem_map.h"
#include "modifiers.h"
#include "safe_map.h"
-#include "UniquePtrCompat.h"
namespace art {
@@ -870,7 +870,7 @@
const uint32_t location_checksum_;
// Manages the underlying memory allocation.
- UniquePtr<MemMap> mem_map_;
+ std::unique_ptr<MemMap> mem_map_;
// Points to the header section.
const Header* const header_;
diff --git a/runtime/dex_file_test.cc b/runtime/dex_file_test.cc
index 86c282e..a814c34 100644
--- a/runtime/dex_file_test.cc
+++ b/runtime/dex_file_test.cc
@@ -16,7 +16,8 @@
#include "dex_file.h"
-#include "UniquePtrCompat.h"
+#include <memory>
+
#include "common_runtime_test.h"
namespace art {
@@ -90,7 +91,7 @@
*dst_size = 0;
return nullptr;
}
- UniquePtr<byte[]> dst(new byte[tmp.size()]);
+ std::unique_ptr<byte[]> dst(new byte[tmp.size()]);
if (dst_size != nullptr) {
*dst_size = tmp.size();
} else {
@@ -131,11 +132,11 @@
// decode base64
CHECK(base64 != NULL);
size_t length;
- UniquePtr<byte[]> dex_bytes(DecodeBase64(base64, &length));
+ std::unique_ptr<byte[]> dex_bytes(DecodeBase64(base64, &length));
CHECK(dex_bytes.get() != NULL);
// write to provided file
- UniquePtr<File> file(OS::CreateEmptyFile(location));
+ std::unique_ptr<File> file(OS::CreateEmptyFile(location));
CHECK(file.get() != NULL);
if (!file->WriteFully(dex_bytes.get(), length)) {
PLOG(FATAL) << "Failed to write base64 as dex file";
@@ -154,7 +155,7 @@
TEST_F(DexFileTest, Header) {
ScratchFile tmp;
- UniquePtr<const DexFile> raw(OpenDexFileBase64(kRawDex, tmp.GetFilename().c_str()));
+ std::unique_ptr<const DexFile> raw(OpenDexFileBase64(kRawDex, tmp.GetFilename().c_str()));
ASSERT_TRUE(raw.get() != NULL);
const DexFile::Header& header = raw->GetHeader();
diff --git a/runtime/dex_file_verifier.cc b/runtime/dex_file_verifier.cc
index d179c8b..a1c8c71 100644
--- a/runtime/dex_file_verifier.cc
+++ b/runtime/dex_file_verifier.cc
@@ -17,12 +17,12 @@
#include "dex_file_verifier.h"
#include <zlib.h>
+#include <memory>
#include "base/stringprintf.h"
#include "dex_file-inl.h"
#include "leb128.h"
#include "safe_map.h"
-#include "UniquePtrCompat.h"
#include "utf-inl.h"
#include "utils.h"
@@ -68,7 +68,7 @@
bool DexFileVerifier::Verify(const DexFile* dex_file, const byte* begin, size_t size,
const char* location, std::string* error_msg) {
- UniquePtr<DexFileVerifier> verifier(new DexFileVerifier(dex_file, begin, size, location));
+ std::unique_ptr<DexFileVerifier> verifier(new DexFileVerifier(dex_file, begin, size, location));
if (!verifier->Verify()) {
*error_msg = verifier->FailureReason();
return false;
@@ -652,7 +652,7 @@
return false;
}
- UniquePtr<uint32_t[]> handler_offsets(new uint32_t[handlers_size]);
+ std::unique_ptr<uint32_t[]> handler_offsets(new uint32_t[handlers_size]);
if (!CheckAndGetHandlerOffsets(code_item, &handler_offsets[0], handlers_size)) {
return false;
}
diff --git a/runtime/dex_instruction_visitor_test.cc b/runtime/dex_instruction_visitor_test.cc
index 99ad3ed..c5e63eb 100644
--- a/runtime/dex_instruction_visitor_test.cc
+++ b/runtime/dex_instruction_visitor_test.cc
@@ -17,8 +17,8 @@
#include "dex_instruction_visitor.h"
#include <iostream>
+#include <memory>
-#include "UniquePtrCompat.h"
#include "gtest/gtest.h"
namespace art {
@@ -26,7 +26,7 @@
class TestVisitor : public DexInstructionVisitor<TestVisitor> {};
TEST(InstructionTest, Init) {
- UniquePtr<TestVisitor> visitor(new TestVisitor);
+ std::unique_ptr<TestVisitor> visitor(new TestVisitor);
}
class CountVisitor : public DexInstructionVisitor<CountVisitor> {
diff --git a/runtime/dex_method_iterator.h b/runtime/dex_method_iterator.h
index 1975e48..806266d 100644
--- a/runtime/dex_method_iterator.h
+++ b/runtime/dex_method_iterator.h
@@ -140,7 +140,7 @@
uint32_t class_def_index_;
const DexFile::ClassDef* class_def_;
const byte* class_data_;
- UniquePtr<ClassDataItemIterator> it_;
+ std::unique_ptr<ClassDataItemIterator> it_;
bool direct_method_;
};
diff --git a/runtime/elf_file.cc b/runtime/elf_file.cc
index 01ca60f..5d20096 100644
--- a/runtime/elf_file.cc
+++ b/runtime/elf_file.cc
@@ -127,7 +127,7 @@
ElfFile* ElfFile::Open(File* file, bool writable, bool program_header_only,
std::string* error_msg) {
- UniquePtr<ElfFile> elf_file(new ElfFile(file, writable, program_header_only));
+ std::unique_ptr<ElfFile> elf_file(new ElfFile(file, writable, program_header_only));
if (!elf_file->Setup(error_msg)) {
return nullptr;
}
@@ -844,7 +844,7 @@
if (program_header.p_vaddr == 0) {
std::string reservation_name("ElfFile reservation for ");
reservation_name += file_->GetPath();
- UniquePtr<MemMap> reserve(MemMap::MapAnonymous(reservation_name.c_str(),
+ std::unique_ptr<MemMap> reserve(MemMap::MapAnonymous(reservation_name.c_str(),
NULL, GetLoadedSize(), PROT_NONE, false,
error_msg));
if (reserve.get() == nullptr) {
@@ -884,7 +884,7 @@
file_->GetPath().c_str());
return false;
}
- UniquePtr<MemMap> segment(MemMap::MapFileAtAddress(p_vaddr,
+ std::unique_ptr<MemMap> segment(MemMap::MapFileAtAddress(p_vaddr,
program_header.p_memsz,
prot, flags, file_->Fd(),
program_header.p_offset,
@@ -999,7 +999,7 @@
// Well, we need the whole file to do this.
std::string error_msg;
- UniquePtr<ElfFile> ptr(Open(const_cast<File*>(file_), false, false, &error_msg));
+ std::unique_ptr<ElfFile> ptr(Open(const_cast<File*>(file_), false, false, &error_msg));
ElfFile& all = *ptr;
// Do we have interesting sections?
diff --git a/runtime/elf_file.h b/runtime/elf_file.h
index 138147b..6650acd 100644
--- a/runtime/elf_file.h
+++ b/runtime/elf_file.h
@@ -18,6 +18,7 @@
#define ART_RUNTIME_ELF_FILE_H_
#include <map>
+#include <memory>
#include <vector>
#include "base/unix_file/fd_file.h"
@@ -25,7 +26,6 @@
#include "elf_utils.h"
#include "mem_map.h"
#include "os.h"
-#include "UniquePtrCompat.h"
namespace art {
@@ -154,7 +154,7 @@
// ELF header mapping. If program_header_only_ is false, will
// actually point to the entire elf file.
- UniquePtr<MemMap> map_;
+ std::unique_ptr<MemMap> map_;
Elf32_Ehdr* header_;
std::vector<MemMap*> segments_;
diff --git a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
index 887bd6f..4bd86db 100644
--- a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
+++ b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
@@ -523,7 +523,7 @@
ScopedObjectAccessUnchecked* const soa_;
std::vector<jvalue>* const args_;
// References which we must update when exiting in case the GC moved the objects.
- std::vector<std::pair<jobject, StackReference<mirror::Object>*> > references_;
+ std::vector<std::pair<jobject, StackReference<mirror::Object>*>> references_;
DISALLOW_COPY_AND_ASSIGN(BuildQuickArgumentVisitor);
};
@@ -640,7 +640,7 @@
private:
ScopedObjectAccessUnchecked* const soa_;
// References which we must update when exiting in case the GC moved the objects.
- std::vector<std::pair<jobject, StackReference<mirror::Object>*> > references_;
+ std::vector<std::pair<jobject, StackReference<mirror::Object>*>> references_;
DISALLOW_COPY_AND_ASSIGN(RememberForGcArgumentVisitor);
};
diff --git a/runtime/exception_test.cc b/runtime/exception_test.cc
index 37ad9e5..751cdb6 100644
--- a/runtime/exception_test.cc
+++ b/runtime/exception_test.cc
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+#include <memory>
+
#include "class_linker.h"
#include "common_runtime_test.h"
#include "dex_file.h"
@@ -27,7 +29,6 @@
#include "scoped_thread_state_change.h"
#include "handle_scope-inl.h"
#include "thread.h"
-#include "UniquePtrCompat.h"
#include "vmap_table.h"
namespace art {
diff --git a/runtime/gc/accounting/atomic_stack.h b/runtime/gc/accounting/atomic_stack.h
index 7d8b584..f3ed8d3 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 @@
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 @@
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 714e6f7..43a173e 100644
--- a/runtime/gc/accounting/card_table.cc
+++ b/runtime/gc/accounting/card_table.cc
@@ -55,7 +55,7 @@
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 17e62a6..7934974 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 @@
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 7dd7cca..1d96112 100644
--- a/runtime/gc/accounting/gc_allocator.h
+++ b/runtime/gc/accounting/gc_allocator.h
@@ -73,7 +73,7 @@
// 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 ef5653a..228d1dc 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 5ae7c77..449e171 100644
--- a/runtime/gc/accounting/mod_union_table.h
+++ b/runtime/gc/accounting/mod_union_table.h
@@ -50,7 +50,7 @@
// 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 @@
// 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 1def334..3ff5874 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 e3d8537..706cf35 100644
--- a/runtime/gc/accounting/remembered_set.h
+++ b/runtime/gc/accounting/remembered_set.h
@@ -43,7 +43,7 @@
// 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 a439462..7f1da79 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 66f9a3a..8e817e5 100644
--- a/runtime/gc/accounting/space_bitmap.cc
+++ b/runtime/gc/accounting/space_bitmap.cc
@@ -51,7 +51,7 @@
// 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 @@
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 1ccebf5..50d15c6 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 @@
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 71db44b..a30bb25 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 @@
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 @@
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 @@
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) {
diff --git a/runtime/gc/allocator/rosalloc.cc b/runtime/gc/allocator/rosalloc.cc
index 27c4c17..10b88b3 100644
--- a/runtime/gc/allocator/rosalloc.cc
+++ b/runtime/gc/allocator/rosalloc.cc
@@ -793,7 +793,7 @@
// already in the non-full run set (i.e., it was full) insert it
// into the non-full run set.
if (run != current_runs_[idx]) {
- unordered_set<Run*, hash_run, eq_run>* full_runs =
+ std::unordered_set<Run*, hash_run, eq_run>* full_runs =
kIsDebugBuild ? &full_runs_[idx] : NULL;
std::set<Run*>::iterator pos = non_full_runs->find(run);
if (pos == non_full_runs->end()) {
@@ -1160,7 +1160,7 @@
#ifdef HAVE_ANDROID_OS
std::vector<Run*> runs;
#else
- unordered_set<Run*, hash_run, eq_run> runs;
+ std::unordered_set<Run*, hash_run, eq_run> runs;
#endif
for (size_t i = 0; i < num_ptrs; i++) {
void* ptr = ptrs[i];
@@ -1267,7 +1267,7 @@
// Check if the run should be moved to non_full_runs_ or
// free_page_runs_.
std::set<Run*>* non_full_runs = &non_full_runs_[idx];
- unordered_set<Run*, hash_run, eq_run>* full_runs =
+ std::unordered_set<Run*, hash_run, eq_run>* full_runs =
kIsDebugBuild ? &full_runs_[idx] : NULL;
if (run->IsAllFree()) {
// It has just become completely free. Free the pages of the
@@ -1281,7 +1281,7 @@
// If it was full, remove it from the full run set (debug
// only.)
if (kIsDebugBuild) {
- unordered_set<Run*, hash_run, eq_run>::iterator pos = full_runs->find(run);
+ std::unordered_set<Run*, hash_run, eq_run>::iterator pos = full_runs->find(run);
DCHECK(pos != full_runs->end());
full_runs->erase(pos);
if (kTraceRosAlloc) {
@@ -2054,7 +2054,7 @@
} else {
// If it's full, it must in the full run set (debug build only.)
if (kIsDebugBuild) {
- unordered_set<Run*, hash_run, eq_run>& full_runs = rosalloc->full_runs_[idx];
+ std::unordered_set<Run*, hash_run, eq_run>& full_runs = rosalloc->full_runs_[idx];
CHECK(full_runs.find(this) != full_runs.end())
<< " A full run isn't in the full run set " << Dump();
}
diff --git a/runtime/gc/allocator/rosalloc.h b/runtime/gc/allocator/rosalloc.h
index 9ea4306..9464331 100644
--- a/runtime/gc/allocator/rosalloc.h
+++ b/runtime/gc/allocator/rosalloc.h
@@ -17,31 +17,21 @@
#ifndef ART_RUNTIME_GC_ALLOCATOR_ROSALLOC_H_
#define ART_RUNTIME_GC_ALLOCATOR_ROSALLOC_H_
-#include <set>
#include <stdint.h>
#include <stdlib.h>
-#include <string>
#include <sys/mman.h>
+#include <memory>
+#include <set>
+#include <string>
+#include <unordered_set>
#include <vector>
#include "base/mutex.h"
#include "base/logging.h"
#include "globals.h"
#include "mem_map.h"
-#include "UniquePtrCompat.h"
#include "utils.h"
-// Ensure we have an unordered_set until we have worked out C++ library issues.
-#ifdef ART_WITH_STLPORT
-#include <hash_set>
-template <class V, class H, class P>
-class unordered_set : public std::hash_set<V, H, P> {};
-#else // ART_WITH_STLPORT
-// TODO: avoid the use of using in a header file.
-#include <unordered_set>
-using std::unordered_set;
-#endif // ART_WITH_STLPORT
-
namespace art {
namespace gc {
namespace allocator {
@@ -451,7 +441,7 @@
std::set<Run*> non_full_runs_[kNumOfSizeBrackets];
// The run sets that hold the runs whose slots are all full. This is
// debug only. full_runs_[i] is guarded by size_bracket_locks_[i].
- unordered_set<Run*, hash_run, eq_run> full_runs_[kNumOfSizeBrackets];
+ std::unordered_set<Run*, hash_run, eq_run> full_runs_[kNumOfSizeBrackets];
// The set of free pages.
std::set<FreePageRun*> free_page_runs_ GUARDED_BY(lock_);
// The dedicated full run, it is always full and shared by all threads when revoking happens.
@@ -479,7 +469,7 @@
byte* page_map_; // No GUARDED_BY(lock_) for kReadPageMapEntryWithoutLockInBulkFree.
size_t page_map_size_;
size_t max_page_map_size_;
- UniquePtr<MemMap> page_map_mem_map_;
+ std::unique_ptr<MemMap> page_map_mem_map_;
// The table that indicates the size of free page runs. These sizes
// are stored here to avoid storing in the free page header and
diff --git a/runtime/gc/collector/mark_sweep.h b/runtime/gc/collector/mark_sweep.h
index fd79bf6..e9a3c3a 100644
--- a/runtime/gc/collector/mark_sweep.h
+++ b/runtime/gc/collector/mark_sweep.h
@@ -17,6 +17,8 @@
#ifndef ART_RUNTIME_GC_COLLECTOR_MARK_SWEEP_H_
#define ART_RUNTIME_GC_COLLECTOR_MARK_SWEEP_H_
+#include <memory>
+
#include "atomic.h"
#include "barrier.h"
#include "base/macros.h"
@@ -26,7 +28,6 @@
#include "immune_region.h"
#include "object_callbacks.h"
#include "offsets.h"
-#include "UniquePtrCompat.h"
namespace art {
@@ -307,7 +308,7 @@
// Verification.
size_t live_stack_freeze_size_;
- UniquePtr<Barrier> gc_barrier_;
+ std::unique_ptr<Barrier> gc_barrier_;
Mutex mark_stack_lock_ ACQUIRED_AFTER(Locks::classlinker_classes_lock_);
const bool is_concurrent_;
diff --git a/runtime/gc/collector/semi_space.h b/runtime/gc/collector/semi_space.h
index dacb5ae..a95abe4 100644
--- a/runtime/gc/collector/semi_space.h
+++ b/runtime/gc/collector/semi_space.h
@@ -17,6 +17,8 @@
#ifndef ART_RUNTIME_GC_COLLECTOR_SEMI_SPACE_H_
#define ART_RUNTIME_GC_COLLECTOR_SEMI_SPACE_H_
+#include <memory>
+
#include "atomic.h"
#include "base/macros.h"
#include "base/mutex.h"
@@ -25,7 +27,6 @@
#include "immune_region.h"
#include "object_callbacks.h"
#include "offsets.h"
-#include "UniquePtrCompat.h"
namespace art {
diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc
index ef31be3..706d1de 100644
--- a/runtime/gc/heap.cc
+++ b/runtime/gc/heap.cc
@@ -20,6 +20,7 @@
#include <cutils/trace.h>
#include <limits>
+#include <memory>
#include <vector>
#include "base/histogram-inl.h"
@@ -64,7 +65,6 @@
#include "scoped_thread_state_change.h"
#include "handle_scope-inl.h"
#include "thread_list.h"
-#include "UniquePtrCompat.h"
#include "well_known_classes.h"
namespace art {
diff --git a/runtime/gc/heap.h b/runtime/gc/heap.h
index 9831861..eea2879 100644
--- a/runtime/gc/heap.h
+++ b/runtime/gc/heap.h
@@ -733,7 +733,7 @@
space::LargeObjectSpace* large_object_space_;
// The card table, dirtied by the write barrier.
- UniquePtr<accounting::CardTable> card_table_;
+ std::unique_ptr<accounting::CardTable> card_table_;
// A mod-union table remembers all of the references from the it's space to other spaces.
SafeMap<space::Space*, accounting::ModUnionTable*> mod_union_tables_;
@@ -788,7 +788,7 @@
// Guards access to the state of GC, associated conditional variable is used to signal when a GC
// completes.
Mutex* gc_complete_lock_ DEFAULT_MUTEX_ACQUIRED_AFTER;
- UniquePtr<ConditionVariable> gc_complete_cond_ GUARDED_BY(gc_complete_lock_);
+ std::unique_ptr<ConditionVariable> gc_complete_cond_ GUARDED_BY(gc_complete_lock_);
// Reference processor;
ReferenceProcessor reference_processor_;
@@ -880,7 +880,7 @@
};
// Parallel GC data structures.
- UniquePtr<ThreadPool> thread_pool_;
+ std::unique_ptr<ThreadPool> thread_pool_;
// The nanosecond time at which the last GC ended.
uint64_t last_gc_time_ns_;
@@ -893,19 +893,19 @@
uint64_t allocation_rate_;
// For a GC cycle, a bitmap that is set corresponding to the
- UniquePtr<accounting::HeapBitmap> live_bitmap_ GUARDED_BY(Locks::heap_bitmap_lock_);
- UniquePtr<accounting::HeapBitmap> mark_bitmap_ GUARDED_BY(Locks::heap_bitmap_lock_);
+ std::unique_ptr<accounting::HeapBitmap> live_bitmap_ GUARDED_BY(Locks::heap_bitmap_lock_);
+ std::unique_ptr<accounting::HeapBitmap> mark_bitmap_ GUARDED_BY(Locks::heap_bitmap_lock_);
// Mark stack that we reuse to avoid re-allocating the mark stack.
- UniquePtr<accounting::ObjectStack> mark_stack_;
+ std::unique_ptr<accounting::ObjectStack> mark_stack_;
// Allocation stack, new allocations go here so that we can do sticky mark bits. This enables us
// to use the live bitmap as the old mark bitmap.
const size_t max_allocation_stack_size_;
- UniquePtr<accounting::ObjectStack> allocation_stack_;
+ std::unique_ptr<accounting::ObjectStack> allocation_stack_;
// Second allocation stack so that we can process allocation with the heap unlocked.
- UniquePtr<accounting::ObjectStack> live_stack_;
+ std::unique_ptr<accounting::ObjectStack> live_stack_;
// Allocator type.
AllocatorType current_allocator_;
diff --git a/runtime/gc/heap_test.cc b/runtime/gc/heap_test.cc
index 8850b92..4176f4a 100644
--- a/runtime/gc/heap_test.cc
+++ b/runtime/gc/heap_test.cc
@@ -48,7 +48,7 @@
hs.NewHandle(class_linker_->FindSystemClass(soa.Self(), "[Ljava/lang/Object;")));
for (size_t i = 0; i < 1024; ++i) {
StackHandleScope<1> hs(soa.Self());
- Handle<mirror::ObjectArray<mirror::Object> > array(hs.NewHandle(
+ Handle<mirror::ObjectArray<mirror::Object>> array(hs.NewHandle(
mirror::ObjectArray<mirror::Object>::Alloc(soa.Self(), c.Get(), 2048)));
for (size_t j = 0; j < 2048; ++j) {
mirror::String* string = mirror::String::AllocFromModifiedUtf8(soa.Self(), "hello, world!");
@@ -63,7 +63,7 @@
TEST_F(HeapTest, HeapBitmapCapacityTest) {
byte* heap_begin = reinterpret_cast<byte*>(0x1000);
const size_t heap_capacity = kObjectAlignment * (sizeof(intptr_t) * 8 + 1);
- UniquePtr<accounting::ContinuousSpaceBitmap> bitmap(
+ std::unique_ptr<accounting::ContinuousSpaceBitmap> bitmap(
accounting::ContinuousSpaceBitmap::Create("test bitmap", heap_begin, heap_capacity));
mirror::Object* fake_end_of_heap_object =
reinterpret_cast<mirror::Object*>(&heap_begin[heap_capacity - kObjectAlignment]);
diff --git a/runtime/gc/space/bump_pointer_space.cc b/runtime/gc/space/bump_pointer_space.cc
index 90ffe59..fcd772b 100644
--- a/runtime/gc/space/bump_pointer_space.cc
+++ b/runtime/gc/space/bump_pointer_space.cc
@@ -28,7 +28,7 @@
byte* requested_begin) {
capacity = RoundUp(capacity, kPageSize);
std::string error_msg;
- UniquePtr<MemMap> mem_map(MemMap::MapAnonymous(name.c_str(), requested_begin, capacity,
+ std::unique_ptr<MemMap> mem_map(MemMap::MapAnonymous(name.c_str(), requested_begin, capacity,
PROT_READ | PROT_WRITE, true, &error_msg));
if (mem_map.get() == nullptr) {
LOG(ERROR) << "Failed to allocate pages for alloc space (" << name << ") of size "
diff --git a/runtime/gc/space/image_space.cc b/runtime/gc/space/image_space.cc
index 2a717cb..5036095 100644
--- a/runtime/gc/space/image_space.cc
+++ b/runtime/gc/space/image_space.cc
@@ -129,8 +129,8 @@
std::string image_filename;
bool is_system = false;
if (FindImageFilename(image_location, image_isa, &image_filename, &is_system)) {
- UniquePtr<File> image_file(OS::OpenFileForReading(image_filename.c_str()));
- UniquePtr<ImageHeader> image_header(new ImageHeader);
+ std::unique_ptr<File> image_file(OS::OpenFileForReading(image_filename.c_str()));
+ std::unique_ptr<ImageHeader> image_header(new ImageHeader);
const bool success = image_file->ReadFully(image_header.get(), sizeof(ImageHeader));
if (!success || !image_header->IsValid()) {
LOG(FATAL) << "Invalid Image header for: " << image_filename;
@@ -200,7 +200,7 @@
LOG(INFO) << "ImageSpace::Init entering image_filename=" << image_filename;
}
- UniquePtr<File> file(OS::OpenFileForReading(image_filename));
+ std::unique_ptr<File> file(OS::OpenFileForReading(image_filename));
if (file.get() == NULL) {
*error_msg = StringPrintf("Failed to open '%s'", image_filename);
return nullptr;
@@ -213,7 +213,7 @@
}
// Note: The image header is part of the image due to mmap page alignment required of offset.
- UniquePtr<MemMap> map(MemMap::MapFileAtAddress(image_header.GetImageBegin(),
+ std::unique_ptr<MemMap> map(MemMap::MapFileAtAddress(image_header.GetImageBegin(),
image_header.GetImageSize(),
PROT_READ | PROT_WRITE,
MAP_PRIVATE,
@@ -229,7 +229,7 @@
CHECK_EQ(image_header.GetImageBegin(), map->Begin());
DCHECK_EQ(0, memcmp(&image_header, map->Begin(), sizeof(ImageHeader)));
- UniquePtr<MemMap> image_map(MemMap::MapFileAtAddress(nullptr, image_header.GetImageBitmapSize(),
+ std::unique_ptr<MemMap> image_map(MemMap::MapFileAtAddress(nullptr, image_header.GetImageBitmapSize(),
PROT_READ, MAP_PRIVATE,
file->Fd(), image_header.GetBitmapOffset(),
false,
@@ -242,7 +242,7 @@
uint32_t bitmap_index = bitmap_index_.FetchAndAdd(1);
std::string bitmap_name(StringPrintf("imagespace %s live-bitmap %u", image_filename,
bitmap_index));
- UniquePtr<accounting::ContinuousSpaceBitmap> bitmap(
+ std::unique_ptr<accounting::ContinuousSpaceBitmap> bitmap(
accounting::ContinuousSpaceBitmap::CreateFromMemMap(bitmap_name, image_map.release(),
reinterpret_cast<byte*>(map->Begin()),
map->Size()));
@@ -251,7 +251,7 @@
return nullptr;
}
- UniquePtr<ImageSpace> space(new ImageSpace(image_filename, image_location,
+ std::unique_ptr<ImageSpace> space(new ImageSpace(image_filename, image_location,
map.release(), bitmap.release()));
if (kIsDebugBuild) {
space->VerifyImageAllocations();
diff --git a/runtime/gc/space/image_space.h b/runtime/gc/space/image_space.h
index 1dc6c57..372db3a 100644
--- a/runtime/gc/space/image_space.h
+++ b/runtime/gc/space/image_space.h
@@ -128,7 +128,7 @@
static Atomic<uint32_t> bitmap_index_;
- UniquePtr<accounting::ContinuousSpaceBitmap> live_bitmap_;
+ std::unique_ptr<accounting::ContinuousSpaceBitmap> live_bitmap_;
ImageSpace(const std::string& name, const char* image_location,
MemMap* mem_map, accounting::ContinuousSpaceBitmap* live_bitmap);
@@ -136,7 +136,7 @@
// The OatFile associated with the image during early startup to
// reserve space contiguous to the image. It is later released to
// the ClassLinker during it's initialization.
- UniquePtr<OatFile> oat_file_;
+ std::unique_ptr<OatFile> oat_file_;
const std::string image_location_;
diff --git a/runtime/gc/space/large_object_space.cc b/runtime/gc/space/large_object_space.cc
index 6c851af..e63cc39 100644
--- a/runtime/gc/space/large_object_space.cc
+++ b/runtime/gc/space/large_object_space.cc
@@ -16,11 +16,12 @@
#include "large_object_space.h"
+#include <memory>
+
#include "gc/accounting/space_bitmap-inl.h"
#include "base/logging.h"
#include "base/mutex-inl.h"
#include "base/stl_util.h"
-#include "UniquePtrCompat.h"
#include "image.h"
#include "os.h"
#include "space-inl.h"
diff --git a/runtime/gc/space/large_object_space.h b/runtime/gc/space/large_object_space.h
index 0daefba..a84b43a 100644
--- a/runtime/gc/space/large_object_space.h
+++ b/runtime/gc/space/large_object_space.h
@@ -133,9 +133,9 @@
// Used to ensure mutual exclusion when the allocation spaces data structures are being modified.
mutable Mutex lock_ DEFAULT_MUTEX_ACQUIRED_AFTER;
std::vector<mirror::Object*,
- accounting::GcAllocator<mirror::Object*> > large_objects_ GUARDED_BY(lock_);
+ accounting::GcAllocator<mirror::Object*>> large_objects_ GUARDED_BY(lock_);
typedef SafeMap<mirror::Object*, MemMap*, std::less<mirror::Object*>,
- accounting::GcAllocator<std::pair<mirror::Object*, MemMap*> > > MemMaps;
+ accounting::GcAllocator<std::pair<mirror::Object*, MemMap*>>> MemMaps;
MemMaps mem_maps_ GUARDED_BY(lock_);
};
@@ -256,11 +256,11 @@
AllocationHeader* GetAllocationHeader(const mirror::Object* obj);
typedef std::set<AllocationHeader*, AllocationHeader::SortByPrevFree,
- accounting::GcAllocator<AllocationHeader*> > FreeBlocks;
+ accounting::GcAllocator<AllocationHeader*>> FreeBlocks;
// There is not footer for any allocations at the end of the space, so we keep track of how much
// free space there is at the end manually.
- UniquePtr<MemMap> mem_map_;
+ std::unique_ptr<MemMap> mem_map_;
Mutex lock_ DEFAULT_MUTEX_ACQUIRED_AFTER;
size_t free_end_ GUARDED_BY(lock_);
FreeBlocks free_blocks_ GUARDED_BY(lock_);
diff --git a/runtime/gc/space/large_object_space_test.cc b/runtime/gc/space/large_object_space_test.cc
index 8a6636d..23c67ff 100644
--- a/runtime/gc/space/large_object_space_test.cc
+++ b/runtime/gc/space/large_object_space_test.cc
@@ -39,7 +39,7 @@
static const size_t num_allocations = 64;
static const size_t max_allocation_size = 0x100000;
- std::vector<std::pair<mirror::Object*, size_t> > requests;
+ std::vector<std::pair<mirror::Object*, size_t>> requests;
for (size_t phase = 0; phase < 2; ++phase) {
while (requests.size() < num_allocations) {
diff --git a/runtime/gc/space/malloc_space.cc b/runtime/gc/space/malloc_space.cc
index ba46dcc..e710409 100644
--- a/runtime/gc/space/malloc_space.cc
+++ b/runtime/gc/space/malloc_space.cc
@@ -188,7 +188,7 @@
VLOG(heap) << "Capacity " << PrettySize(capacity);
// Remap the tail.
std::string error_msg;
- UniquePtr<MemMap> mem_map(GetMemMap()->RemapAtEnd(end_, alloc_space_name,
+ std::unique_ptr<MemMap> mem_map(GetMemMap()->RemapAtEnd(end_, alloc_space_name,
PROT_READ | PROT_WRITE, &error_msg));
CHECK(mem_map.get() != nullptr) << error_msg;
void* allocator = CreateAllocator(end_, starting_size_, initial_size_, capacity, low_memory_mode);
diff --git a/runtime/gc/space/space.h b/runtime/gc/space/space.h
index 343bc29..8415fa1 100644
--- a/runtime/gc/space/space.h
+++ b/runtime/gc/space/space.h
@@ -17,9 +17,9 @@
#ifndef ART_RUNTIME_GC_SPACE_SPACE_H_
#define ART_RUNTIME_GC_SPACE_SPACE_H_
+#include <memory>
#include <string>
-#include "UniquePtrCompat.h"
#include "base/macros.h"
#include "base/mutex.h"
#include "gc/accounting/space_bitmap.h"
@@ -339,8 +339,8 @@
protected:
DiscontinuousSpace(const std::string& name, GcRetentionPolicy gc_retention_policy);
- UniquePtr<accounting::LargeObjectBitmap> live_bitmap_;
- UniquePtr<accounting::LargeObjectBitmap> mark_bitmap_;
+ std::unique_ptr<accounting::LargeObjectBitmap> live_bitmap_;
+ std::unique_ptr<accounting::LargeObjectBitmap> mark_bitmap_;
private:
DISALLOW_COPY_AND_ASSIGN(DiscontinuousSpace);
@@ -374,7 +374,7 @@
}
// Underlying storage of the space
- UniquePtr<MemMap> mem_map_;
+ std::unique_ptr<MemMap> mem_map_;
private:
DISALLOW_COPY_AND_ASSIGN(MemMapSpace);
@@ -419,9 +419,9 @@
virtual accounting::ContinuousSpaceBitmap::SweepCallback* GetSweepCallback() = 0;
protected:
- UniquePtr<accounting::ContinuousSpaceBitmap> live_bitmap_;
- UniquePtr<accounting::ContinuousSpaceBitmap> mark_bitmap_;
- UniquePtr<accounting::ContinuousSpaceBitmap> temp_bitmap_;
+ std::unique_ptr<accounting::ContinuousSpaceBitmap> live_bitmap_;
+ std::unique_ptr<accounting::ContinuousSpaceBitmap> mark_bitmap_;
+ std::unique_ptr<accounting::ContinuousSpaceBitmap> temp_bitmap_;
ContinuousMemMapAllocSpace(const std::string& name, MemMap* mem_map, byte* begin,
byte* end, byte* limit, GcRetentionPolicy gc_retention_policy)
diff --git a/runtime/gc/space/space_test.h b/runtime/gc/space/space_test.h
index 407d362..a2d4942 100644
--- a/runtime/gc/space/space_test.h
+++ b/runtime/gc/space/space_test.h
@@ -20,10 +20,10 @@
#include "zygote_space.h"
#include <stdint.h>
+#include <memory>
#include "common_runtime_test.h"
#include "globals.h"
-#include "UniquePtrCompat.h"
#include "mirror/array-inl.h"
#include "mirror/object-inl.h"
@@ -129,37 +129,37 @@
void SpaceTest::InitTestBody(CreateSpaceFn create_space) {
{
// Init < max == growth
- UniquePtr<Space> space(create_space("test", 16 * MB, 32 * MB, 32 * MB, nullptr));
+ std::unique_ptr<Space> space(create_space("test", 16 * MB, 32 * MB, 32 * MB, nullptr));
EXPECT_TRUE(space.get() != nullptr);
}
{
// Init == max == growth
- UniquePtr<Space> space(create_space("test", 16 * MB, 16 * MB, 16 * MB, nullptr));
+ std::unique_ptr<Space> space(create_space("test", 16 * MB, 16 * MB, 16 * MB, nullptr));
EXPECT_TRUE(space.get() != nullptr);
}
{
// Init > max == growth
- UniquePtr<Space> space(create_space("test", 32 * MB, 16 * MB, 16 * MB, nullptr));
+ std::unique_ptr<Space> space(create_space("test", 32 * MB, 16 * MB, 16 * MB, nullptr));
EXPECT_TRUE(space.get() == nullptr);
}
{
// Growth == init < max
- UniquePtr<Space> space(create_space("test", 16 * MB, 16 * MB, 32 * MB, nullptr));
+ std::unique_ptr<Space> space(create_space("test", 16 * MB, 16 * MB, 32 * MB, nullptr));
EXPECT_TRUE(space.get() != nullptr);
}
{
// Growth < init < max
- UniquePtr<Space> space(create_space("test", 16 * MB, 8 * MB, 32 * MB, nullptr));
+ std::unique_ptr<Space> space(create_space("test", 16 * MB, 8 * MB, 32 * MB, nullptr));
EXPECT_TRUE(space.get() == nullptr);
}
{
// Init < growth < max
- UniquePtr<Space> space(create_space("test", 8 * MB, 16 * MB, 32 * MB, nullptr));
+ std::unique_ptr<Space> space(create_space("test", 8 * MB, 16 * MB, 32 * MB, nullptr));
EXPECT_TRUE(space.get() != nullptr);
}
{
// Init < max < growth
- UniquePtr<Space> space(create_space("test", 8 * MB, 32 * MB, 16 * MB, nullptr));
+ std::unique_ptr<Space> space(create_space("test", 8 * MB, 32 * MB, 16 * MB, nullptr));
EXPECT_TRUE(space.get() == nullptr);
}
}
@@ -398,7 +398,7 @@
// Fill the space with lots of small objects up to the growth limit
size_t max_objects = (growth_limit / (object_size > 0 ? object_size : 8)) + 1;
- UniquePtr<mirror::Object*[]> lots_of_objects(new mirror::Object*[max_objects]);
+ std::unique_ptr<mirror::Object*[]> lots_of_objects(new mirror::Object*[max_objects]);
size_t last_object = 0; // last object for which allocation succeeded
size_t amount_allocated = 0; // amount of space allocated
Thread* self = Thread::Current();
diff --git a/runtime/hprof/hprof.cc b/runtime/hprof/hprof.cc
index fc8b594..91f1718 100644
--- a/runtime/hprof/hprof.cc
+++ b/runtime/hprof/hprof.cc
@@ -475,7 +475,7 @@
}
}
- UniquePtr<File> file(new File(out_fd, filename_));
+ std::unique_ptr<File> file(new File(out_fd, filename_));
okay = file->WriteFully(header_data_ptr_, header_data_size_) &&
file->WriteFully(body_data_ptr_, body_data_size_);
if (!okay) {
diff --git a/runtime/indirect_reference_table.h b/runtime/indirect_reference_table.h
index 833b07a..5015410 100644
--- a/runtime/indirect_reference_table.h
+++ b/runtime/indirect_reference_table.h
@@ -363,9 +363,9 @@
IRTSegmentState segment_state_;
// Mem map where we store the indirect refs.
- UniquePtr<MemMap> table_mem_map_;
+ std::unique_ptr<MemMap> table_mem_map_;
// Mem map where we store the extended debugging info.
- UniquePtr<MemMap> slot_mem_map_;
+ std::unique_ptr<MemMap> slot_mem_map_;
/* bottom of the stack */
mirror::Object** table_;
/* bit mask, ORed into all irefs */
diff --git a/runtime/instrumentation.cc b/runtime/instrumentation.cc
index 77d29dd..075d225 100644
--- a/runtime/instrumentation.cc
+++ b/runtime/instrumentation.cc
@@ -252,7 +252,7 @@
}
Instrumentation* instrumentation = reinterpret_cast<Instrumentation*>(arg);
- UniquePtr<Context> context(Context::Create());
+ std::unique_ptr<Context> context(Context::Create());
uintptr_t instrumentation_exit_pc = GetQuickInstrumentationExitPc();
InstallStackVisitor visitor(thread, context.get(), instrumentation_exit_pc);
visitor.WalkStack(true);
diff --git a/runtime/intern_table.cc b/runtime/intern_table.cc
index 2a8cc63..817d104 100644
--- a/runtime/intern_table.cc
+++ b/runtime/intern_table.cc
@@ -16,13 +16,14 @@
#include "intern_table.h"
+#include <memory>
+
#include "gc/space/image_space.h"
#include "mirror/dex_cache.h"
#include "mirror/object_array-inl.h"
#include "mirror/object-inl.h"
#include "mirror/string.h"
#include "thread.h"
-#include "UniquePtrCompat.h"
#include "utf.h"
namespace art {
diff --git a/runtime/intern_table.h b/runtime/intern_table.h
index 7dd06c6..47d5e09 100644
--- a/runtime/intern_table.h
+++ b/runtime/intern_table.h
@@ -105,7 +105,7 @@
bool allow_new_interns_ GUARDED_BY(Locks::intern_table_lock_);
ConditionVariable new_intern_condition_ GUARDED_BY(Locks::intern_table_lock_);
Table strong_interns_ GUARDED_BY(Locks::intern_table_lock_);
- std::vector<std::pair<int32_t, mirror::String*> > new_strong_intern_roots_
+ std::vector<std::pair<int32_t, mirror::String*>> new_strong_intern_roots_
GUARDED_BY(Locks::intern_table_lock_);
Table weak_interns_ GUARDED_BY(Locks::intern_table_lock_);
};
diff --git a/runtime/jdwp/jdwp_handler.cc b/runtime/jdwp/jdwp_handler.cc
index 00be016..05bfe0d 100644
--- a/runtime/jdwp/jdwp_handler.cc
+++ b/runtime/jdwp/jdwp_handler.cc
@@ -17,7 +17,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-
+#include <memory>
#include <string>
#include "atomic.h"
@@ -32,7 +32,6 @@
#include "jdwp/jdwp_priv.h"
#include "runtime.h"
#include "thread-inl.h"
-#include "UniquePtrCompat.h"
namespace art {
@@ -107,8 +106,8 @@
Dbg::GetMethodName(method_id).c_str());
VLOG(jdwp) << StringPrintf(" %d args:", arg_count);
- UniquePtr<JdwpTag[]> argTypes(arg_count > 0 ? new JdwpTag[arg_count] : NULL);
- UniquePtr<uint64_t[]> argValues(arg_count > 0 ? new uint64_t[arg_count] : NULL);
+ std::unique_ptr<JdwpTag[]> argTypes(arg_count > 0 ? new JdwpTag[arg_count] : NULL);
+ std::unique_ptr<uint64_t[]> argValues(arg_count > 0 ? new uint64_t[arg_count] : NULL);
for (int32_t i = 0; i < arg_count; ++i) {
argTypes[i] = request.ReadTag();
size_t width = Dbg::GetTagWidth(argTypes[i]);
diff --git a/runtime/jdwp/jdwp_main.cc b/runtime/jdwp/jdwp_main.cc
index 2419ca6..64e9f37 100644
--- a/runtime/jdwp/jdwp_main.cc
+++ b/runtime/jdwp/jdwp_main.cc
@@ -235,7 +235,7 @@
JdwpState* JdwpState::Create(const JdwpOptions* options) {
Thread* self = Thread::Current();
Locks::mutator_lock_->AssertNotHeld(self);
- UniquePtr<JdwpState> state(new JdwpState(options));
+ std::unique_ptr<JdwpState> state(new JdwpState(options));
switch (options->transport) {
case kJdwpTransportSocket:
InitSocketTransport(state.get(), options);
diff --git a/runtime/jni_internal.cc b/runtime/jni_internal.cc
index 17a3de4..80969bf 100644
--- a/runtime/jni_internal.cc
+++ b/runtime/jni_internal.cc
@@ -19,6 +19,7 @@
#include <dlfcn.h>
#include <cstdarg>
+#include <memory>
#include <utility>
#include <vector>
@@ -49,7 +50,6 @@
#include "ScopedLocalRef.h"
#include "thread.h"
#include "utf.h"
-#include "UniquePtrCompat.h"
#include "well_known_classes.h"
namespace art {
diff --git a/runtime/jni_internal_test.cc b/runtime/jni_internal_test.cc
index 83e9b10..3429827 100644
--- a/runtime/jni_internal_test.cc
+++ b/runtime/jni_internal_test.cc
@@ -539,8 +539,8 @@
ExpectException(aioobe_); \
\
/* Prepare a couple of buffers. */ \
- UniquePtr<scalar_type[]> src_buf(new scalar_type[size]); \
- UniquePtr<scalar_type[]> dst_buf(new scalar_type[size]); \
+ std::unique_ptr<scalar_type[]> src_buf(new scalar_type[size]); \
+ std::unique_ptr<scalar_type[]> dst_buf(new scalar_type[size]); \
for (jsize i = 0; i < size; ++i) { src_buf[i] = scalar_type(i); } \
for (jsize i = 0; i < size; ++i) { dst_buf[i] = scalar_type(-1); } \
\
diff --git a/runtime/leb128_test.cc b/runtime/leb128_test.cc
index d75d5c2..5d157dc 100644
--- a/runtime/leb128_test.cc
+++ b/runtime/leb128_test.cc
@@ -253,8 +253,8 @@
}
TEST(Leb128Test, Speed) {
- UniquePtr<Histogram<uint64_t> > enc_hist(new Histogram<uint64_t>("Leb128EncodeSpeedTest", 5));
- UniquePtr<Histogram<uint64_t> > dec_hist(new Histogram<uint64_t>("Leb128DecodeSpeedTest", 5));
+ std::unique_ptr<Histogram<uint64_t>> enc_hist(new Histogram<uint64_t>("Leb128EncodeSpeedTest", 5));
+ std::unique_ptr<Histogram<uint64_t>> dec_hist(new Histogram<uint64_t>("Leb128DecodeSpeedTest", 5));
Leb128EncodingVector builder;
// Push back 1024 chunks of 1024 values measuring encoding speed.
uint64_t last_time = NanoTime();
diff --git a/runtime/mem_map.cc b/runtime/mem_map.cc
index ffafc85..8a555fb 100644
--- a/runtime/mem_map.cc
+++ b/runtime/mem_map.cc
@@ -18,8 +18,8 @@
#include <inttypes.h>
#include <backtrace/BacktraceMap.h>
+#include <memory>
-#include "UniquePtrCompat.h"
#include "base/stringprintf.h"
#include "ScopedFd.h"
#include "utils.h"
@@ -76,7 +76,7 @@
uintptr_t expected = reinterpret_cast<uintptr_t>(expected_ptr);
uintptr_t limit = expected + byte_count;
- UniquePtr<BacktraceMap> map(BacktraceMap::Create(getpid()));
+ std::unique_ptr<BacktraceMap> map(BacktraceMap::Create(getpid()));
if (!map->Build()) {
*error_msg << StringPrintf("Failed to build process map to determine why mmap returned "
"0x%08" PRIxPTR " instead of 0x%08" PRIxPTR, actual, expected);
diff --git a/runtime/mem_map_test.cc b/runtime/mem_map_test.cc
index b26f563..c07a9a3 100644
--- a/runtime/mem_map_test.cc
+++ b/runtime/mem_map_test.cc
@@ -16,7 +16,8 @@
#include "mem_map.h"
-#include "UniquePtrCompat.h"
+#include <memory>
+
#include "gtest/gtest.h"
namespace art {
@@ -87,7 +88,7 @@
TEST_F(MemMapTest, MapAnonymousEmpty) {
std::string error_msg;
- UniquePtr<MemMap> map(MemMap::MapAnonymous("MapAnonymousEmpty",
+ std::unique_ptr<MemMap> map(MemMap::MapAnonymous("MapAnonymousEmpty",
nullptr,
0,
PROT_READ,
@@ -108,7 +109,7 @@
#ifdef __LP64__
TEST_F(MemMapTest, MapAnonymousEmpty32bit) {
std::string error_msg;
- UniquePtr<MemMap> map(MemMap::MapAnonymous("MapAnonymousEmpty",
+ std::unique_ptr<MemMap> map(MemMap::MapAnonymous("MapAnonymousEmpty",
nullptr,
kPageSize,
PROT_READ | PROT_WRITE,
@@ -123,7 +124,7 @@
TEST_F(MemMapTest, MapAnonymousExactAddr) {
std::string error_msg;
// Map at an address that should work, which should succeed.
- UniquePtr<MemMap> map0(MemMap::MapAnonymous("MapAnonymous0",
+ std::unique_ptr<MemMap> map0(MemMap::MapAnonymous("MapAnonymous0",
reinterpret_cast<byte*>(ART_BASE_ADDRESS),
kPageSize,
PROT_READ | PROT_WRITE,
@@ -133,7 +134,7 @@
ASSERT_TRUE(error_msg.empty());
ASSERT_TRUE(map0->BaseBegin() == reinterpret_cast<void*>(ART_BASE_ADDRESS));
// Map at an unspecified address, which should succeed.
- UniquePtr<MemMap> map1(MemMap::MapAnonymous("MapAnonymous1",
+ std::unique_ptr<MemMap> map1(MemMap::MapAnonymous("MapAnonymous1",
nullptr,
kPageSize,
PROT_READ | PROT_WRITE,
@@ -143,7 +144,7 @@
ASSERT_TRUE(error_msg.empty());
ASSERT_TRUE(map1->BaseBegin() != nullptr);
// Attempt to map at the same address, which should fail.
- UniquePtr<MemMap> map2(MemMap::MapAnonymous("MapAnonymous2",
+ std::unique_ptr<MemMap> map2(MemMap::MapAnonymous("MapAnonymous2",
reinterpret_cast<byte*>(map1->BaseBegin()),
kPageSize,
PROT_READ | PROT_WRITE,
@@ -165,7 +166,7 @@
TEST_F(MemMapTest, MapAnonymousExactAddr32bitHighAddr) {
std::string error_msg;
- UniquePtr<MemMap> map(MemMap::MapAnonymous("MapAnonymousExactAddr32bitHighAddr",
+ std::unique_ptr<MemMap> map(MemMap::MapAnonymous("MapAnonymousExactAddr32bitHighAddr",
reinterpret_cast<byte*>(0x71000000),
0x21000000,
PROT_READ | PROT_WRITE,
@@ -180,7 +181,7 @@
std::string error_msg;
uintptr_t ptr = 0;
ptr -= kPageSize; // Now it's close to the top.
- UniquePtr<MemMap> map(MemMap::MapAnonymous("MapAnonymousOverflow",
+ std::unique_ptr<MemMap> map(MemMap::MapAnonymous("MapAnonymousOverflow",
reinterpret_cast<byte*>(ptr),
2 * kPageSize, // brings it over the top.
PROT_READ | PROT_WRITE,
@@ -193,7 +194,7 @@
#ifdef __LP64__
TEST_F(MemMapTest, MapAnonymousLow4GBExpectedTooHigh) {
std::string error_msg;
- UniquePtr<MemMap> map(MemMap::MapAnonymous("MapAnonymousLow4GBExpectedTooHigh",
+ std::unique_ptr<MemMap> map(MemMap::MapAnonymous("MapAnonymousLow4GBExpectedTooHigh",
reinterpret_cast<byte*>(UINT64_C(0x100000000)),
kPageSize,
PROT_READ | PROT_WRITE,
@@ -205,7 +206,7 @@
TEST_F(MemMapTest, MapAnonymousLow4GBRangeTooHigh) {
std::string error_msg;
- UniquePtr<MemMap> map(MemMap::MapAnonymous("MapAnonymousLow4GBRangeTooHigh",
+ std::unique_ptr<MemMap> map(MemMap::MapAnonymous("MapAnonymousLow4GBRangeTooHigh",
reinterpret_cast<byte*>(0xF0000000),
0x20000000,
PROT_READ | PROT_WRITE,
diff --git a/runtime/mirror/art_method-inl.h b/runtime/mirror/art_method-inl.h
index cde977b..b7ca188 100644
--- a/runtime/mirror/art_method-inl.h
+++ b/runtime/mirror/art_method-inl.h
@@ -62,17 +62,17 @@
}
inline ObjectArray<String>* ArtMethod::GetDexCacheStrings() {
- return GetFieldObject<ObjectArray<String> >(
+ return GetFieldObject<ObjectArray<String>>(
OFFSET_OF_OBJECT_MEMBER(ArtMethod, dex_cache_strings_));
}
inline ObjectArray<ArtMethod>* ArtMethod::GetDexCacheResolvedMethods() {
- return GetFieldObject<ObjectArray<ArtMethod> >(
+ return GetFieldObject<ObjectArray<ArtMethod>>(
OFFSET_OF_OBJECT_MEMBER(ArtMethod, dex_cache_resolved_methods_));
}
inline ObjectArray<Class>* ArtMethod::GetDexCacheResolvedTypes() {
- return GetFieldObject<ObjectArray<Class> >(
+ return GetFieldObject<ObjectArray<Class>>(
OFFSET_OF_OBJECT_MEMBER(ArtMethod, dex_cache_resolved_types_));
}
diff --git a/runtime/mirror/art_method.h b/runtime/mirror/art_method.h
index 3950a98..37f26a2 100644
--- a/runtime/mirror/art_method.h
+++ b/runtime/mirror/art_method.h
@@ -407,13 +407,13 @@
HeapReference<Class> declaring_class_;
// Short cuts to declaring_class_->dex_cache_ member for fast compiled code access.
- HeapReference<ObjectArray<ArtMethod> > dex_cache_resolved_methods_;
+ HeapReference<ObjectArray<ArtMethod>> dex_cache_resolved_methods_;
// Short cuts to declaring_class_->dex_cache_ member for fast compiled code access.
- HeapReference<ObjectArray<Class> > dex_cache_resolved_types_;
+ HeapReference<ObjectArray<Class>> dex_cache_resolved_types_;
// Short cuts to declaring_class_->dex_cache_ member for fast compiled code access.
- HeapReference<ObjectArray<String> > dex_cache_strings_;
+ HeapReference<ObjectArray<String>> dex_cache_strings_;
// Method dispatch from the interpreter invokes this pointer which may cause a bridge into
// compiled code.
diff --git a/runtime/mirror/class-inl.h b/runtime/mirror/class-inl.h
index b2d8288..18be2f1 100644
--- a/runtime/mirror/class-inl.h
+++ b/runtime/mirror/class-inl.h
@@ -64,12 +64,12 @@
inline ObjectArray<ArtMethod>* Class::GetDirectMethods() {
DCHECK(IsLoaded() || IsErroneous());
- return GetFieldObject<ObjectArray<ArtMethod> >(OFFSET_OF_OBJECT_MEMBER(Class, direct_methods_));
+ return GetFieldObject<ObjectArray<ArtMethod>>(OFFSET_OF_OBJECT_MEMBER(Class, direct_methods_));
}
inline void Class::SetDirectMethods(ObjectArray<ArtMethod>* new_direct_methods)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- DCHECK(NULL == GetFieldObject<ObjectArray<ArtMethod> >(
+ DCHECK(NULL == GetFieldObject<ObjectArray<ArtMethod>>(
OFFSET_OF_OBJECT_MEMBER(Class, direct_methods_)));
DCHECK_NE(0, new_direct_methods->GetLength());
SetFieldObject<false>(OFFSET_OF_OBJECT_MEMBER(Class, direct_methods_), new_direct_methods);
@@ -82,7 +82,7 @@
inline void Class::SetDirectMethod(uint32_t i, ArtMethod* f) // TODO: uint16_t
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
ObjectArray<ArtMethod>* direct_methods =
- GetFieldObject<ObjectArray<ArtMethod> >(OFFSET_OF_OBJECT_MEMBER(Class, direct_methods_));
+ GetFieldObject<ObjectArray<ArtMethod>>(OFFSET_OF_OBJECT_MEMBER(Class, direct_methods_));
direct_methods->Set<false>(i, f);
}
@@ -94,7 +94,7 @@
template<VerifyObjectFlags kVerifyFlags>
inline ObjectArray<ArtMethod>* Class::GetVirtualMethods() {
DCHECK(IsLoaded() || IsErroneous());
- return GetFieldObject<ObjectArray<ArtMethod> >(OFFSET_OF_OBJECT_MEMBER(Class, virtual_methods_));
+ return GetFieldObject<ObjectArray<ArtMethod>>(OFFSET_OF_OBJECT_MEMBER(Class, virtual_methods_));
}
inline void Class::SetVirtualMethods(ObjectArray<ArtMethod>* new_virtual_methods) {
@@ -122,18 +122,18 @@
inline void Class::SetVirtualMethod(uint32_t i, ArtMethod* f) // TODO: uint16_t
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
ObjectArray<ArtMethod>* virtual_methods =
- GetFieldObject<ObjectArray<ArtMethod> >(OFFSET_OF_OBJECT_MEMBER(Class, virtual_methods_));
+ GetFieldObject<ObjectArray<ArtMethod>>(OFFSET_OF_OBJECT_MEMBER(Class, virtual_methods_));
virtual_methods->Set<false>(i, f);
}
inline ObjectArray<ArtMethod>* Class::GetVTable() {
DCHECK(IsResolved() || IsErroneous());
- return GetFieldObject<ObjectArray<ArtMethod> >(OFFSET_OF_OBJECT_MEMBER(Class, vtable_));
+ return GetFieldObject<ObjectArray<ArtMethod>>(OFFSET_OF_OBJECT_MEMBER(Class, vtable_));
}
inline ObjectArray<ArtMethod>* Class::GetVTableDuringLinking() {
DCHECK(IsLoaded() || IsErroneous());
- return GetFieldObject<ObjectArray<ArtMethod> >(OFFSET_OF_OBJECT_MEMBER(Class, vtable_));
+ return GetFieldObject<ObjectArray<ArtMethod>>(OFFSET_OF_OBJECT_MEMBER(Class, vtable_));
}
inline void Class::SetVTable(ObjectArray<ArtMethod>* new_vtable) {
@@ -141,7 +141,7 @@
}
inline ObjectArray<ArtMethod>* Class::GetImTable() {
- return GetFieldObject<ObjectArray<ArtMethod> >(OFFSET_OF_OBJECT_MEMBER(Class, imtable_));
+ return GetFieldObject<ObjectArray<ArtMethod>>(OFFSET_OF_OBJECT_MEMBER(Class, imtable_));
}
inline void Class::SetImTable(ObjectArray<ArtMethod>* new_imtable) {
@@ -362,18 +362,18 @@
inline void Class::SetIFields(ObjectArray<ArtField>* new_ifields)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- DCHECK(NULL == GetFieldObject<ObjectArray<ArtField> >(OFFSET_OF_OBJECT_MEMBER(Class, ifields_)));
+ DCHECK(NULL == GetFieldObject<ObjectArray<ArtField>>(OFFSET_OF_OBJECT_MEMBER(Class, ifields_)));
SetFieldObject<false>(OFFSET_OF_OBJECT_MEMBER(Class, ifields_), new_ifields);
}
inline ObjectArray<ArtField>* Class::GetSFields() {
DCHECK(IsLoaded() || IsErroneous());
- return GetFieldObject<ObjectArray<ArtField> >(OFFSET_OF_OBJECT_MEMBER(Class, sfields_));
+ return GetFieldObject<ObjectArray<ArtField>>(OFFSET_OF_OBJECT_MEMBER(Class, sfields_));
}
inline void Class::SetSFields(ObjectArray<ArtField>* new_sfields)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- DCHECK(NULL == GetFieldObject<ObjectArray<ArtField> >(OFFSET_OF_OBJECT_MEMBER(Class, sfields_)));
+ DCHECK(NULL == GetFieldObject<ObjectArray<ArtField>>(OFFSET_OF_OBJECT_MEMBER(Class, sfields_)));
SetFieldObject<false>(OFFSET_OF_OBJECT_MEMBER(Class, sfields_), new_sfields);
}
@@ -389,7 +389,7 @@
inline void Class::SetStaticField(uint32_t i, ArtField* f) // TODO: uint16_t
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- ObjectArray<ArtField>* sfields= GetFieldObject<ObjectArray<ArtField> >(
+ ObjectArray<ArtField>* sfields= GetFieldObject<ObjectArray<ArtField>>(
OFFSET_OF_OBJECT_MEMBER(Class, sfields_));
sfields->Set<false>(i, f);
}
@@ -405,7 +405,7 @@
inline void Class::SetInstanceField(uint32_t i, ArtField* f) // TODO: uint16_t
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- ObjectArray<ArtField>* ifields= GetFieldObject<ObjectArray<ArtField> >(
+ ObjectArray<ArtField>* ifields= GetFieldObject<ObjectArray<ArtField>>(
OFFSET_OF_OBJECT_MEMBER(Class, ifields_));
ifields->Set<false>(i, f);
}
diff --git a/runtime/mirror/class.h b/runtime/mirror/class.h
index a283f60..d8cbb32 100644
--- a/runtime/mirror/class.h
+++ b/runtime/mirror/class.h
@@ -904,7 +904,7 @@
HeapReference<DexCache> dex_cache_;
// static, private, and <init> methods
- HeapReference<ObjectArray<ArtMethod> > direct_methods_;
+ HeapReference<ObjectArray<ArtMethod>> direct_methods_;
// instance fields
//
@@ -916,7 +916,7 @@
// All instance fields that refer to objects are guaranteed to be at
// the beginning of the field list. num_reference_instance_fields_
// specifies the number of reference fields.
- HeapReference<ObjectArray<ArtField> > ifields_;
+ HeapReference<ObjectArray<ArtField>> ifields_;
// The interface table (iftable_) contains pairs of a interface class and an array of the
// interface methods. There is one pair per interface supported by this class. That means one
@@ -932,7 +932,7 @@
HeapReference<IfTable> iftable_;
// Interface method table (imt), for quick "invoke-interface".
- HeapReference<ObjectArray<ArtMethod> > imtable_;
+ HeapReference<ObjectArray<ArtMethod>> imtable_;
// Descriptor for the class such as "java.lang.Class" or "[C". Lazily initialized by ComputeName
HeapReference<String> name_;
@@ -947,13 +947,13 @@
HeapReference<Class> verify_error_class_;
// Virtual methods defined in this class; invoked through vtable.
- HeapReference<ObjectArray<ArtMethod> > virtual_methods_;
+ HeapReference<ObjectArray<ArtMethod>> virtual_methods_;
// Virtual method table (vtable), for use by "invoke-virtual". The vtable from the superclass is
// copied in, and virtual methods from our class either replace those from the super or are
// appended. For abstract classes, methods may be created in the vtable that aren't in
// virtual_ methods_ for miranda methods.
- HeapReference<ObjectArray<ArtMethod> > vtable_;
+ HeapReference<ObjectArray<ArtMethod>> vtable_;
// Access flags; low 16 bits are defined by VM spec.
uint32_t access_flags_;
diff --git a/runtime/mirror/dex_cache.h b/runtime/mirror/dex_cache.h
index 11a4002..65a5026 100644
--- a/runtime/mirror/dex_cache.h
+++ b/runtime/mirror/dex_cache.h
@@ -123,22 +123,22 @@
}
ObjectArray<String>* GetStrings() ALWAYS_INLINE SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- return GetFieldObject< ObjectArray<String> >(StringsOffset());
+ return GetFieldObject< ObjectArray<String>>(StringsOffset());
}
ObjectArray<Class>* GetResolvedTypes() ALWAYS_INLINE SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- return GetFieldObject<ObjectArray<Class> >(
+ return GetFieldObject<ObjectArray<Class>>(
OFFSET_OF_OBJECT_MEMBER(DexCache, resolved_types_));
}
ObjectArray<ArtMethod>* GetResolvedMethods() ALWAYS_INLINE
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- return GetFieldObject< ObjectArray<ArtMethod> >(ResolvedMethodsOffset());
+ return GetFieldObject< ObjectArray<ArtMethod>>(ResolvedMethodsOffset());
}
ObjectArray<ArtField>* GetResolvedFields() ALWAYS_INLINE
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- return GetFieldObject<ObjectArray<ArtField> >(ResolvedFieldsOffset());
+ return GetFieldObject<ObjectArray<ArtField>>(ResolvedFieldsOffset());
}
const DexFile* GetDexFile() ALWAYS_INLINE SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
@@ -153,10 +153,10 @@
private:
HeapReference<Object> dex_;
HeapReference<String> location_;
- HeapReference<ObjectArray<ArtField> > resolved_fields_;
- HeapReference<ObjectArray<ArtMethod> > resolved_methods_;
- HeapReference<ObjectArray<Class> > resolved_types_;
- HeapReference<ObjectArray<String> > strings_;
+ HeapReference<ObjectArray<ArtField>> resolved_fields_;
+ HeapReference<ObjectArray<ArtMethod>> resolved_methods_;
+ HeapReference<ObjectArray<Class>> resolved_types_;
+ HeapReference<ObjectArray<String>> strings_;
uint64_t dex_file_;
friend struct art::DexCacheOffsets; // for verifying offset information
diff --git a/runtime/mirror/object_array-inl.h b/runtime/mirror/object_array-inl.h
index 942a271..9b6e901 100644
--- a/runtime/mirror/object_array-inl.h
+++ b/runtime/mirror/object_array-inl.h
@@ -245,7 +245,7 @@
DCHECK_GE(new_length, 0);
// We may get copied by a compacting GC.
StackHandleScope<1> hs(self);
- Handle<ObjectArray<T> > h_this(hs.NewHandle(this));
+ Handle<ObjectArray<T>> h_this(hs.NewHandle(this));
gc::Heap* heap = Runtime::Current()->GetHeap();
gc::AllocatorType allocator_type = heap->IsMovableObject(this) ? heap->GetCurrentAllocator() :
heap->GetCurrentNonMovingAllocator();
diff --git a/runtime/mirror/object_test.cc b/runtime/mirror/object_test.cc
index e24602a..18e50ce 100644
--- a/runtime/mirror/object_test.cc
+++ b/runtime/mirror/object_test.cc
@@ -18,6 +18,7 @@
#include <stdint.h>
#include <stdio.h>
+#include <memory>
#include "array-inl.h"
#include "art_field-inl.h"
@@ -36,7 +37,6 @@
#include "object_array-inl.h"
#include "handle_scope-inl.h"
#include "string-inl.h"
-#include "UniquePtrCompat.h"
namespace art {
namespace mirror {
@@ -48,7 +48,7 @@
const char* utf16_expected_le,
int32_t expected_hash)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- UniquePtr<uint16_t[]> utf16_expected(new uint16_t[expected_utf16_length]);
+ std::unique_ptr<uint16_t[]> utf16_expected(new uint16_t[expected_utf16_length]);
for (int32_t i = 0; i < expected_utf16_length; i++) {
uint16_t ch = (((utf16_expected_le[i*2 + 0] & 0xff) << 8) |
((utf16_expected_le[i*2 + 1] & 0xff) << 0));
@@ -116,7 +116,7 @@
TEST_F(ObjectTest, AllocObjectArray) {
ScopedObjectAccess soa(Thread::Current());
StackHandleScope<2> hs(soa.Self());
- Handle<ObjectArray<Object> > oa(
+ Handle<ObjectArray<Object>> oa(
hs.NewHandle(class_linker_->AllocObjectArray<Object>(soa.Self(), 2)));
EXPECT_EQ(2, oa->GetLength());
EXPECT_TRUE(oa->Get(0) == NULL);
diff --git a/runtime/mirror/proxy.h b/runtime/mirror/proxy.h
index 5f9cceb..6e4947e 100644
--- a/runtime/mirror/proxy.h
+++ b/runtime/mirror/proxy.h
@@ -30,18 +30,18 @@
class MANAGED SynthesizedProxyClass : public Class {
public:
ObjectArray<Class>* GetInterfaces() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- return GetFieldObject<ObjectArray<Class> >(OFFSET_OF_OBJECT_MEMBER(SynthesizedProxyClass,
+ return GetFieldObject<ObjectArray<Class>>(OFFSET_OF_OBJECT_MEMBER(SynthesizedProxyClass,
interfaces_));
}
- ObjectArray<ObjectArray<Class> >* GetThrows() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- return GetFieldObject<ObjectArray<ObjectArray<Class> > >(OFFSET_OF_OBJECT_MEMBER(SynthesizedProxyClass,
+ ObjectArray<ObjectArray<Class>>* GetThrows() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
+ return GetFieldObject<ObjectArray<ObjectArray<Class>>>(OFFSET_OF_OBJECT_MEMBER(SynthesizedProxyClass,
throws_));
}
private:
- HeapReference<ObjectArray<Class> > interfaces_;
- HeapReference<ObjectArray<ObjectArray<Class> > > throws_;
+ HeapReference<ObjectArray<Class>> interfaces_;
+ HeapReference<ObjectArray<ObjectArray<Class>>> throws_;
DISALLOW_IMPLICIT_CONSTRUCTORS(SynthesizedProxyClass);
};
diff --git a/runtime/monitor.cc b/runtime/monitor.cc
index 53e4a6f..0beb651 100644
--- a/runtime/monitor.cc
+++ b/runtime/monitor.cc
@@ -623,7 +623,7 @@
DCHECK(self != NULL);
DCHECK(obj != NULL);
// Allocate and acquire a new monitor.
- UniquePtr<Monitor> m(new Monitor(self, owner, obj, hash_code));
+ std::unique_ptr<Monitor> m(new Monitor(self, owner, obj, hash_code));
if (m->Install(self)) {
if (owner != nullptr) {
VLOG(monitor) << "monitor: thread" << owner->GetThreadId()
diff --git a/runtime/native/dalvik_system_DexFile.cc b/runtime/native/dalvik_system_DexFile.cc
index 27f19a7..9f9d82b 100644
--- a/runtime/native/dalvik_system_DexFile.cc
+++ b/runtime/native/dalvik_system_DexFile.cc
@@ -391,7 +391,7 @@
// Check if we have an odex file next to the dex file.
std::string odex_filename(DexFilenameToOdexFilename(filename, kRuntimeISA));
std::string error_msg;
- UniquePtr<const OatFile> oat_file(OatFile::Open(odex_filename, odex_filename, NULL, false,
+ std::unique_ptr<const OatFile> oat_file(OatFile::Open(odex_filename, odex_filename, NULL, false,
&error_msg));
if (oat_file.get() == nullptr) {
if (kVerboseLogging) {
diff --git a/runtime/native/java_lang_VMClassLoader.cc b/runtime/native/java_lang_VMClassLoader.cc
index cb8e623..f2b8a03 100644
--- a/runtime/native/java_lang_VMClassLoader.cc
+++ b/runtime/native/java_lang_VMClassLoader.cc
@@ -73,12 +73,12 @@
const DexFile* dex_file = path[index];
const std::string& location(dex_file->GetLocation());
std::string error_msg;
- UniquePtr<ZipArchive> zip_archive(ZipArchive::Open(location.c_str(), &error_msg));
+ std::unique_ptr<ZipArchive> zip_archive(ZipArchive::Open(location.c_str(), &error_msg));
if (zip_archive.get() == nullptr) {
LOG(WARNING) << "Failed to open zip archive '" << location << "': " << error_msg;
return NULL;
}
- UniquePtr<ZipEntry> zip_entry(zip_archive->Find(name.c_str(), &error_msg));
+ std::unique_ptr<ZipEntry> zip_entry(zip_archive->Find(name.c_str(), &error_msg));
if (zip_entry.get() == NULL) {
return NULL;
}
diff --git a/runtime/oat_file.cc b/runtime/oat_file.cc
index 46a4d53..74dfe91 100644
--- a/runtime/oat_file.cc
+++ b/runtime/oat_file.cc
@@ -42,7 +42,7 @@
std::string* error_msg) {
CHECK(!oat_contents.empty()) << location;
CheckLocation(location);
- UniquePtr<OatFile> oat_file(new OatFile(location));
+ std::unique_ptr<OatFile> oat_file(new OatFile(location));
oat_file->begin_ = &oat_contents[0];
oat_file->end_ = &oat_contents[oat_contents.size()];
return oat_file->Setup(error_msg) ? oat_file.release() : nullptr;
@@ -71,7 +71,7 @@
//
// On host, dlopen is expected to fail when cross compiling, so fall back to OpenElfFile.
// This won't work for portable runtime execution because it doesn't process relocations.
- UniquePtr<File> file(OS::OpenFileForReading(filename.c_str()));
+ std::unique_ptr<File> file(OS::OpenFileForReading(filename.c_str()));
if (file.get() == NULL) {
*error_msg = StringPrintf("Failed to open oat filename for reading: %s", strerror(errno));
return NULL;
@@ -88,7 +88,7 @@
const std::string& location,
byte* requested_base,
std::string* error_msg) {
- UniquePtr<OatFile> oat_file(new OatFile(location));
+ std::unique_ptr<OatFile> oat_file(new OatFile(location));
bool success = oat_file->Dlopen(elf_filename, requested_base, error_msg);
if (!success) {
return nullptr;
@@ -102,7 +102,7 @@
bool writable,
bool executable,
std::string* error_msg) {
- UniquePtr<OatFile> oat_file(new OatFile(location));
+ std::unique_ptr<OatFile> oat_file(new OatFile(location));
bool success = oat_file->ElfFileOpen(file, requested_base, writable, executable, error_msg);
if (!success) {
CHECK(!error_msg->empty());
diff --git a/runtime/oat_file.h b/runtime/oat_file.h
index 07d70ff..d703731 100644
--- a/runtime/oat_file.h
+++ b/runtime/oat_file.h
@@ -262,10 +262,10 @@
const byte* end_;
// Backing memory map for oat file during when opened by ElfWriter during initial compilation.
- UniquePtr<MemMap> mem_map_;
+ std::unique_ptr<MemMap> mem_map_;
// Backing memory map for oat file during cross compilation.
- UniquePtr<ElfFile> elf_file_;
+ std::unique_ptr<ElfFile> elf_file_;
// dlopen handle during runtime.
void* dlopen_handle_;
diff --git a/runtime/os_linux.cc b/runtime/os_linux.cc
index d9a5813..e4403d7 100644
--- a/runtime/os_linux.cc
+++ b/runtime/os_linux.cc
@@ -16,14 +16,14 @@
#include "os.h"
-#include <cstddef>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
+#include <cstddef>
+#include <memory>
#include "base/logging.h"
#include "base/unix_file/fd_file.h"
-#include "UniquePtrCompat.h"
namespace art {
@@ -41,7 +41,7 @@
File* OS::OpenFileWithFlags(const char* name, int flags) {
CHECK(name != NULL);
- UniquePtr<File> file(new File);
+ std::unique_ptr<File> file(new File);
if (!file->Open(name, flags, 0666)) {
return NULL;
}
diff --git a/runtime/parsed_options.cc b/runtime/parsed_options.cc
index 55b6a27..6d53ba1 100644
--- a/runtime/parsed_options.cc
+++ b/runtime/parsed_options.cc
@@ -25,7 +25,7 @@
namespace art {
ParsedOptions* ParsedOptions::Create(const Runtime::Options& options, bool ignore_unrecognized) {
- UniquePtr<ParsedOptions> parsed(new ParsedOptions());
+ std::unique_ptr<ParsedOptions> parsed(new ParsedOptions());
if (parsed->Parse(options, ignore_unrecognized)) {
return parsed.release();
}
diff --git a/runtime/parsed_options_test.cc b/runtime/parsed_options_test.cc
index 39f7638..b58a29c 100644
--- a/runtime/parsed_options_test.cc
+++ b/runtime/parsed_options_test.cc
@@ -16,7 +16,8 @@
#include "parsed_options.h"
-#include "UniquePtrCompat.h"
+#include <memory>
+
#include "common_runtime_test.h"
namespace art {
@@ -53,7 +54,7 @@
options.push_back(std::make_pair("vfprintf", test_vfprintf));
options.push_back(std::make_pair("abort", test_abort));
options.push_back(std::make_pair("exit", test_exit));
- UniquePtr<ParsedOptions> parsed(ParsedOptions::Create(options, false));
+ std::unique_ptr<ParsedOptions> parsed(ParsedOptions::Create(options, false));
ASSERT_TRUE(parsed.get() != NULL);
EXPECT_EQ(lib_core, parsed->boot_class_path_string_);
diff --git a/runtime/profiler.h b/runtime/profiler.h
index bcd7c29..938fdb7 100644
--- a/runtime/profiler.h
+++ b/runtime/profiler.h
@@ -17,6 +17,7 @@
#ifndef ART_RUNTIME_PROFILER_H_
#define ART_RUNTIME_PROFILER_H_
+#include <memory>
#include <ostream>
#include <set>
#include <string>
@@ -29,7 +30,6 @@
#include "instrumentation.h"
#include "os.h"
#include "safe_map.h"
-#include "UniquePtrCompat.h"
namespace art {
@@ -177,7 +177,7 @@
ProfileSampleResults profile_table_;
- UniquePtr<Barrier> profiler_barrier_;
+ std::unique_ptr<Barrier> profiler_barrier_;
// Set of methods to be filtered out. This will probably be rare because
// most of the methods we want to be filtered reside in the boot path and
diff --git a/runtime/reflection.cc b/runtime/reflection.cc
index cbd66a6..55d35d1 100644
--- a/runtime/reflection.cc
+++ b/runtime/reflection.cc
@@ -342,7 +342,7 @@
uint32_t num_bytes_;
uint32_t* arg_array_;
uint32_t small_arg_array_[kSmallArgArraySize];
- UniquePtr<uint32_t[]> large_arg_array_;
+ std::unique_ptr<uint32_t[]> large_arg_array_;
};
static void CheckMethodArguments(mirror::ArtMethod* m, uint32_t* args)
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index d183cba..986c09d 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -27,6 +27,7 @@
#include <cstdio>
#include <cstdlib>
#include <limits>
+#include <memory>
#include <vector>
#include <fcntl.h>
@@ -72,7 +73,6 @@
#include "trace.h"
#include "transaction.h"
#include "profiler.h"
-#include "UniquePtrCompat.h"
#include "verifier/method_verifier.h"
#include "well_known_classes.h"
@@ -502,7 +502,7 @@
bool Runtime::Init(const Options& raw_options, bool ignore_unrecognized) {
CHECK_EQ(sysconf(_SC_PAGE_SIZE), kPageSize);
- UniquePtr<ParsedOptions> options(ParsedOptions::Create(raw_options, ignore_unrecognized));
+ std::unique_ptr<ParsedOptions> options(ParsedOptions::Create(raw_options, ignore_unrecognized));
if (options.get() == NULL) {
LOG(ERROR) << "Failed to parse options";
return false;
diff --git a/runtime/runtime.h b/runtime/runtime.h
index 07b47c3..f7074f6 100644
--- a/runtime/runtime.h
+++ b/runtime/runtime.h
@@ -82,7 +82,7 @@
class Runtime {
public:
- typedef std::vector<std::pair<std::string, const void*> > Options;
+ typedef std::vector<std::pair<std::string, const void*>> Options;
// Creates and initializes a new runtime.
static bool Create(const Options& options, bool ignore_unrecognized)
@@ -523,7 +523,7 @@
size_t threads_being_born_ GUARDED_BY(Locks::runtime_shutdown_lock_);
// Waited upon until no threads are being born.
- UniquePtr<ConditionVariable> shutdown_cond_ GUARDED_BY(Locks::runtime_shutdown_lock_);
+ std::unique_ptr<ConditionVariable> shutdown_cond_ GUARDED_BY(Locks::runtime_shutdown_lock_);
// Set when runtime shutdown is past the point that new threads may attach.
bool shutting_down_ GUARDED_BY(Locks::runtime_shutdown_lock_);
diff --git a/runtime/safe_map.h b/runtime/safe_map.h
index 393bf92..190db60 100644
--- a/runtime/safe_map.h
+++ b/runtime/safe_map.h
@@ -27,7 +27,7 @@
// Equivalent to std::map, but without operator[] and its bug-prone semantics (in particular,
// the implicit insertion of a default-constructed value on failed lookups).
template <typename K, typename V, typename Comparator = std::less<K>,
- typename Allocator = std::allocator<std::pair<const K, V> > >
+ typename Allocator = std::allocator<std::pair<const K, V>>>
class SafeMap {
private:
typedef SafeMap<K, V, Comparator, Allocator> Self;
diff --git a/runtime/signal_catcher.cc b/runtime/signal_catcher.cc
index 611c0a8..c13776d 100644
--- a/runtime/signal_catcher.cc
+++ b/runtime/signal_catcher.cc
@@ -106,7 +106,7 @@
PLOG(ERROR) << "Unable to open stack trace file '" << stack_trace_file_ << "'";
return;
}
- UniquePtr<File> file(new File(fd, stack_trace_file_));
+ std::unique_ptr<File> file(new File(fd, stack_trace_file_));
if (!file->WriteFully(s.data(), s.size())) {
PLOG(ERROR) << "Failed to write stack traces to '" << stack_trace_file_ << "'";
} else {
diff --git a/runtime/thread.cc b/runtime/thread.cc
index 488961e..326e02e 100644
--- a/runtime/thread.cc
+++ b/runtime/thread.cc
@@ -932,7 +932,7 @@
}
void Thread::DumpJavaStack(std::ostream& os) const {
- UniquePtr<Context> context(Context::Create());
+ std::unique_ptr<Context> context(Context::Create());
StackDumpVisitor dumper(os, const_cast<Thread*>(this), context.get(),
!tls32_.throwing_OutOfMemoryError);
dumper.WalkStack();
@@ -2144,7 +2144,7 @@
}
void Thread::VerifyStackImpl() {
- UniquePtr<Context> context(Context::Create());
+ std::unique_ptr<Context> context(Context::Create());
RootCallbackVisitor visitorToCallback(VerifyRoot, Runtime::Current()->GetHeap(), GetThreadId());
ReferenceMapVisitor<RootCallbackVisitor> mapper(this, context.get(), visitorToCallback);
mapper.WalkStack();
diff --git a/runtime/thread.h b/runtime/thread.h
index f7aef42..6d8af51 100644
--- a/runtime/thread.h
+++ b/runtime/thread.h
@@ -21,6 +21,7 @@
#include <deque>
#include <iosfwd>
#include <list>
+#include <memory>
#include <string>
#include "base/macros.h"
@@ -39,7 +40,6 @@
#include "stack.h"
#include "thread_state.h"
#include "throw_location.h"
-#include "UniquePtrCompat.h"
namespace art {
diff --git a/runtime/thread_pool.h b/runtime/thread_pool.h
index 23bf294..c816c84 100644
--- a/runtime/thread_pool.h
+++ b/runtime/thread_pool.h
@@ -53,7 +53,7 @@
ThreadPool* const thread_pool_;
const std::string name_;
- UniquePtr<MemMap> stack_;
+ std::unique_ptr<MemMap> stack_;
pthread_t pthread_;
private:
diff --git a/runtime/trace.cc b/runtime/trace.cc
index b85eb7e..d53b369 100644
--- a/runtime/trace.cc
+++ b/runtime/trace.cc
@@ -119,7 +119,7 @@
Trace* volatile Trace::the_trace_ = NULL;
pthread_t Trace::sampling_pthread_ = 0U;
-UniquePtr<std::vector<mirror::ArtMethod*> > Trace::temp_stack_trace_;
+std::unique_ptr<std::vector<mirror::ArtMethod*>> Trace::temp_stack_trace_;
static mirror::ArtMethod* DecodeTraceMethodId(uint32_t tmid) {
return reinterpret_cast<mirror::ArtMethod*>(tmid & ~kTraceMethodActionMask);
@@ -339,7 +339,7 @@
runtime->GetThreadList()->SuspendAll();
// Open trace file if not going directly to ddms.
- UniquePtr<File> trace_file;
+ std::unique_ptr<File> trace_file;
if (!direct_to_ddms) {
if (trace_fd < 0) {
trace_file.reset(OS::CreateEmptyFile(trace_filename));
diff --git a/runtime/trace.h b/runtime/trace.h
index ef6c642..08da16f 100644
--- a/runtime/trace.h
+++ b/runtime/trace.h
@@ -17,6 +17,7 @@
#ifndef ART_RUNTIME_TRACE_H_
#define ART_RUNTIME_TRACE_H_
+#include <memory>
#include <ostream>
#include <set>
#include <string>
@@ -27,7 +28,6 @@
#include "instrumentation.h"
#include "os.h"
#include "safe_map.h"
-#include "UniquePtrCompat.h"
namespace art {
@@ -140,13 +140,13 @@
static pthread_t sampling_pthread_;
// Used to remember an unused stack trace to avoid re-allocation during sampling.
- static UniquePtr<std::vector<mirror::ArtMethod*> > temp_stack_trace_;
+ static std::unique_ptr<std::vector<mirror::ArtMethod*>> temp_stack_trace_;
// File to write trace data out to, NULL if direct to ddms.
- UniquePtr<File> trace_file_;
+ std::unique_ptr<File> trace_file_;
// Buffer to store trace data.
- UniquePtr<uint8_t> buf_;
+ std::unique_ptr<uint8_t> buf_;
// Flags enabling extra tracing of things such as alloc counts.
const int flags_;
diff --git a/runtime/utils.cc b/runtime/utils.cc
index c705701..f562252 100644
--- a/runtime/utils.cc
+++ b/runtime/utils.cc
@@ -22,10 +22,9 @@
#include <sys/syscall.h>
#include <sys/types.h>
#include <sys/wait.h>
-
#include <unistd.h>
+#include <memory>
-#include "UniquePtrCompat.h"
#include "base/stl_util.h"
#include "base/unix_file/fd_file.h"
#include "dex_file-inl.h"
@@ -105,7 +104,7 @@
}
bool ReadFileToString(const std::string& file_name, std::string* result) {
- UniquePtr<File> file(new File);
+ std::unique_ptr<File> file(new File);
if (!file->Open(file_name, O_RDONLY)) {
return false;
}
@@ -1045,7 +1044,7 @@
if (current_method != nullptr) {
Locks::mutator_lock_->AssertSharedHeld(Thread::Current());
}
- UniquePtr<Backtrace> backtrace(Backtrace::Create(BACKTRACE_CURRENT_PROCESS, tid));
+ std::unique_ptr<Backtrace> backtrace(Backtrace::Create(BACKTRACE_CURRENT_PROCESS, tid));
if (!backtrace->Unwind(0)) {
os << prefix << "(backtrace::Unwind failed for thread " << tid << ")\n";
return;
diff --git a/runtime/verifier/method_verifier.cc b/runtime/verifier/method_verifier.cc
index 0a31f63..4863b83 100644
--- a/runtime/verifier/method_verifier.cc
+++ b/runtime/verifier/method_verifier.cc
@@ -1433,8 +1433,8 @@
// We need to ensure the work line is consistent while performing validation. When we spot a
// peephole pattern we compute a new line for either the fallthrough instruction or the
// branch target.
- UniquePtr<RegisterLine> branch_line;
- UniquePtr<RegisterLine> fallthrough_line;
+ std::unique_ptr<RegisterLine> branch_line;
+ std::unique_ptr<RegisterLine> fallthrough_line;
// We need precise constant types only for deoptimization which happens at runtime.
const bool need_precise_constant = !Runtime::Current()->IsCompiler();
@@ -3794,7 +3794,7 @@
}
}
} else {
- UniquePtr<RegisterLine> copy(gDebugVerify ?
+ std::unique_ptr<RegisterLine> copy(gDebugVerify ?
RegisterLine::Create(target_line->NumRegs(), this) :
NULL);
if (gDebugVerify) {
diff --git a/runtime/verifier/method_verifier.h b/runtime/verifier/method_verifier.h
index 14200f7..495d3c5 100644
--- a/runtime/verifier/method_verifier.h
+++ b/runtime/verifier/method_verifier.h
@@ -17,6 +17,7 @@
#ifndef ART_RUNTIME_VERIFIER_METHOD_VERIFIER_H_
#define ART_RUNTIME_VERIFIER_METHOD_VERIFIER_H_
+#include <memory>
#include <set>
#include <vector>
@@ -33,7 +34,6 @@
#include "reg_type_cache-inl.h"
#include "register_line.h"
#include "safe_map.h"
-#include "UniquePtrCompat.h"
namespace art {
@@ -126,7 +126,7 @@
}
private:
- UniquePtr<RegisterLine*[]> register_lines_;
+ std::unique_ptr<RegisterLine*[]> register_lines_;
size_t size_;
};
@@ -617,14 +617,14 @@
PcToRegisterLineTable reg_table_;
// Storage for the register status we're currently working on.
- UniquePtr<RegisterLine> work_line_;
+ std::unique_ptr<RegisterLine> work_line_;
// The address of the instruction we're currently working on, note that this is in 2 byte
// quantities
uint32_t work_insn_idx_;
// Storage for the register status we're saving for later.
- UniquePtr<RegisterLine> saved_line_;
+ std::unique_ptr<RegisterLine> saved_line_;
const uint32_t dex_method_idx_; // The method we're working on.
// Its object representation if known.
@@ -640,7 +640,7 @@
const DexFile::CodeItem* const code_item_; // The code item containing the code for the method.
const RegType* declaring_class_; // Lazily computed reg type of the method's declaring class.
// Instruction widths and flags, one entry per code unit.
- UniquePtr<InstructionFlags[]> insn_flags_;
+ std::unique_ptr<InstructionFlags[]> insn_flags_;
// The dex PC of a FindLocksAtDexPc request, -1 otherwise.
uint32_t interesting_dex_pc_;
// The container into which FindLocksAtDexPc should write the registers containing held locks,
diff --git a/runtime/verifier/method_verifier_test.cc b/runtime/verifier/method_verifier_test.cc
index 2bcf3e0..9ac04d7 100644
--- a/runtime/verifier/method_verifier_test.cc
+++ b/runtime/verifier/method_verifier_test.cc
@@ -17,8 +17,8 @@
#include "method_verifier.h"
#include <stdio.h>
+#include <memory>
-#include "UniquePtrCompat.h"
#include "class_linker.h"
#include "common_runtime_test.h"
#include "dex_file.h"
diff --git a/runtime/verifier/register_line.h b/runtime/verifier/register_line.h
index f9f3e31..dade203 100644
--- a/runtime/verifier/register_line.h
+++ b/runtime/verifier/register_line.h
@@ -17,12 +17,12 @@
#ifndef ART_RUNTIME_VERIFIER_REGISTER_LINE_H_
#define ART_RUNTIME_VERIFIER_REGISTER_LINE_H_
+#include <memory>
#include <vector>
#include "dex_instruction.h"
#include "reg_type.h"
#include "safe_map.h"
-#include "UniquePtrCompat.h"
namespace art {
namespace verifier {
diff --git a/runtime/zip_archive.cc b/runtime/zip_archive.cc
index 13b4219..841c01a 100644
--- a/runtime/zip_archive.cc
+++ b/runtime/zip_archive.cc
@@ -16,17 +16,15 @@
#include "zip_archive.h"
-#include <vector>
-
#include <fcntl.h>
#include <stdio.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
+#include <vector>
#include "base/stringprintf.h"
#include "base/unix_file/fd_file.h"
-#include "UniquePtrCompat.h"
namespace art {
@@ -56,7 +54,7 @@
std::string name(entry_filename);
name += " extracted in memory from ";
name += entry_filename;
- UniquePtr<MemMap> map(MemMap::MapAnonymous(name.c_str(),
+ std::unique_ptr<MemMap> map(MemMap::MapAnonymous(name.c_str(),
NULL, GetUncompressedLength(),
PROT_READ | PROT_WRITE, false, error_msg));
if (map.get() == nullptr) {
@@ -123,7 +121,7 @@
DCHECK(name != nullptr);
// Resist the urge to delete the space. <: is a bigraph sequence.
- UniquePtr< ::ZipEntry> zip_entry(new ::ZipEntry);
+ std::unique_ptr< ::ZipEntry> zip_entry(new ::ZipEntry);
const int32_t error = FindEntry(handle_, name, zip_entry.get());
if (error) {
*error_msg = std::string(ErrorCodeString(error));
diff --git a/runtime/zip_archive.h b/runtime/zip_archive.h
index edaa88b..c0e2f2f 100644
--- a/runtime/zip_archive.h
+++ b/runtime/zip_archive.h
@@ -18,8 +18,9 @@
#define ART_RUNTIME_ZIP_ARCHIVE_H_
#include <stdint.h>
-#include <string>
#include <ziparchive/zip_archive.h>
+#include <memory>
+#include <string>
#include "base/logging.h"
#include "base/unix_file/random_access_file.h"
@@ -27,7 +28,6 @@
#include "mem_map.h"
#include "os.h"
#include "safe_map.h"
-#include "UniquePtrCompat.h"
namespace art {
diff --git a/runtime/zip_archive_test.cc b/runtime/zip_archive_test.cc
index d0624cf..d303d1e 100644
--- a/runtime/zip_archive_test.cc
+++ b/runtime/zip_archive_test.cc
@@ -20,8 +20,8 @@
#include <sys/stat.h>
#include <sys/types.h>
#include <zlib.h>
+#include <memory>
-#include "UniquePtrCompat.h"
#include "common_runtime_test.h"
#include "os.h"
@@ -31,16 +31,16 @@
TEST_F(ZipArchiveTest, FindAndExtract) {
std::string error_msg;
- UniquePtr<ZipArchive> zip_archive(ZipArchive::Open(GetLibCoreDexFileName().c_str(), &error_msg));
+ std::unique_ptr<ZipArchive> zip_archive(ZipArchive::Open(GetLibCoreDexFileName().c_str(), &error_msg));
ASSERT_TRUE(zip_archive.get() != nullptr) << error_msg;
ASSERT_TRUE(error_msg.empty());
- UniquePtr<ZipEntry> zip_entry(zip_archive->Find("classes.dex", &error_msg));
+ std::unique_ptr<ZipEntry> zip_entry(zip_archive->Find("classes.dex", &error_msg));
ASSERT_TRUE(zip_entry.get() != nullptr);
ASSERT_TRUE(error_msg.empty());
ScratchFile tmp;
ASSERT_NE(-1, tmp.GetFd());
- UniquePtr<File> file(new File(tmp.GetFd(), tmp.GetFilename()));
+ std::unique_ptr<File> file(new File(tmp.GetFd(), tmp.GetFilename()));
ASSERT_TRUE(file.get() != NULL);
bool success = zip_entry->ExtractToFile(*file, &error_msg);
ASSERT_TRUE(success) << error_msg;