summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--build/Android.common.mk3
-rw-r--r--build/Android.executable.mk3
-rw-r--r--build/Android.gtest.mk3
-rw-r--r--build/Android.libarttest.mk3
-rw-r--r--build/Android.libcxx.mk23
-rw-r--r--compiler/Android.mk2
-rw-r--r--compiler/common_compiler_test.h16
-rw-r--r--compiler/compiled_method.h2
-rw-r--r--compiler/compilers.h2
-rw-r--r--compiler/dex/compiler_ir.h4
-rw-r--r--compiler/dex/frontend.h6
-rw-r--r--compiler/dex/local_value_numbering.h7
-rw-r--r--compiler/dex/local_value_numbering_test.cc2
-rw-r--r--compiler/dex/mir_analysis.cc3
-rw-r--r--compiler/dex/mir_graph.h2
-rw-r--r--compiler/dex/mir_optimization.cc2
-rw-r--r--compiler/dex/quick/codegen_util.cc2
-rw-r--r--compiler/dex/ssa_transformation.cc2
-rw-r--r--compiler/dex/verified_method.cc4
-rw-r--r--compiler/driver/compiler_driver.cc12
-rw-r--r--compiler/driver/compiler_driver.h8
-rw-r--r--compiler/driver/compiler_driver_test.cc2
-rw-r--r--compiler/elf_fixup.cc4
-rw-r--r--compiler/elf_stripper.cc4
-rw-r--r--compiler/elf_writer.cc2
-rw-r--r--compiler/elf_writer_mclinker.cc4
-rw-r--r--compiler/elf_writer_mclinker.h14
-rw-r--r--compiler/elf_writer_test.cc8
-rw-r--r--compiler/image_test.cc8
-rw-r--r--compiler/image_writer.cc8
-rw-r--r--compiler/image_writer.h8
-rw-r--r--compiler/jni/jni_compiler_test.cc3
-rw-r--r--compiler/jni/quick/jni_compiler.cc10
-rw-r--r--compiler/llvm/compiler_llvm.cc6
-rw-r--r--compiler/llvm/compiler_llvm.h11
-rw-r--r--compiler/llvm/gbc_expander.cc4
-rw-r--r--compiler/llvm/llvm_compilation_unit.cc4
-rw-r--r--compiler/llvm/llvm_compilation_unit.h18
-rw-r--r--compiler/oat_test.cc2
-rw-r--r--compiler/oat_writer.h23
-rw-r--r--compiler/optimizing/codegen_test.cc2
-rw-r--r--compiler/output_stream_test.cc6
-rw-r--r--compiler/sea_ir/debug/dot_gen.h2
-rw-r--r--compiler/sea_ir/ir/sea.cc4
-rw-r--r--compiler/trampolines/trampoline_compiler.cc20
-rw-r--r--compiler/utils/arm64/assembler_arm64.h4
-rw-r--r--compiler/utils/assembler_test.h6
-rw-r--r--compiler/utils/dedupe_set.h2
-rw-r--r--compiler/utils/scoped_arena_containers.h10
-rw-r--r--compiler/utils/scoped_hashtable.h4
-rw-r--r--dalvikvm/Android.mk3
-rw-r--r--dalvikvm/dalvikvm.cc5
-rw-r--r--dex2oat/dex2oat.cc38
-rw-r--r--disassembler/Android.mk2
-rw-r--r--oatdump/oatdump.cc18
-rw-r--r--runtime/Android.mk3
-rw-r--r--runtime/UniquePtrCompat.h37
-rw-r--r--runtime/arch/stub_test.cc2
-rw-r--r--runtime/barrier.h2
-rw-r--r--runtime/barrier_test.cc1
-rw-r--r--runtime/base/bit_vector_test.cc5
-rw-r--r--runtime/base/histogram_test.cc24
-rw-r--r--runtime/base/logging.cc7
-rw-r--r--runtime/base/logging.h5
-rw-r--r--runtime/base/unix_file/random_access_file_test.h11
-rw-r--r--runtime/class_linker.cc43
-rw-r--r--runtime/class_linker.h8
-rw-r--r--runtime/class_linker_test.cc2
-rw-r--r--runtime/common_runtime_test.h6
-rw-r--r--runtime/debugger.cc10
-rw-r--r--runtime/dex_file.cc22
-rw-r--r--runtime/dex_file.h4
-rw-r--r--runtime/dex_file_test.cc11
-rw-r--r--runtime/dex_file_verifier.cc6
-rw-r--r--runtime/dex_instruction_visitor_test.cc4
-rw-r--r--runtime/dex_method_iterator.h2
-rw-r--r--runtime/elf_file.cc8
-rw-r--r--runtime/elf_file.h4
-rw-r--r--runtime/entrypoints/quick/quick_trampoline_entrypoints.cc4
-rw-r--r--runtime/exception_test.cc3
-rw-r--r--runtime/gc/accounting/atomic_stack.h6
-rw-r--r--runtime/gc/accounting/card_table.cc2
-rw-r--r--runtime/gc/accounting/card_table.h5
-rw-r--r--runtime/gc/accounting/gc_allocator.h2
-rw-r--r--runtime/gc/accounting/mod_union_table.cc3
-rw-r--r--runtime/gc/accounting/mod_union_table.h4
-rw-r--r--runtime/gc/accounting/remembered_set.cc3
-rw-r--r--runtime/gc/accounting/remembered_set.h2
-rw-r--r--runtime/gc/accounting/space_bitmap-inl.h3
-rw-r--r--runtime/gc/accounting/space_bitmap.cc4
-rw-r--r--runtime/gc/accounting/space_bitmap.h14
-rw-r--r--runtime/gc/accounting/space_bitmap_test.cc8
-rw-r--r--runtime/gc/allocator/rosalloc.cc10
-rw-r--r--runtime/gc/allocator/rosalloc.h22
-rw-r--r--runtime/gc/collector/mark_sweep.h5
-rw-r--r--runtime/gc/collector/semi_space.h3
-rw-r--r--runtime/gc/heap.cc2
-rw-r--r--runtime/gc/heap.h16
-rw-r--r--runtime/gc/heap_test.cc4
-rw-r--r--runtime/gc/space/bump_pointer_space.cc2
-rw-r--r--runtime/gc/space/image_space.cc14
-rw-r--r--runtime/gc/space/image_space.h4
-rw-r--r--runtime/gc/space/large_object_space.cc3
-rw-r--r--runtime/gc/space/large_object_space.h8
-rw-r--r--runtime/gc/space/large_object_space_test.cc2
-rw-r--r--runtime/gc/space/malloc_space.cc2
-rw-r--r--runtime/gc/space/space.h14
-rw-r--r--runtime/gc/space/space_test.h18
-rw-r--r--runtime/hprof/hprof.cc2
-rw-r--r--runtime/indirect_reference_table.h4
-rw-r--r--runtime/instrumentation.cc2
-rw-r--r--runtime/intern_table.cc3
-rw-r--r--runtime/intern_table.h2
-rw-r--r--runtime/jdwp/jdwp_handler.cc7
-rw-r--r--runtime/jdwp/jdwp_main.cc2
-rw-r--r--runtime/jni_internal.cc2
-rw-r--r--runtime/jni_internal_test.cc4
-rw-r--r--runtime/leb128_test.cc4
-rw-r--r--runtime/mem_map.cc4
-rw-r--r--runtime/mem_map_test.cc21
-rw-r--r--runtime/mirror/art_method-inl.h6
-rw-r--r--runtime/mirror/art_method.h6
-rw-r--r--runtime/mirror/class-inl.h26
-rw-r--r--runtime/mirror/class.h10
-rw-r--r--runtime/mirror/dex_cache.h16
-rw-r--r--runtime/mirror/object_array-inl.h2
-rw-r--r--runtime/mirror/object_test.cc6
-rw-r--r--runtime/mirror/proxy.h10
-rw-r--r--runtime/monitor.cc2
-rw-r--r--runtime/native/dalvik_system_DexFile.cc2
-rw-r--r--runtime/native/java_lang_VMClassLoader.cc4
-rw-r--r--runtime/oat_file.cc8
-rw-r--r--runtime/oat_file.h4
-rw-r--r--runtime/os_linux.cc6
-rw-r--r--runtime/parsed_options.cc2
-rw-r--r--runtime/parsed_options_test.cc5
-rw-r--r--runtime/profiler.h4
-rw-r--r--runtime/reflection.cc2
-rw-r--r--runtime/runtime.cc4
-rw-r--r--runtime/runtime.h4
-rw-r--r--runtime/safe_map.h2
-rw-r--r--runtime/signal_catcher.cc2
-rw-r--r--runtime/thread.cc4
-rw-r--r--runtime/thread.h2
-rw-r--r--runtime/thread_pool.h2
-rw-r--r--runtime/trace.cc4
-rw-r--r--runtime/trace.h8
-rw-r--r--runtime/utils.cc7
-rw-r--r--runtime/verifier/method_verifier.cc6
-rw-r--r--runtime/verifier/method_verifier.h10
-rw-r--r--runtime/verifier/method_verifier_test.cc2
-rw-r--r--runtime/verifier/register_line.h2
-rw-r--r--runtime/zip_archive.cc8
-rw-r--r--runtime/zip_archive.h4
-rw-r--r--runtime/zip_archive_test.cc8
-rw-r--r--test/ReferenceMap/stack_walk_refmap_jni.cc2
-rw-r--r--test/StackWalk/stack_walk_jni.cc2
157 files changed, 494 insertions, 566 deletions
diff --git a/build/Android.common.mk b/build/Android.common.mk
index 08208b4..bb17c15 100644
--- a/build/Android.common.mk
+++ b/build/Android.common.mk
@@ -246,9 +246,6 @@ else
endif
ART_TARGET_CFLAGS += $(ART_DEFAULT_GC_TYPE_CFLAGS)
-# TODO: remove when target no longer implies stlport.
-# ART_TARGET_CFLAGS += -DART_WITH_STLPORT=1
-
# DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES is set in ../build/core/dex_preopt.mk based on
# the TARGET_CPU_VARIANT
ifeq ($(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES),)
diff --git a/build/Android.executable.mk b/build/Android.executable.mk
index 683d91d..3c33975 100644
--- a/build/Android.executable.mk
+++ b/build/Android.executable.mk
@@ -100,12 +100,11 @@ define build-art-executable
endif
ifeq ($$(art_target_or_host),target)
- include art/build/Android.libcxx.mk
+ include external/libcxx/libcxx.mk
include $(BUILD_EXECUTABLE)
ART_TARGET_EXECUTABLES := $(ART_TARGET_EXECUTABLES) $(TARGET_OUT_EXECUTABLES)/$$(LOCAL_MODULE)
else # host
LOCAL_IS_HOST_MODULE := true
- include art/build/Android.libcxx.mk
include $(BUILD_HOST_EXECUTABLE)
ART_HOST_EXECUTABLES := $(ART_HOST_EXECUTABLES) $(HOST_OUT_EXECUTABLES)/$$(LOCAL_MODULE)
endif
diff --git a/build/Android.gtest.mk b/build/Android.gtest.mk
index 8973aab..952f79a 100644
--- a/build/Android.gtest.mk
+++ b/build/Android.gtest.mk
@@ -191,7 +191,7 @@ define build-art-test
LOCAL_MODULE_PATH_32 := $(ART_NATIVETEST_OUT)/$(ART_TARGET_ARCH_32)
LOCAL_MODULE_PATH_64 := $(ART_NATIVETEST_OUT)/$(ART_TARGET_ARCH_64)
LOCAL_MULTILIB := both
- include art/build/Android.libcxx.mk
+ include external/libcxx/libcxx.mk
include $(BUILD_EXECUTABLE)
ART_TARGET_GTEST_EXECUTABLES$(ART_PHONY_TEST_TARGET_SUFFIX) += $(ART_NATIVETEST_OUT)/$(TARGET_ARCH)/$$(LOCAL_MODULE)
@@ -220,7 +220,6 @@ $$(art_gtest_target): $$(art_gtest_target)$(ART_PHONY_TEST_TARGET_SUFFIX)
endif
LOCAL_LDLIBS += -lpthread -ldl
LOCAL_IS_HOST_MODULE := true
- include art/build/Android.libcxx.mk
include $(BUILD_HOST_EXECUTABLE)
art_gtest_exe := $(HOST_OUT_EXECUTABLES)/$$(LOCAL_MODULE)
ART_HOST_GTEST_EXECUTABLES += $$(art_gtest_exe)
diff --git a/build/Android.libarttest.mk b/build/Android.libarttest.mk
index e2c9864..6965326 100644
--- a/build/Android.libarttest.mk
+++ b/build/Android.libarttest.mk
@@ -56,7 +56,7 @@ define build-libarttest
LOCAL_MODULE_PATH_32 := $(ART_TEST_OUT)/$(ART_TARGET_ARCH_32)
LOCAL_MODULE_PATH_64 := $(ART_TEST_OUT)/$(ART_TARGET_ARCH_64)
LOCAL_MODULE_TARGET_ARCH := $(ART_SUPPORTED_ARCH)
- include art/build/Android.libcxx.mk
+ include external/libcxx/libcxx.mk
include $(BUILD_SHARED_LIBRARY)
else # host
LOCAL_CLANG := $(ART_HOST_CLANG)
@@ -67,7 +67,6 @@ define build-libarttest
LOCAL_LDLIBS += -lrt
endif
LOCAL_IS_HOST_MODULE := true
- include art/build/Android.libcxx.mk
include $(BUILD_HOST_SHARED_LIBRARY)
endif
endef
diff --git a/build/Android.libcxx.mk b/build/Android.libcxx.mk
deleted file mode 100644
index 9abece5..0000000
--- a/build/Android.libcxx.mk
+++ /dev/null
@@ -1,23 +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.
-#
-
-LOCAL_ADDITIONAL_DEPENDENCIES += art/build/Android.libcxx.mk
-
-ifneq ($(LOCAL_IS_HOST_MODULE),true)
- # include external/stlport/libstlport.mk
- # LOCAL_CFLAGS += -DART_WITH_STLPORT=1
- include external/libcxx/libcxx.mk
-endif
diff --git a/compiler/Android.mk b/compiler/Android.mk
index 8592aaa..cb900ea 100644
--- a/compiler/Android.mk
+++ b/compiler/Android.mk
@@ -170,7 +170,6 @@ define build-libart-compiler
ifeq ($$(art_target_or_host),host)
LOCAL_IS_HOST_MODULE := true
endif
- include art/build/Android.libcxx.mk
LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
ifeq ($$(art_ndebug_or_debug),ndebug)
LOCAL_MODULE := libart-compiler
@@ -196,6 +195,7 @@ $$(ENUM_OPERATOR_OUT_GEN): $$(GENERATED_SRC_DIR)/%_operator_out.cc : $(LOCAL_PAT
LOCAL_CFLAGS := $$(LIBART_COMPILER_CFLAGS)
ifeq ($$(art_target_or_host),target)
+ include external/libcxx/libcxx.mk
LOCAL_CLANG := $(ART_TARGET_CLANG)
LOCAL_CFLAGS += $(ART_TARGET_CFLAGS)
else # host
diff --git a/compiler/common_compiler_test.h b/compiler/common_compiler_test.h
index 7a91e47..fb6c625 100644
--- a/compiler/common_compiler_test.h
+++ b/compiler/common_compiler_test.h
@@ -420,18 +420,18 @@ class CommonCompilerTest : public CommonRuntimeTest {
image_reservation_.reset();
}
- UniquePtr<CompilerOptions> compiler_options_;
- UniquePtr<VerificationResults> verification_results_;
- UniquePtr<DexFileToMethodInlinerMap> method_inliner_map_;
- UniquePtr<CompilerCallbacksImpl> callbacks_;
- UniquePtr<CompilerDriver> compiler_driver_;
- UniquePtr<CumulativeLogger> timer_;
+ std::unique_ptr<CompilerOptions> compiler_options_;
+ std::unique_ptr<VerificationResults> verification_results_;
+ std::unique_ptr<DexFileToMethodInlinerMap> method_inliner_map_;
+ std::unique_ptr<CompilerCallbacksImpl> callbacks_;
+ std::unique_ptr<CompilerDriver> compiler_driver_;
+ std::unique_ptr<CumulativeLogger> timer_;
private:
- UniquePtr<MemMap> image_reservation_;
+ std::unique_ptr<MemMap> image_reservation_;
// Chunks must not move their storage after being created - use the node-based std::list.
- std::list<std::vector<uint8_t> > header_code_and_maps_chunks_;
+ std::list<std::vector<uint8_t>> header_code_and_maps_chunks_;
};
} // namespace art
diff --git a/compiler/compiled_method.h b/compiler/compiled_method.h
index c3c9961..23cd250 100644
--- a/compiler/compiled_method.h
+++ b/compiler/compiled_method.h
@@ -17,12 +17,12 @@
#ifndef ART_COMPILER_COMPILED_METHOD_H_
#define ART_COMPILER_COMPILED_METHOD_H_
+#include <memory>
#include <string>
#include <vector>
#include "instruction_set.h"
#include "utils.h"
-#include "UniquePtrCompat.h"
namespace llvm {
class Function;
diff --git a/compiler/compilers.h b/compiler/compilers.h
index e523d64..2c231e1 100644
--- a/compiler/compilers.h
+++ b/compiler/compilers.h
@@ -92,7 +92,7 @@ class OptimizingCompiler FINAL : public QuickCompiler {
const DexFile& dex_file) const;
private:
- UniquePtr<std::ostream> visualizer_output_;
+ std::unique_ptr<std::ostream> visualizer_output_;
DISALLOW_COPY_AND_ASSIGN(OptimizingCompiler);
};
diff --git a/compiler/dex/compiler_ir.h b/compiler/dex/compiler_ir.h
index 70159ca..35d777e 100644
--- a/compiler/dex/compiler_ir.h
+++ b/compiler/dex/compiler_ir.h
@@ -85,8 +85,8 @@ struct CompilationUnit {
ArenaAllocator arena;
ArenaStack arena_stack; // Arenas for ScopedArenaAllocator.
- UniquePtr<MIRGraph> mir_graph; // MIR container.
- UniquePtr<Backend> cg; // Target-specific codegen.
+ std::unique_ptr<MIRGraph> mir_graph; // MIR container.
+ std::unique_ptr<Backend> cg; // Target-specific codegen.
TimingLogger timings;
};
diff --git a/compiler/dex/frontend.h b/compiler/dex/frontend.h
index f714ecd..c3b8d12 100644
--- a/compiler/dex/frontend.h
+++ b/compiler/dex/frontend.h
@@ -101,10 +101,10 @@ class LLVMInfo {
}
private:
- UniquePtr< ::llvm::LLVMContext> llvm_context_;
+ std::unique_ptr< ::llvm::LLVMContext> llvm_context_;
::llvm::Module* llvm_module_; // Managed by context_.
- UniquePtr<art::llvm::IntrinsicHelper> intrinsic_helper_;
- UniquePtr<art::llvm::IRBuilder> ir_builder_;
+ std::unique_ptr<art::llvm::IntrinsicHelper> intrinsic_helper_;
+ std::unique_ptr<art::llvm::IRBuilder> ir_builder_;
};
class CompiledMethod;
diff --git a/compiler/dex/local_value_numbering.h b/compiler/dex/local_value_numbering.h
index 7049f8c..0c2b6a7 100644
--- a/compiler/dex/local_value_numbering.h
+++ b/compiler/dex/local_value_numbering.h
@@ -17,8 +17,9 @@
#ifndef ART_COMPILER_DEX_LOCAL_VALUE_NUMBERING_H_
#define ART_COMPILER_DEX_LOCAL_VALUE_NUMBERING_H_
+#include <memory>
+
#include "compiler_internals.h"
-#include "UniquePtrCompat.h"
#include "utils/scoped_arena_allocator.h"
#include "utils/scoped_arena_containers.h"
@@ -89,7 +90,7 @@ class LocalValueNumbering {
public:
static LocalValueNumbering* Create(CompilationUnit* cu) {
- UniquePtr<ScopedArenaAllocator> allocator(ScopedArenaAllocator::Create(&cu->arena_stack));
+ std::unique_ptr<ScopedArenaAllocator> allocator(ScopedArenaAllocator::Create(&cu->arena_stack));
void* addr = allocator->Alloc(sizeof(LocalValueNumbering), kArenaAllocMisc);
return new(addr) LocalValueNumbering(cu, allocator.release());
}
@@ -195,7 +196,7 @@ class LocalValueNumbering {
void HandlePutObject(MIR* mir);
CompilationUnit* const cu_;
- UniquePtr<ScopedArenaAllocator> allocator_;
+ std::unique_ptr<ScopedArenaAllocator> allocator_;
SregValueMap sreg_value_map_;
SregValueMap sreg_wide_value_map_;
ValueMap value_map_;
diff --git a/compiler/dex/local_value_numbering_test.cc b/compiler/dex/local_value_numbering_test.cc
index ebac871..2b1c420 100644
--- a/compiler/dex/local_value_numbering_test.cc
+++ b/compiler/dex/local_value_numbering_test.cc
@@ -181,7 +181,7 @@ class LocalValueNumberingTest : public testing::Test {
MIR* mirs_;
std::vector<SSARepresentation> ssa_reps_;
std::vector<uint16_t> value_names_;
- UniquePtr<LocalValueNumbering> lvn_;
+ std::unique_ptr<LocalValueNumbering> lvn_;
};
TEST_F(LocalValueNumberingTest, TestIGetIGetInvokeIGet) {
diff --git a/compiler/dex/mir_analysis.cc b/compiler/dex/mir_analysis.cc
index 1c9e2e2..508f1c7 100644
--- a/compiler/dex/mir_analysis.cc
+++ b/compiler/dex/mir_analysis.cc
@@ -15,6 +15,8 @@
*/
#include <algorithm>
+#include <memory>
+
#include "compiler_internals.h"
#include "dataflow_iterator-inl.h"
#include "dex_instruction.h"
@@ -23,7 +25,6 @@
#include "dex/quick/dex_file_method_inliner.h"
#include "dex/quick/dex_file_to_method_inliner_map.h"
#include "driver/compiler_options.h"
-#include "UniquePtrCompat.h"
#include "utils/scoped_arena_containers.h"
namespace art {
diff --git a/compiler/dex/mir_graph.h b/compiler/dex/mir_graph.h
index 85a2d04..778a92d 100644
--- a/compiler/dex/mir_graph.h
+++ b/compiler/dex/mir_graph.h
@@ -979,7 +979,7 @@ class MIRGraph {
int* i_dom_list_;
ArenaBitVector** def_block_matrix_; // num_dalvik_register x num_blocks.
ArenaBitVector* temp_dalvik_register_v_;
- UniquePtr<ScopedArenaAllocator> temp_scoped_alloc_;
+ std::unique_ptr<ScopedArenaAllocator> temp_scoped_alloc_;
uint16_t* temp_insn_data_;
uint32_t temp_bit_vector_size_;
ArenaBitVector* temp_bit_vector_;
diff --git a/compiler/dex/mir_optimization.cc b/compiler/dex/mir_optimization.cc
index 8e8a593..749a235 100644
--- a/compiler/dex/mir_optimization.cc
+++ b/compiler/dex/mir_optimization.cc
@@ -311,7 +311,7 @@ bool MIRGraph::BasicBlockOpt(BasicBlock* bb) {
return true;
}
bool use_lvn = bb->use_lvn;
- UniquePtr<LocalValueNumbering> local_valnum;
+ std::unique_ptr<LocalValueNumbering> local_valnum;
if (use_lvn) {
local_valnum.reset(LocalValueNumbering::Create(cu_));
}
diff --git a/compiler/dex/quick/codegen_util.cc b/compiler/dex/quick/codegen_util.cc
index 6f81238..d58015a 100644
--- a/compiler/dex/quick/codegen_util.cc
+++ b/compiler/dex/quick/codegen_util.cc
@@ -1026,7 +1026,7 @@ CompiledMethod* Mir2Lir::GetCompiledMethod() {
vmap_encoder.PushBackUnsigned(0u); // Size is 0.
}
- UniquePtr<std::vector<uint8_t> > cfi_info(ReturnCallFrameInformation());
+ std::unique_ptr<std::vector<uint8_t>> cfi_info(ReturnCallFrameInformation());
CompiledMethod* result =
new CompiledMethod(cu_->compiler_driver, cu_->instruction_set, code_buffer_, frame_size_,
core_spill_mask_, fp_spill_mask_, encoded_mapping_table_,
diff --git a/compiler/dex/ssa_transformation.cc b/compiler/dex/ssa_transformation.cc
index 5f89c21..5aa093a 100644
--- a/compiler/dex/ssa_transformation.cc
+++ b/compiler/dex/ssa_transformation.cc
@@ -182,7 +182,7 @@ void MIRGraph::ComputeDomPostOrderTraversal(BasicBlock* bb) {
dom_post_order_traversal_->Reset();
}
ClearAllVisitedFlags();
- std::vector<std::pair<BasicBlock*, ArenaBitVector::Iterator*> > work_stack;
+ std::vector<std::pair<BasicBlock*, ArenaBitVector::Iterator*>> work_stack;
bb->visited = true;
work_stack.push_back(std::make_pair(bb, bb->i_dominated->GetIterator()));
while (!work_stack.empty()) {
diff --git a/compiler/dex/verified_method.cc b/compiler/dex/verified_method.cc
index e19f3cf..01c8f80 100644
--- a/compiler/dex/verified_method.cc
+++ b/compiler/dex/verified_method.cc
@@ -17,6 +17,7 @@
#include "verified_method.h"
#include <algorithm>
+#include <memory>
#include <vector>
#include "base/logging.h"
@@ -34,7 +35,6 @@
#include "mirror/dex_cache-inl.h"
#include "mirror/object.h"
#include "mirror/object-inl.h"
-#include "UniquePtrCompat.h"
#include "verifier/dex_gc_map.h"
#include "verifier/method_verifier.h"
#include "verifier/method_verifier-inl.h"
@@ -45,7 +45,7 @@ namespace art {
const VerifiedMethod* VerifiedMethod::Create(verifier::MethodVerifier* method_verifier,
bool compile) {
- UniquePtr<VerifiedMethod> verified_method(new VerifiedMethod);
+ std::unique_ptr<VerifiedMethod> verified_method(new VerifiedMethod);
if (compile) {
/* Generate a register map. */
if (!verified_method->GenerateGcMap(method_verifier)) {
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc
index 93feb29..eb62f1b 100644
--- a/compiler/driver/compiler_driver.cc
+++ b/compiler/driver/compiler_driver.cc
@@ -502,7 +502,7 @@ void CompilerDriver::CompileAll(jobject class_loader,
const std::vector<const DexFile*>& dex_files,
TimingLogger* timings) {
DCHECK(!Runtime::Current()->IsStarted());
- UniquePtr<ThreadPool> thread_pool(new ThreadPool("Compiler driver thread pool", thread_count_ - 1));
+ std::unique_ptr<ThreadPool> thread_pool(new ThreadPool("Compiler driver thread pool", thread_count_ - 1));
PreCompile(class_loader, dex_files, thread_pool.get(), timings);
Compile(class_loader, dex_files, thread_pool.get(), timings);
if (dump_stats_) {
@@ -568,7 +568,7 @@ void CompilerDriver::CompileOne(mirror::ArtMethod* method, TimingLogger* timings
std::vector<const DexFile*> dex_files;
dex_files.push_back(dex_file);
- UniquePtr<ThreadPool> thread_pool(new ThreadPool("Compiler driver thread pool", 0U));
+ std::unique_ptr<ThreadPool> thread_pool(new ThreadPool("Compiler driver thread pool", 0U));
PreCompile(jclass_loader, dex_files, thread_pool.get(), timings);
// Can we run DEX-to-DEX compiler on this class ?
@@ -626,7 +626,7 @@ bool CompilerDriver::IsImageClass(const char* descriptor) const {
}
static void ResolveExceptionsForMethod(MethodHelper* mh,
- std::set<std::pair<uint16_t, const DexFile*> >& exceptions_to_resolve)
+ std::set<std::pair<uint16_t, const DexFile*>>& exceptions_to_resolve)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
const DexFile::CodeItem* code_item = mh->GetCodeItem();
if (code_item == NULL) {
@@ -665,8 +665,8 @@ static void ResolveExceptionsForMethod(MethodHelper* mh,
static bool ResolveCatchBlockExceptionsClassVisitor(mirror::Class* c, void* arg)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- std::set<std::pair<uint16_t, const DexFile*> >* exceptions_to_resolve =
- reinterpret_cast<std::set<std::pair<uint16_t, const DexFile*> >*>(arg);
+ std::set<std::pair<uint16_t, const DexFile*>>* exceptions_to_resolve =
+ reinterpret_cast<std::set<std::pair<uint16_t, const DexFile*>>*>(arg);
MethodHelper mh;
for (size_t i = 0; i < c->NumVirtualMethods(); ++i) {
mirror::ArtMethod* m = c->GetVirtualMethod(i);
@@ -720,7 +720,7 @@ void CompilerDriver::LoadImageClasses(TimingLogger* timings)
// Resolve exception classes referenced by the loaded classes. The catch logic assumes
// exceptions are resolved by the verifier when there is a catch block in an interested method.
// Do this here so that exception classes appear to have been specified image classes.
- std::set<std::pair<uint16_t, const DexFile*> > unresolved_exception_types;
+ std::set<std::pair<uint16_t, const DexFile*>> unresolved_exception_types;
StackHandleScope<1> hs(self);
Handle<mirror::Class> java_lang_Throwable(
hs.NewHandle(class_linker->FindSystemClass(self, "Ljava/lang/Throwable;")));
diff --git a/compiler/driver/compiler_driver.h b/compiler/driver/compiler_driver.h
index f3db41f..abca659 100644
--- a/compiler/driver/compiler_driver.h
+++ b/compiler/driver/compiler_driver.h
@@ -688,7 +688,7 @@ class CompilerDriver {
VerificationResults* const verification_results_;
DexFileToMethodInlinerMap* const method_inliner_map_;
- UniquePtr<Compiler> compiler_;
+ std::unique_ptr<Compiler> compiler_;
const InstructionSet instruction_set_;
const InstructionSetFeatures instruction_set_features_;
@@ -712,13 +712,13 @@ class CompilerDriver {
// If image_ is true, specifies the classes that will be included in
// the image. Note if image_classes_ is NULL, all classes are
// included in the image.
- UniquePtr<DescriptorSet> image_classes_;
+ std::unique_ptr<DescriptorSet> image_classes_;
size_t thread_count_;
uint64_t start_ns_;
class AOTCompilationStats;
- UniquePtr<AOTCompilationStats> stats_;
+ std::unique_ptr<AOTCompilationStats> stats_;
bool dump_stats_;
const bool dump_passes_;
@@ -755,7 +755,7 @@ class CompilerDriver {
bool support_boot_image_fixup_;
// Call Frame Information, which might be generated to help stack tracebacks.
- UniquePtr<std::vector<uint8_t> > cfi_info_;
+ std::unique_ptr<std::vector<uint8_t>> cfi_info_;
// DeDuplication data structures, these own the corresponding byte arrays.
class DedupeHashFunc {
diff --git a/compiler/driver/compiler_driver_test.cc b/compiler/driver/compiler_driver_test.cc
index fe3a4e6..4efd27d 100644
--- a/compiler/driver/compiler_driver_test.cc
+++ b/compiler/driver/compiler_driver_test.cc
@@ -18,8 +18,8 @@
#include <stdint.h>
#include <stdio.h>
+#include <memory>
-#include "UniquePtrCompat.h"
#include "class_linker.h"
#include "common_compiler_test.h"
#include "dex_file.h"
diff --git a/compiler/elf_fixup.cc b/compiler/elf_fixup.cc
index 571a091..404e3f8 100644
--- a/compiler/elf_fixup.cc
+++ b/compiler/elf_fixup.cc
@@ -17,12 +17,12 @@
#include "elf_fixup.h"
#include <inttypes.h>
+#include <memory>
#include "base/logging.h"
#include "base/stringprintf.h"
#include "elf_file.h"
#include "elf_writer.h"
-#include "UniquePtrCompat.h"
namespace art {
@@ -30,7 +30,7 @@ static const bool DEBUG_FIXUP = false;
bool ElfFixup::Fixup(File* file, uintptr_t oat_data_begin) {
std::string error_msg;
- UniquePtr<ElfFile> elf_file(ElfFile::Open(file, true, false, &error_msg));
+ std::unique_ptr<ElfFile> elf_file(ElfFile::Open(file, true, false, &error_msg));
CHECK(elf_file.get() != nullptr) << error_msg;
// Lookup "oatdata" symbol address.
diff --git a/compiler/elf_stripper.cc b/compiler/elf_stripper.cc
index b0fa63c..8c06c9f 100644
--- a/compiler/elf_stripper.cc
+++ b/compiler/elf_stripper.cc
@@ -18,9 +18,9 @@
#include <unistd.h>
#include <sys/types.h>
+#include <memory>
#include <vector>
-#include "UniquePtrCompat.h"
#include "base/logging.h"
#include "elf_file.h"
#include "elf_utils.h"
@@ -29,7 +29,7 @@
namespace art {
bool ElfStripper::Strip(File* file, std::string* error_msg) {
- UniquePtr<ElfFile> elf_file(ElfFile::Open(file, true, false, error_msg));
+ std::unique_ptr<ElfFile> elf_file(ElfFile::Open(file, true, false, error_msg));
if (elf_file.get() == nullptr) {
return false;
}
diff --git a/compiler/elf_writer.cc b/compiler/elf_writer.cc
index ccc26a1..4c093c7 100644
--- a/compiler/elf_writer.cc
+++ b/compiler/elf_writer.cc
@@ -42,7 +42,7 @@ void ElfWriter::GetOatElfInformation(File* file,
size_t& oat_loaded_size,
size_t& oat_data_offset) {
std::string error_msg;
- UniquePtr<ElfFile> elf_file(ElfFile::Open(file, false, false, &error_msg));
+ std::unique_ptr<ElfFile> elf_file(ElfFile::Open(file, false, false, &error_msg));
CHECK(elf_file.get() != NULL) << error_msg;
oat_loaded_size = elf_file->GetLoadedSize();
diff --git a/compiler/elf_writer_mclinker.cc b/compiler/elf_writer_mclinker.cc
index aa4a5b2..0e27210 100644
--- a/compiler/elf_writer_mclinker.cc
+++ b/compiler/elf_writer_mclinker.cc
@@ -159,7 +159,7 @@ void ElfWriterMclinker::Init() {
void ElfWriterMclinker::AddOatInput(std::vector<uint8_t>& oat_contents) {
// Add an artificial memory input. Based on LinkerTest.
std::string error_msg;
- UniquePtr<OatFile> oat_file(OatFile::OpenMemory(oat_contents, elf_file_->GetPath(), &error_msg));
+ std::unique_ptr<OatFile> oat_file(OatFile::OpenMemory(oat_contents, elf_file_->GetPath(), &error_msg));
CHECK(oat_file.get() != NULL) << elf_file_->GetPath() << ": " << error_msg;
const char* oat_data_start = reinterpret_cast<const char*>(&oat_file->GetOatHeader());
@@ -347,7 +347,7 @@ bool ElfWriterMclinker::Link() {
void ElfWriterMclinker::FixupOatMethodOffsets(const std::vector<const DexFile*>& dex_files) {
std::string error_msg;
- UniquePtr<ElfFile> elf_file(ElfFile::Open(elf_file_, true, false, &error_msg));
+ std::unique_ptr<ElfFile> elf_file(ElfFile::Open(elf_file_, true, false, &error_msg));
CHECK(elf_file.get() != NULL) << elf_file_->GetPath() << ": " << error_msg;
uint32_t oatdata_address = GetOatDataAddress(elf_file.get());
diff --git a/compiler/elf_writer_mclinker.h b/compiler/elf_writer_mclinker.h
index 3c1a47b..955e5d2 100644
--- a/compiler/elf_writer_mclinker.h
+++ b/compiler/elf_writer_mclinker.h
@@ -17,9 +17,9 @@
#ifndef ART_COMPILER_ELF_WRITER_MCLINKER_H_
#define ART_COMPILER_ELF_WRITER_MCLINKER_H_
-#include "elf_writer.h"
+#include <memory>
-#include "UniquePtrCompat.h"
+#include "elf_writer.h"
#include "safe_map.h"
namespace mcld {
@@ -73,11 +73,11 @@ class ElfWriterMclinker FINAL : public ElfWriter {
const CompiledCode& compiled_code);
// Setup by Init()
- UniquePtr<mcld::LinkerConfig> linker_config_;
- UniquePtr<mcld::LinkerScript> linker_script_;
- UniquePtr<mcld::Module> module_;
- UniquePtr<mcld::IRBuilder> ir_builder_;
- UniquePtr<mcld::Linker> linker_;
+ std::unique_ptr<mcld::LinkerConfig> linker_config_;
+ std::unique_ptr<mcld::LinkerScript> linker_script_;
+ std::unique_ptr<mcld::Module> module_;
+ std::unique_ptr<mcld::IRBuilder> ir_builder_;
+ std::unique_ptr<mcld::Linker> linker_;
// Setup by AddOatInput()
// TODO: ownership of oat_input_?
diff --git a/compiler/elf_writer_test.cc b/compiler/elf_writer_test.cc
index d7de6f0..e637cfb 100644
--- a/compiler/elf_writer_test.cc
+++ b/compiler/elf_writer_test.cc
@@ -82,11 +82,11 @@ TEST_F(ElfWriterTest, dlsym) {
}
#endif
- UniquePtr<File> file(OS::OpenFileForReading(elf_filename.c_str()));
+ std::unique_ptr<File> file(OS::OpenFileForReading(elf_filename.c_str()));
ASSERT_TRUE(file.get() != NULL);
{
std::string error_msg;
- UniquePtr<ElfFile> ef(ElfFile::Open(file.get(), false, false, &error_msg));
+ std::unique_ptr<ElfFile> ef(ElfFile::Open(file.get(), false, false, &error_msg));
CHECK(ef.get() != nullptr) << error_msg;
EXPECT_ELF_FILE_ADDRESS(ef, dl_oatdata, "oatdata", false);
EXPECT_ELF_FILE_ADDRESS(ef, dl_oatexec, "oatexec", false);
@@ -94,7 +94,7 @@ TEST_F(ElfWriterTest, dlsym) {
}
{
std::string error_msg;
- UniquePtr<ElfFile> ef(ElfFile::Open(file.get(), false, false, &error_msg));
+ std::unique_ptr<ElfFile> ef(ElfFile::Open(file.get(), false, false, &error_msg));
CHECK(ef.get() != nullptr) << error_msg;
EXPECT_ELF_FILE_ADDRESS(ef, dl_oatdata, "oatdata", true);
EXPECT_ELF_FILE_ADDRESS(ef, dl_oatexec, "oatexec", true);
@@ -102,7 +102,7 @@ TEST_F(ElfWriterTest, dlsym) {
}
{
std::string error_msg;
- UniquePtr<ElfFile> ef(ElfFile::Open(file.get(), false, true, &error_msg));
+ std::unique_ptr<ElfFile> ef(ElfFile::Open(file.get(), false, true, &error_msg));
CHECK(ef.get() != nullptr) << error_msg;
CHECK(ef->Load(false, &error_msg)) << error_msg;
EXPECT_EQ(dl_oatdata, ef->FindDynamicSymbolAddress("oatdata"));
diff --git a/compiler/image_test.cc b/compiler/image_test.cc
index 0babfe3..92be147 100644
--- a/compiler/image_test.cc
+++ b/compiler/image_test.cc
@@ -16,6 +16,7 @@
#include "image.h"
+#include <memory>
#include <string>
#include <vector>
@@ -27,7 +28,6 @@
#include "lock_word.h"
#include "mirror/object-inl.h"
#include "signal_catcher.h"
-#include "UniquePtrCompat.h"
#include "utils.h"
#include "vector_output_stream.h"
@@ -88,7 +88,7 @@ TEST_F(ImageTest, WriteRead) {
}
}
// Workound bug that mcld::Linker::emit closes oat_file by reopening as dup_oat.
- UniquePtr<File> dup_oat(OS::OpenFileReadWrite(oat_file.GetFilename().c_str()));
+ std::unique_ptr<File> dup_oat(OS::OpenFileReadWrite(oat_file.GetFilename().c_str()));
ASSERT_TRUE(dup_oat.get() != NULL);
const uintptr_t requested_image_base = ART_BASE_ADDRESS;
@@ -102,7 +102,7 @@ TEST_F(ImageTest, WriteRead) {
}
{
- UniquePtr<File> file(OS::OpenFileForReading(image_file.GetFilename().c_str()));
+ std::unique_ptr<File> file(OS::OpenFileForReading(image_file.GetFilename().c_str()));
ASSERT_TRUE(file.get() != NULL);
ImageHeader image_header;
file->ReadFully(&image_header, sizeof(image_header));
@@ -130,7 +130,7 @@ TEST_F(ImageTest, WriteRead) {
java_lang_dex_file_ = NULL;
std::string error_msg;
- UniquePtr<const DexFile> dex(DexFile::Open(GetLibCoreDexFileName().c_str(),
+ std::unique_ptr<const DexFile> dex(DexFile::Open(GetLibCoreDexFileName().c_str(),
GetLibCoreDexFileName().c_str(),
&error_msg));
ASSERT_TRUE(dex.get() != nullptr) << error_msg;
diff --git a/compiler/image_writer.cc b/compiler/image_writer.cc
index e261ee6..70144c8 100644
--- a/compiler/image_writer.cc
+++ b/compiler/image_writer.cc
@@ -18,6 +18,7 @@
#include <sys/stat.h>
+#include <memory>
#include <vector>
#include "base/logging.h"
@@ -52,7 +53,6 @@
#include "runtime.h"
#include "scoped_thread_state_change.h"
#include "handle_scope-inl.h"
-#include "UniquePtrCompat.h"
#include "utils.h"
using ::art::mirror::ArtField;
@@ -77,7 +77,7 @@ bool ImageWriter::Write(const std::string& image_filename,
ClassLinker* class_linker = Runtime::Current()->GetClassLinker();
- UniquePtr<File> oat_file(OS::OpenFileReadWrite(oat_filename.c_str()));
+ std::unique_ptr<File> oat_file(OS::OpenFileReadWrite(oat_filename.c_str()));
if (oat_file.get() == NULL) {
LOG(ERROR) << "Failed to open oat file " << oat_filename << " for " << oat_location;
return false;
@@ -141,7 +141,7 @@ bool ImageWriter::Write(const std::string& image_filename,
PatchOatCodeAndMethods();
Thread::Current()->TransitionFromRunnableToSuspended(kNative);
- UniquePtr<File> image_file(OS::CreateEmptyFile(image_filename.c_str()));
+ std::unique_ptr<File> image_file(OS::CreateEmptyFile(image_filename.c_str()));
ImageHeader* image_header = reinterpret_cast<ImageHeader*>(image_->Begin());
if (image_file.get() == NULL) {
LOG(ERROR) << "Failed to open image file " << image_filename;
@@ -418,7 +418,7 @@ ObjectArray<Object>* ImageWriter::CreateImageRoots() const {
}
// build an Object[] of the roots needed to restore the runtime
- Handle<ObjectArray<Object> > image_roots(hs.NewHandle(
+ Handle<ObjectArray<Object>> image_roots(hs.NewHandle(
ObjectArray<Object>::Alloc(self, object_array_class.Get(), ImageHeader::kImageRootsMax)));
image_roots->Set<false>(ImageHeader::kResolutionMethod, runtime->GetResolutionMethod());
image_roots->Set<false>(ImageHeader::kImtConflictMethod, runtime->GetImtConflictMethod());
diff --git a/compiler/image_writer.h b/compiler/image_writer.h
index f8df2bb..aff155a 100644
--- a/compiler/image_writer.h
+++ b/compiler/image_writer.h
@@ -20,6 +20,7 @@
#include <stdint.h>
#include <cstddef>
+#include <memory>
#include <set>
#include <string>
@@ -30,7 +31,6 @@
#include "os.h"
#include "safe_map.h"
#include "gc/space/space.h"
-#include "UniquePtrCompat.h"
namespace art {
@@ -161,7 +161,7 @@ class ImageWriter {
OatFile* oat_file_;
// Memory mapped for generating the image.
- UniquePtr<MemMap> image_;
+ std::unique_ptr<MemMap> image_;
// Offset to the free space in image_.
size_t image_end_;
@@ -170,13 +170,13 @@ class ImageWriter {
byte* image_begin_;
// Saved hashes (objects are inside of the image so that they don't move).
- std::vector<std::pair<mirror::Object*, uint32_t> > saved_hashes_;
+ std::vector<std::pair<mirror::Object*, uint32_t>> saved_hashes_;
// Beginning target oat address for the pointers from the output image to its oat file.
const byte* oat_data_begin_;
// Image bitmap which lets us know where the objects inside of the image reside.
- UniquePtr<gc::accounting::ContinuousSpaceBitmap> image_bitmap_;
+ std::unique_ptr<gc::accounting::ContinuousSpaceBitmap> image_bitmap_;
// Offset from oat_data_begin_ to the stubs.
uint32_t interpreter_to_interpreter_bridge_offset_;
diff --git a/compiler/jni/jni_compiler_test.cc b/compiler/jni/jni_compiler_test.cc
index 561d00f..9927fe1 100644
--- a/compiler/jni/jni_compiler_test.cc
+++ b/compiler/jni/jni_compiler_test.cc
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+#include <memory>
+
#include "class_linker.h"
#include "common_compiler_test.h"
#include "dex_file.h"
@@ -31,7 +33,6 @@
#include "ScopedLocalRef.h"
#include "scoped_thread_state_change.h"
#include "thread.h"
-#include "UniquePtrCompat.h"
extern "C" JNIEXPORT jint JNICALL Java_MyClassNatives_bar(JNIEnv*, jobject, jint count) {
return count + 1;
diff --git a/compiler/jni/quick/jni_compiler.cc b/compiler/jni/quick/jni_compiler.cc
index 02d6fa5..7664a7f 100644
--- a/compiler/jni/quick/jni_compiler.cc
+++ b/compiler/jni/quick/jni_compiler.cc
@@ -15,6 +15,7 @@
*/
#include <algorithm>
+#include <memory>
#include <vector>
#include "base/logging.h"
@@ -33,7 +34,6 @@
#include "utils/mips/managed_register_mips.h"
#include "utils/x86/managed_register_x86.h"
#include "thread.h"
-#include "UniquePtrCompat.h"
#define __ jni_asm->
@@ -66,11 +66,11 @@ CompiledMethod* ArtJniCompileMethodInternal(CompilerDriver* driver,
}
const bool is_64_bit_target = Is64BitInstructionSet(instruction_set);
// Calling conventions used to iterate over parameters to method
- UniquePtr<JniCallingConvention> main_jni_conv(
+ std::unique_ptr<JniCallingConvention> main_jni_conv(
JniCallingConvention::Create(is_static, is_synchronized, shorty, instruction_set));
bool reference_return = main_jni_conv->IsReturnAReference();
- UniquePtr<ManagedRuntimeCallingConvention> mr_conv(
+ std::unique_ptr<ManagedRuntimeCallingConvention> mr_conv(
ManagedRuntimeCallingConvention::Create(is_static, is_synchronized, shorty, instruction_set));
// Calling conventions to call into JNI method "end" possibly passing a returned reference, the
@@ -86,11 +86,11 @@ CompiledMethod* ArtJniCompileMethodInternal(CompilerDriver* driver,
jni_end_shorty = "V";
}
- UniquePtr<JniCallingConvention> end_jni_conv(
+ std::unique_ptr<JniCallingConvention> end_jni_conv(
JniCallingConvention::Create(is_static, is_synchronized, jni_end_shorty, instruction_set));
// Assembler that holds generated instructions
- UniquePtr<Assembler> jni_asm(Assembler::Create(instruction_set));
+ std::unique_ptr<Assembler> jni_asm(Assembler::Create(instruction_set));
// Offsets into data structures
// TODO: if cross compiling these offsets are for the host not the target
diff --git a/compiler/llvm/compiler_llvm.cc b/compiler/llvm/compiler_llvm.cc
index df895ee..5990e8c 100644
--- a/compiler/llvm/compiler_llvm.cc
+++ b/compiler/llvm/compiler_llvm.cc
@@ -136,7 +136,7 @@ LlvmCompilationUnit* CompilerLLVM::AllocateCompilationUnit() {
CompiledMethod* CompilerLLVM::
CompileDexMethod(DexCompilationUnit* dex_compilation_unit, InvokeType invoke_type) {
- UniquePtr<LlvmCompilationUnit> cunit(AllocateCompilationUnit());
+ std::unique_ptr<LlvmCompilationUnit> cunit(AllocateCompilationUnit());
cunit->SetDexCompilationUnit(dex_compilation_unit);
cunit->SetCompilerDriver(compiler_driver_);
@@ -163,9 +163,9 @@ CompileDexMethod(DexCompilationUnit* dex_compilation_unit, InvokeType invoke_typ
CompiledMethod* CompilerLLVM::
CompileNativeMethod(DexCompilationUnit* dex_compilation_unit) {
- UniquePtr<LlvmCompilationUnit> cunit(AllocateCompilationUnit());
+ std::unique_ptr<LlvmCompilationUnit> cunit(AllocateCompilationUnit());
- UniquePtr<JniCompiler> jni_compiler(
+ std::unique_ptr<JniCompiler> jni_compiler(
new JniCompiler(cunit.get(), compiler_driver_, dex_compilation_unit));
return jni_compiler->Compile();
diff --git a/compiler/llvm/compiler_llvm.h b/compiler/llvm/compiler_llvm.h
index c2211fb..cc74deb 100644
--- a/compiler/llvm/compiler_llvm.h
+++ b/compiler/llvm/compiler_llvm.h
@@ -17,18 +17,17 @@
#ifndef ART_COMPILER_LLVM_COMPILER_LLVM_H_
#define ART_COMPILER_LLVM_COMPILER_LLVM_H_
+#include <memory>
+#include <string>
+#include <utility>
+#include <vector>
+
#include "base/macros.h"
#include "dex_file.h"
#include "driver/compiler_driver.h"
#include "instruction_set.h"
#include "mirror/object.h"
-#include <UniquePtr.h>
-
-#include <string>
-#include <utility>
-#include <vector>
-
namespace art {
class CompiledMethod;
class CompilerDriver;
diff --git a/compiler/llvm/gbc_expander.cc b/compiler/llvm/gbc_expander.cc
index cf28db3..25c9b20 100644
--- a/compiler/llvm/gbc_expander.cc
+++ b/compiler/llvm/gbc_expander.cc
@@ -141,7 +141,7 @@ class GBCExpanderPass : public llvm::FunctionPass {
std::vector<llvm::BasicBlock*> basic_block_landing_pads_;
llvm::BasicBlock* current_bb_;
- std::map<llvm::BasicBlock*, std::vector<std::pair<llvm::BasicBlock*, llvm::BasicBlock*> > >
+ std::map<llvm::BasicBlock*, std::vector<std::pair<llvm::BasicBlock*, llvm::BasicBlock*>>>
landing_pad_phi_mapping_;
llvm::BasicBlock* basic_block_unwind_;
@@ -545,7 +545,7 @@ void GBCExpanderPass::RewriteFunction() {
}
llvm::TerminatorInst* term_inst = lbb->getTerminator();
- std::vector<std::pair<llvm::BasicBlock*, llvm::BasicBlock*> >& rewrite_pair
+ std::vector<std::pair<llvm::BasicBlock*, llvm::BasicBlock*>>& rewrite_pair
= landing_pad_phi_mapping_[lbb];
irb_.SetInsertPoint(lbb->begin());
diff --git a/compiler/llvm/llvm_compilation_unit.cc b/compiler/llvm/llvm_compilation_unit.cc
index 78bdb4d..741c2d7 100644
--- a/compiler/llvm/llvm_compilation_unit.cc
+++ b/compiler/llvm/llvm_compilation_unit.cc
@@ -152,7 +152,7 @@ void LlvmCompilationUnit::DumpBitcodeToFile() {
std::string bitcode;
DumpBitcodeToString(bitcode);
std::string filename(StringPrintf("%s/Art%zu.bc", DumpDirectory().c_str(), cunit_id_));
- UniquePtr<File> output(OS::CreateEmptyFile(filename.c_str()));
+ std::unique_ptr<File> output(OS::CreateEmptyFile(filename.c_str()));
output->WriteFully(bitcode.data(), bitcode.size());
LOG(INFO) << ".bc file written successfully: " << filename;
}
@@ -179,7 +179,7 @@ bool LlvmCompilationUnit::Materialize() {
if (kDumpELF) {
// Dump the ELF image for debugging
std::string filename(StringPrintf("%s/Art%zu.o", DumpDirectory().c_str(), cunit_id_));
- UniquePtr<File> output(OS::CreateEmptyFile(filename.c_str()));
+ std::unique_ptr<File> output(OS::CreateEmptyFile(filename.c_str()));
output->WriteFully(elf_object_.data(), elf_object_.size());
LOG(INFO) << ".o file written successfully: " << filename;
}
diff --git a/compiler/llvm/llvm_compilation_unit.h b/compiler/llvm/llvm_compilation_unit.h
index 58aa6fd..f11fb6e 100644
--- a/compiler/llvm/llvm_compilation_unit.h
+++ b/compiler/llvm/llvm_compilation_unit.h
@@ -17,6 +17,10 @@
#ifndef ART_COMPILER_LLVM_LLVM_COMPILATION_UNIT_H_
#define ART_COMPILER_LLVM_LLVM_COMPILATION_UNIT_H_
+#include <memory>
+#include <string>
+#include <vector>
+
#include "base/logging.h"
#include "base/mutex.h"
#include "dex/compiler_internals.h"
@@ -28,10 +32,6 @@
#include "runtime_support_llvm_func.h"
#include "safe_map.h"
-#include <UniquePtr.h>
-#include <string>
-#include <vector>
-
namespace art {
class CompiledMethod;
}
@@ -106,12 +106,12 @@ class LlvmCompilationUnit {
const CompilerLLVM* compiler_llvm_;
const size_t cunit_id_;
- UniquePtr< ::llvm::LLVMContext> context_;
- UniquePtr<IRBuilder> irb_;
- UniquePtr<RuntimeSupportBuilder> runtime_support_;
+ std::unique_ptr< ::llvm::LLVMContext> context_;
+ std::unique_ptr<IRBuilder> irb_;
+ std::unique_ptr<RuntimeSupportBuilder> runtime_support_;
::llvm::Module* module_; // Managed by context_
- UniquePtr<IntrinsicHelper> intrinsic_helper_;
- UniquePtr<LLVMInfo> llvm_info_;
+ std::unique_ptr<IntrinsicHelper> intrinsic_helper_;
+ std::unique_ptr<LLVMInfo> llvm_info_;
CompilerDriver* driver_;
DexCompilationUnit* dex_compilation_unit_;
diff --git a/compiler/oat_test.cc b/compiler/oat_test.cc
index ce35d0f..a7ee82e 100644
--- a/compiler/oat_test.cc
+++ b/compiler/oat_test.cc
@@ -128,7 +128,7 @@ TEST_F(OatTest, WriteRead) {
compiler_driver_->CompileAll(class_loader, class_linker->GetBootClassPath(), &timings);
}
std::string error_msg;
- UniquePtr<OatFile> oat_file(OatFile::Open(tmp.GetFilename(), tmp.GetFilename(), NULL, false,
+ std::unique_ptr<OatFile> oat_file(OatFile::Open(tmp.GetFilename(), tmp.GetFilename(), NULL, false,
&error_msg));
ASSERT_TRUE(oat_file.get() != nullptr) << error_msg;
const OatHeader& oat_header = oat_file->GetOatHeader();
diff --git a/compiler/oat_writer.h b/compiler/oat_writer.h
index 7a41d87..8c20aa8 100644
--- a/compiler/oat_writer.h
+++ b/compiler/oat_writer.h
@@ -18,15 +18,14 @@
#define ART_COMPILER_OAT_WRITER_H_
#include <stdint.h>
-
#include <cstddef>
+#include <memory>
#include "driver/compiler_driver.h"
#include "mem_map.h"
#include "oat.h"
#include "mirror/class.h"
#include "safe_map.h"
-#include "UniquePtrCompat.h"
namespace art {
@@ -256,16 +255,16 @@ class OatWriter {
OatHeader* oat_header_;
std::vector<OatDexFile*> oat_dex_files_;
std::vector<OatClass*> oat_classes_;
- UniquePtr<const std::vector<uint8_t> > interpreter_to_interpreter_bridge_;
- UniquePtr<const std::vector<uint8_t> > interpreter_to_compiled_code_bridge_;
- UniquePtr<const std::vector<uint8_t> > jni_dlsym_lookup_;
- UniquePtr<const std::vector<uint8_t> > portable_imt_conflict_trampoline_;
- UniquePtr<const std::vector<uint8_t> > portable_resolution_trampoline_;
- UniquePtr<const std::vector<uint8_t> > portable_to_interpreter_bridge_;
- UniquePtr<const std::vector<uint8_t> > quick_generic_jni_trampoline_;
- UniquePtr<const std::vector<uint8_t> > quick_imt_conflict_trampoline_;
- UniquePtr<const std::vector<uint8_t> > quick_resolution_trampoline_;
- UniquePtr<const std::vector<uint8_t> > quick_to_interpreter_bridge_;
+ std::unique_ptr<const std::vector<uint8_t>> interpreter_to_interpreter_bridge_;
+ std::unique_ptr<const std::vector<uint8_t>> interpreter_to_compiled_code_bridge_;
+ std::unique_ptr<const std::vector<uint8_t>> jni_dlsym_lookup_;
+ std::unique_ptr<const std::vector<uint8_t>> portable_imt_conflict_trampoline_;
+ std::unique_ptr<const std::vector<uint8_t>> portable_resolution_trampoline_;
+ std::unique_ptr<const std::vector<uint8_t>> portable_to_interpreter_bridge_;
+ std::unique_ptr<const std::vector<uint8_t>> quick_generic_jni_trampoline_;
+ std::unique_ptr<const std::vector<uint8_t>> quick_imt_conflict_trampoline_;
+ std::unique_ptr<const std::vector<uint8_t>> quick_resolution_trampoline_;
+ std::unique_ptr<const std::vector<uint8_t>> quick_to_interpreter_bridge_;
// output stats
uint32_t size_dex_file_alignment_;
diff --git a/compiler/optimizing/codegen_test.cc b/compiler/optimizing/codegen_test.cc
index d40990e..7684bb1 100644
--- a/compiler/optimizing/codegen_test.cc
+++ b/compiler/optimizing/codegen_test.cc
@@ -42,7 +42,7 @@ class InternalCodeAllocator : public CodeAllocator {
private:
size_t size_;
- UniquePtr<uint8_t[]> memory_;
+ std::unique_ptr<uint8_t[]> memory_;
DISALLOW_COPY_AND_ASSIGN(InternalCodeAllocator);
};
diff --git a/compiler/output_stream_test.cc b/compiler/output_stream_test.cc
index 290bf25..5fa0ccb 100644
--- a/compiler/output_stream_test.cc
+++ b/compiler/output_stream_test.cc
@@ -64,7 +64,7 @@ TEST_F(OutputStreamTest, File) {
FileOutputStream output_stream(tmp.GetFile());
SetOutputStream(output_stream);
GenerateTestOutput();
- UniquePtr<File> in(OS::OpenFileForReading(tmp.GetFilename().c_str()));
+ std::unique_ptr<File> in(OS::OpenFileForReading(tmp.GetFilename().c_str()));
EXPECT_TRUE(in.get() != NULL);
std::vector<uint8_t> actual(in->GetLength());
bool readSuccess = in->ReadFully(&actual[0], actual.size());
@@ -74,12 +74,12 @@ TEST_F(OutputStreamTest, File) {
TEST_F(OutputStreamTest, Buffered) {
ScratchFile tmp;
- UniquePtr<FileOutputStream> file_output_stream(new FileOutputStream(tmp.GetFile()));
+ std::unique_ptr<FileOutputStream> file_output_stream(new FileOutputStream(tmp.GetFile()));
CHECK(file_output_stream.get() != NULL);
BufferedOutputStream buffered_output_stream(file_output_stream.release());
SetOutputStream(buffered_output_stream);
GenerateTestOutput();
- UniquePtr<File> in(OS::OpenFileForReading(tmp.GetFilename().c_str()));
+ std::unique_ptr<File> in(OS::OpenFileForReading(tmp.GetFilename().c_str()));
EXPECT_TRUE(in.get() != NULL);
std::vector<uint8_t> actual(in->GetLength());
bool readSuccess = in->ReadFully(&actual[0], actual.size());
diff --git a/compiler/sea_ir/debug/dot_gen.h b/compiler/sea_ir/debug/dot_gen.h
index d7d21ad..a5d6819 100644
--- a/compiler/sea_ir/debug/dot_gen.h
+++ b/compiler/sea_ir/debug/dot_gen.h
@@ -104,7 +104,7 @@ class DotConversion {
LOG(INFO) << "Starting to write SEA string to file " << filename << std::endl;
DotGenerationVisitor dgv = DotGenerationVisitor(&options_, types);
graph->Accept(&dgv);
- // TODO: UniquePtr to close file properly. Switch to BufferedOutputStream.
+ // TODO: std::unique_ptr to close file properly. Switch to BufferedOutputStream.
art::File* file = art::OS::CreateEmptyFile(filename.c_str());
art::FileOutputStream fos(file);
std::string graph_as_string = dgv.GetResult();
diff --git a/compiler/sea_ir/ir/sea.cc b/compiler/sea_ir/ir/sea.cc
index 0734b21..2b25f56 100644
--- a/compiler/sea_ir/ir/sea.cc
+++ b/compiler/sea_ir/ir/sea.cc
@@ -289,7 +289,7 @@ void SeaGraph::RenameAsSSA() {
void SeaGraph::ConvertToSSA() {
// Pass: find global names.
// The map @block maps registers to the blocks in which they are defined.
- std::map<int, std::set<Region*> > blocks;
+ std::map<int, std::set<Region*>> blocks;
// The set @globals records registers whose use
// is in a different block than the corresponding definition.
std::set<int> globals;
@@ -311,7 +311,7 @@ void SeaGraph::ConvertToSSA() {
var_kill.insert(reg_def);
}
- blocks.insert(std::pair<int, std::set<Region*> >(reg_def, std::set<Region*>()));
+ blocks.insert(std::pair<int, std::set<Region*>>(reg_def, std::set<Region*>()));
std::set<Region*>* reg_def_blocks = &(blocks.find(reg_def)->second);
reg_def_blocks->insert(*region_it);
}
diff --git a/compiler/trampolines/trampoline_compiler.cc b/compiler/trampolines/trampoline_compiler.cc
index d03b99f..24378b4 100644
--- a/compiler/trampolines/trampoline_compiler.cc
+++ b/compiler/trampolines/trampoline_compiler.cc
@@ -30,7 +30,7 @@ namespace art {
namespace arm {
static const std::vector<uint8_t>* CreateTrampoline(EntryPointCallingConvention abi,
ThreadOffset<4> offset) {
- UniquePtr<ArmAssembler> assembler(static_cast<ArmAssembler*>(Assembler::Create(kArm)));
+ std::unique_ptr<ArmAssembler> assembler(static_cast<ArmAssembler*>(Assembler::Create(kArm)));
switch (abi) {
case kInterpreterAbi: // Thread* is first argument (R0) in interpreter ABI.
@@ -47,7 +47,7 @@ static const std::vector<uint8_t>* CreateTrampoline(EntryPointCallingConvention
__ bkpt(0);
size_t cs = assembler->CodeSize();
- UniquePtr<std::vector<uint8_t> > entry_stub(new std::vector<uint8_t>(cs));
+ std::unique_ptr<std::vector<uint8_t>> entry_stub(new std::vector<uint8_t>(cs));
MemoryRegion code(&(*entry_stub)[0], entry_stub->size());
assembler->FinalizeInstructions(code);
@@ -58,7 +58,7 @@ static const std::vector<uint8_t>* CreateTrampoline(EntryPointCallingConvention
namespace arm64 {
static const std::vector<uint8_t>* CreateTrampoline(EntryPointCallingConvention abi,
ThreadOffset<8> offset) {
- UniquePtr<Arm64Assembler> assembler(static_cast<Arm64Assembler*>(Assembler::Create(kArm64)));
+ std::unique_ptr<Arm64Assembler> assembler(static_cast<Arm64Assembler*>(Assembler::Create(kArm64)));
switch (abi) {
case kInterpreterAbi: // Thread* is first argument (X0) in interpreter ABI.
@@ -84,7 +84,7 @@ static const std::vector<uint8_t>* CreateTrampoline(EntryPointCallingConvention
}
size_t cs = assembler->CodeSize();
- UniquePtr<std::vector<uint8_t> > entry_stub(new std::vector<uint8_t>(cs));
+ std::unique_ptr<std::vector<uint8_t>> entry_stub(new std::vector<uint8_t>(cs));
MemoryRegion code(&(*entry_stub)[0], entry_stub->size());
assembler->FinalizeInstructions(code);
@@ -95,7 +95,7 @@ static const std::vector<uint8_t>* CreateTrampoline(EntryPointCallingConvention
namespace mips {
static const std::vector<uint8_t>* CreateTrampoline(EntryPointCallingConvention abi,
ThreadOffset<4> offset) {
- UniquePtr<MipsAssembler> assembler(static_cast<MipsAssembler*>(Assembler::Create(kMips)));
+ std::unique_ptr<MipsAssembler> assembler(static_cast<MipsAssembler*>(Assembler::Create(kMips)));
switch (abi) {
case kInterpreterAbi: // Thread* is first argument (A0) in interpreter ABI.
@@ -114,7 +114,7 @@ static const std::vector<uint8_t>* CreateTrampoline(EntryPointCallingConvention
__ Break();
size_t cs = assembler->CodeSize();
- UniquePtr<std::vector<uint8_t> > entry_stub(new std::vector<uint8_t>(cs));
+ std::unique_ptr<std::vector<uint8_t>> entry_stub(new std::vector<uint8_t>(cs));
MemoryRegion code(&(*entry_stub)[0], entry_stub->size());
assembler->FinalizeInstructions(code);
@@ -124,14 +124,14 @@ static const std::vector<uint8_t>* CreateTrampoline(EntryPointCallingConvention
namespace x86 {
static const std::vector<uint8_t>* CreateTrampoline(ThreadOffset<4> offset) {
- UniquePtr<X86Assembler> assembler(static_cast<X86Assembler*>(Assembler::Create(kX86)));
+ std::unique_ptr<X86Assembler> assembler(static_cast<X86Assembler*>(Assembler::Create(kX86)));
// All x86 trampolines call via the Thread* held in fs.
__ fs()->jmp(Address::Absolute(offset));
__ int3();
size_t cs = assembler->CodeSize();
- UniquePtr<std::vector<uint8_t> > entry_stub(new std::vector<uint8_t>(cs));
+ std::unique_ptr<std::vector<uint8_t>> entry_stub(new std::vector<uint8_t>(cs));
MemoryRegion code(&(*entry_stub)[0], entry_stub->size());
assembler->FinalizeInstructions(code);
@@ -141,7 +141,7 @@ static const std::vector<uint8_t>* CreateTrampoline(ThreadOffset<4> offset) {
namespace x86_64 {
static const std::vector<uint8_t>* CreateTrampoline(ThreadOffset<8> offset) {
- UniquePtr<x86_64::X86_64Assembler>
+ std::unique_ptr<x86_64::X86_64Assembler>
assembler(static_cast<x86_64::X86_64Assembler*>(Assembler::Create(kX86_64)));
// All x86 trampolines call via the Thread* held in gs.
@@ -149,7 +149,7 @@ static const std::vector<uint8_t>* CreateTrampoline(ThreadOffset<8> offset) {
__ int3();
size_t cs = assembler->CodeSize();
- UniquePtr<std::vector<uint8_t> > entry_stub(new std::vector<uint8_t>(cs));
+ std::unique_ptr<std::vector<uint8_t>> entry_stub(new std::vector<uint8_t>(cs));
MemoryRegion code(&(*entry_stub)[0], entry_stub->size());
assembler->FinalizeInstructions(code);
diff --git a/compiler/utils/arm64/assembler_arm64.h b/compiler/utils/arm64/assembler_arm64.h
index 0f4a9a4..ab4999a 100644
--- a/compiler/utils/arm64/assembler_arm64.h
+++ b/compiler/utils/arm64/assembler_arm64.h
@@ -17,8 +17,9 @@
#ifndef ART_COMPILER_UTILS_ARM64_ASSEMBLER_ARM64_H_
#define ART_COMPILER_UTILS_ARM64_ASSEMBLER_ARM64_H_
-#include <vector>
#include <stdint.h>
+#include <memory>
+#include <vector>
#include "base/logging.h"
#include "constants_arm64.h"
@@ -26,7 +27,6 @@
#include "utils/assembler.h"
#include "offsets.h"
#include "utils.h"
-#include "UniquePtrCompat.h"
#include "a64/macro-assembler-a64.h"
#include "a64/disasm-a64.h"
diff --git a/compiler/utils/assembler_test.h b/compiler/utils/assembler_test.h
index 1b050cf..754496b 100644
--- a/compiler/utils/assembler_test.h
+++ b/compiler/utils/assembler_test.h
@@ -347,7 +347,7 @@ class AssemblerTest : public testing::Test {
}
size_t cs = assembler_->CodeSize();
- UniquePtr<std::vector<uint8_t> > data(new std::vector<uint8_t>(cs));
+ std::unique_ptr<std::vector<uint8_t>> data(new std::vector<uint8_t>(cs));
MemoryRegion code(&(*data)[0], data->size());
assembler_->FinalizeInstructions(code);
@@ -375,7 +375,7 @@ class AssemblerTest : public testing::Test {
bool ok;
std::string error_msg;
std::string base_name;
- UniquePtr<std::vector<uint8_t>> code;
+ std::unique_ptr<std::vector<uint8_t>> code;
uintptr_t length;
};
@@ -681,7 +681,7 @@ class AssemblerTest : public testing::Test {
return tmpnam_;
}
- UniquePtr<Ass> assembler_;
+ std::unique_ptr<Ass> assembler_;
std::string resolved_assembler_cmd_;
std::string resolved_objdump_cmd_;
diff --git a/compiler/utils/dedupe_set.h b/compiler/utils/dedupe_set.h
index 7cc253c..4c52174 100644
--- a/compiler/utils/dedupe_set.h
+++ b/compiler/utils/dedupe_set.h
@@ -77,7 +77,7 @@ class DedupeSet {
private:
std::string lock_name_[kShard];
- UniquePtr<Mutex> lock_[kShard];
+ std::unique_ptr<Mutex> lock_[kShard];
std::set<HashedKey, Comparator> keys_[kShard];
DISALLOW_COPY_AND_ASSIGN(DedupeSet);
diff --git a/compiler/utils/scoped_arena_containers.h b/compiler/utils/scoped_arena_containers.h
index c6fefde..5deb661 100644
--- a/compiler/utils/scoped_arena_containers.h
+++ b/compiler/utils/scoped_arena_containers.h
@@ -26,14 +26,14 @@
namespace art {
template <typename T>
-using ScopedArenaVector = std::vector<T, ScopedArenaAllocatorAdapter<T> >;
+using ScopedArenaVector = std::vector<T, ScopedArenaAllocatorAdapter<T>>;
-template <typename T, typename Comparator = std::less<T> >
-using ScopedArenaSet = std::set<T, Comparator, ScopedArenaAllocatorAdapter<T> >;
+template <typename T, typename Comparator = std::less<T>>
+using ScopedArenaSet = std::set<T, Comparator, ScopedArenaAllocatorAdapter<T>>;
-template <typename K, typename V, typename Comparator = std::less<K> >
+template <typename K, typename V, typename Comparator = std::less<K>>
using ScopedArenaSafeMap =
- SafeMap<K, V, Comparator, ScopedArenaAllocatorAdapter<std::pair<const K, V> > >;
+ SafeMap<K, V, Comparator, ScopedArenaAllocatorAdapter<std::pair<const K, V>>>;
} // namespace art
diff --git a/compiler/utils/scoped_hashtable.h b/compiler/utils/scoped_hashtable.h
index ccec7ba..bf8dd1f 100644
--- a/compiler/utils/scoped_hashtable.h
+++ b/compiler/utils/scoped_hashtable.h
@@ -36,7 +36,7 @@ class ScopedHashtable {
// Lookups entry K starting from the current (topmost) scope
// and returns its value if found or NULL.
V Lookup(K k) const {
- for (typename std::list<std::map<K, V> >::const_iterator scopes_it = scopes.begin();
+ for (typename std::list<std::map<K, V>>::const_iterator scopes_it = scopes.begin();
scopes_it != scopes.end(); scopes_it++) {
typename std::map<K, V>::const_iterator result_it = (*scopes_it).find(k);
if (result_it != (*scopes_it).end()) {
@@ -64,7 +64,7 @@ class ScopedHashtable {
}
private:
- std::list<std::map<K, V> > scopes;
+ std::list<std::map<K, V>> scopes;
};
} // namespace utils
diff --git a/dalvikvm/Android.mk b/dalvikvm/Android.mk
index e7ed9a7..0ded2d8 100644
--- a/dalvikvm/Android.mk
+++ b/dalvikvm/Android.mk
@@ -30,7 +30,7 @@ LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
LOCAL_MULTILIB := both
LOCAL_MODULE_STEM_32 := dalvikvm32
LOCAL_MODULE_STEM_64 := dalvikvm64
-include art/build/Android.libcxx.mk
+include external/libcxx/libcxx.mk
include $(BUILD_EXECUTABLE)
# create symlink for the primary version target.
@@ -51,7 +51,6 @@ LOCAL_SHARED_LIBRARIES := libnativehelper
LOCAL_LDFLAGS := -ldl -lpthread
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
LOCAL_IS_HOST_MODULE := true
-include art/build/Android.libcxx.mk
include $(BUILD_HOST_EXECUTABLE)
ART_HOST_EXECUTABLES += $(HOST_OUT_EXECUTABLES)/$(LOCAL_MODULE)
endif
diff --git a/dalvikvm/dalvikvm.cc b/dalvikvm/dalvikvm.cc
index 3fa43dc..67794c8 100644
--- a/dalvikvm/dalvikvm.cc
+++ b/dalvikvm/dalvikvm.cc
@@ -18,14 +18,13 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-
#include <algorithm>
+#include <memory>
#include "jni.h"
#include "JniInvocation.h"
#include "ScopedLocalRef.h"
#include "toStringArray.h"
-#include "UniquePtrCompat.h"
namespace art {
@@ -118,7 +117,7 @@ static int dalvikvm(int argc, char** argv) {
// We're over-allocating, because this includes the options to the runtime
// plus the options to the program.
int option_count = argc;
- UniquePtr<JavaVMOption[]> options(new JavaVMOption[option_count]());
+ std::unique_ptr<JavaVMOption[]> options(new JavaVMOption[option_count]());
// Copy options over. Everything up to the name of the class starts
// with a '-' (the function hook stuff is strictly internal).
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc
index 874c324..9914875 100644
--- a/dex2oat/dex2oat.cc
+++ b/dex2oat/dex2oat.cc
@@ -228,7 +228,7 @@ class Dex2Oat {
SHARED_TRYLOCK_FUNCTION(true, Locks::mutator_lock_) {
CHECK(verification_results != nullptr);
CHECK(method_inliner_map != nullptr);
- UniquePtr<Dex2Oat> dex2oat(new Dex2Oat(&compiler_options,
+ std::unique_ptr<Dex2Oat> dex2oat(new Dex2Oat(&compiler_options,
compiler_kind,
instruction_set,
instruction_set_features,
@@ -256,19 +256,19 @@ class Dex2Oat {
// Reads the class names (java.lang.Object) and returns a set of descriptors (Ljava/lang/Object;)
CompilerDriver::DescriptorSet* ReadImageClassesFromFile(const char* image_classes_filename) {
- UniquePtr<std::ifstream> image_classes_file(new std::ifstream(image_classes_filename,
+ std::unique_ptr<std::ifstream> image_classes_file(new std::ifstream(image_classes_filename,
std::ifstream::in));
if (image_classes_file.get() == nullptr) {
LOG(ERROR) << "Failed to open image classes file " << image_classes_filename;
return nullptr;
}
- UniquePtr<CompilerDriver::DescriptorSet> result(ReadImageClasses(*image_classes_file.get()));
+ std::unique_ptr<CompilerDriver::DescriptorSet> result(ReadImageClasses(*image_classes_file.get()));
image_classes_file->close();
return result.release();
}
CompilerDriver::DescriptorSet* ReadImageClasses(std::istream& image_classes_stream) {
- UniquePtr<CompilerDriver::DescriptorSet> image_classes(new CompilerDriver::DescriptorSet);
+ std::unique_ptr<CompilerDriver::DescriptorSet> image_classes(new CompilerDriver::DescriptorSet);
while (image_classes_stream.good()) {
std::string dot;
std::getline(image_classes_stream, dot);
@@ -285,17 +285,17 @@ class Dex2Oat {
CompilerDriver::DescriptorSet* ReadImageClassesFromZip(const char* zip_filename,
const char* image_classes_filename,
std::string* error_msg) {
- UniquePtr<ZipArchive> zip_archive(ZipArchive::Open(zip_filename, error_msg));
+ std::unique_ptr<ZipArchive> zip_archive(ZipArchive::Open(zip_filename, error_msg));
if (zip_archive.get() == nullptr) {
return nullptr;
}
- UniquePtr<ZipEntry> zip_entry(zip_archive->Find(image_classes_filename, error_msg));
+ std::unique_ptr<ZipEntry> zip_entry(zip_archive->Find(image_classes_filename, error_msg));
if (zip_entry.get() == nullptr) {
*error_msg = StringPrintf("Failed to find '%s' within '%s': %s", image_classes_filename,
zip_filename, error_msg->c_str());
return nullptr;
}
- UniquePtr<MemMap> image_classes_file(zip_entry->ExtractToMemMap(image_classes_filename,
+ std::unique_ptr<MemMap> image_classes_file(zip_entry->ExtractToMemMap(image_classes_filename,
error_msg));
if (image_classes_file.get() == nullptr) {
*error_msg = StringPrintf("Failed to extract '%s' from '%s': %s", image_classes_filename,
@@ -315,7 +315,7 @@ class Dex2Oat {
File* oat_file,
const std::string& bitcode_filename,
bool image,
- UniquePtr<CompilerDriver::DescriptorSet>& image_classes,
+ std::unique_ptr<CompilerDriver::DescriptorSet>& image_classes,
bool dump_stats,
bool dump_passes,
TimingLogger& timings,
@@ -339,7 +339,7 @@ class Dex2Oat {
Runtime::Current()->SetCompileTimeClassPath(class_loader, class_path_files);
}
- UniquePtr<CompilerDriver> driver(new CompilerDriver(compiler_options_,
+ std::unique_ptr<CompilerDriver> driver(new CompilerDriver(compiler_options_,
verification_results_,
method_inliner_map_,
compiler_kind_,
@@ -403,7 +403,7 @@ class Dex2Oat {
oat_data_begin = image_writer.GetOatDataBegin();
}
- UniquePtr<File> oat_file(OS::OpenFileReadWrite(oat_filename.c_str()));
+ std::unique_ptr<File> oat_file(OS::OpenFileReadWrite(oat_filename.c_str()));
if (oat_file.get() == nullptr) {
PLOG(ERROR) << "Failed to open ELF file: " << oat_filename;
return false;
@@ -1064,7 +1064,7 @@ static int dex2oat(int argc, char** argv) {
WatchDog watch_dog(watch_dog_enabled);
// Check early that the result of compilation can be written
- UniquePtr<File> oat_file;
+ std::unique_ptr<File> oat_file;
bool create_file = !oat_unstripped.empty(); // as opposed to using open file descriptor
if (create_file) {
oat_file.reset(OS::CreateEmptyFile(oat_unstripped.c_str()));
@@ -1124,7 +1124,7 @@ static int dex2oat(int argc, char** argv) {
LOG(ERROR) << "Failed to create dex2oat";
return EXIT_FAILURE;
}
- UniquePtr<Dex2Oat> dex2oat(p_dex2oat);
+ std::unique_ptr<Dex2Oat> dex2oat(p_dex2oat);
// Runtime::Create acquired the mutator_lock_ that is normally given away when we Runtime::Start,
// give it away now so that we don't starve GC.
Thread* self = Thread::Current();
@@ -1136,7 +1136,7 @@ static int dex2oat(int argc, char** argv) {
WellKnownClasses::Init(self->GetJniEnv());
// If --image-classes was specified, calculate the full list of classes to include in the image
- UniquePtr<CompilerDriver::DescriptorSet> image_classes(nullptr);
+ std::unique_ptr<CompilerDriver::DescriptorSet> image_classes(nullptr);
if (image_classes_filename != nullptr) {
std::string error_msg;
if (image_classes_zip_filename != nullptr) {
@@ -1162,7 +1162,7 @@ static int dex2oat(int argc, char** argv) {
if (dex_filenames.empty()) {
ATRACE_BEGIN("Opening zip archive from file descriptor");
std::string error_msg;
- UniquePtr<ZipArchive> zip_archive(ZipArchive::OpenFromFd(zip_fd, zip_location.c_str(),
+ std::unique_ptr<ZipArchive> zip_archive(ZipArchive::OpenFromFd(zip_fd, zip_location.c_str(),
&error_msg));
if (zip_archive.get() == nullptr) {
LOG(ERROR) << "Failed to open zip from file descriptor for '" << zip_location << "': "
@@ -1190,7 +1190,7 @@ static int dex2oat(int argc, char** argv) {
for (size_t i = 0; i < dex_files.size(); ++i) {
const DexFile* dex_file = dex_files[i];
std::string tmp_file_name(StringPrintf("/data/local/tmp/dex2oat.%d.%zd.dex", getpid(), i));
- UniquePtr<File> tmp_file(OS::CreateEmptyFile(tmp_file_name.c_str()));
+ std::unique_ptr<File> tmp_file(OS::CreateEmptyFile(tmp_file_name.c_str()));
if (tmp_file.get() == nullptr) {
PLOG(ERROR) << "Failed to open file " << tmp_file_name
<< ". Try: adb shell chmod 777 /data/local/tmp";
@@ -1225,7 +1225,7 @@ static int dex2oat(int argc, char** argv) {
}
}
- UniquePtr<const CompilerDriver> compiler(dex2oat->CreateOatFile(boot_image_option,
+ std::unique_ptr<const CompilerDriver> compiler(dex2oat->CreateOatFile(boot_image_option,
android_root,
is_host,
dex_files,
@@ -1324,10 +1324,10 @@ static int dex2oat(int argc, char** argv) {
if (oat_unstripped != oat_stripped) {
timings.NewSplit("dex2oat OatFile copy");
oat_file.reset();
- UniquePtr<File> in(OS::OpenFileForReading(oat_unstripped.c_str()));
- UniquePtr<File> out(OS::CreateEmptyFile(oat_stripped.c_str()));
+ std::unique_ptr<File> in(OS::OpenFileForReading(oat_unstripped.c_str()));
+ std::unique_ptr<File> out(OS::CreateEmptyFile(oat_stripped.c_str()));
size_t buffer_size = 8192;
- UniquePtr<uint8_t> buffer(new uint8_t[buffer_size]);
+ std::unique_ptr<uint8_t> buffer(new uint8_t[buffer_size]);
while (true) {
int bytes_read = TEMP_FAILURE_RETRY(read(in->Fd(), buffer.get(), buffer_size));
if (bytes_read <= 0) {
diff --git a/disassembler/Android.mk b/disassembler/Android.mk
index 17828fd..dd4e9d5 100644
--- a/disassembler/Android.mk
+++ b/disassembler/Android.mk
@@ -46,7 +46,6 @@ define build-libart-disassembler
ifeq ($$(art_target_or_host),host)
LOCAL_IS_HOST_MODULE := true
endif
- include art/build/Android.libcxx.mk
LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
ifeq ($$(art_ndebug_or_debug),ndebug)
LOCAL_MODULE := libart-disassembler
@@ -89,6 +88,7 @@ define build-libart-disassembler
LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common.mk
LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk
ifeq ($$(art_target_or_host),target)
+ include external/libcxx/libcxx.mk
LOCAL_SHARED_LIBRARIES += libcutils libvixl
include $(BUILD_SHARED_LIBRARY)
else # host
diff --git a/oatdump/oatdump.cc b/oatdump/oatdump.cc
index aaf9ed5..dcae502 100644
--- a/oatdump/oatdump.cc
+++ b/oatdump/oatdump.cc
@@ -207,7 +207,7 @@ class OatDumper {
const OatFile::OatDexFile* oat_dex_file = oat_dex_files_[i];
CHECK(oat_dex_file != nullptr);
std::string error_msg;
- UniquePtr<const DexFile> dex_file(oat_dex_file->OpenDexFile(&error_msg));
+ std::unique_ptr<const DexFile> dex_file(oat_dex_file->OpenDexFile(&error_msg));
if (dex_file.get() == nullptr) {
LOG(WARNING) << "Failed to open dex file '" << oat_dex_file->GetDexFileLocation()
<< "': " << error_msg;
@@ -235,7 +235,7 @@ class OatDumper {
const OatFile::OatDexFile* oat_dex_file = oat_dex_files_[i];
CHECK(oat_dex_file != NULL);
std::string error_msg;
- UniquePtr<const DexFile> dex_file(oat_dex_file->OpenDexFile(&error_msg));
+ std::unique_ptr<const DexFile> dex_file(oat_dex_file->OpenDexFile(&error_msg));
if (dex_file.get() == nullptr) {
LOG(WARNING) << "Failed to open dex file '" << oat_dex_file->GetDexFileLocation()
<< "': " << error_msg;
@@ -289,7 +289,7 @@ class OatDumper {
// Create the verifier early.
std::string error_msg;
- UniquePtr<const DexFile> dex_file(oat_dex_file.OpenDexFile(&error_msg));
+ std::unique_ptr<const DexFile> dex_file(oat_dex_file.OpenDexFile(&error_msg));
if (dex_file.get() == NULL) {
os << "NOT FOUND: " << error_msg << "\n\n";
return;
@@ -732,7 +732,7 @@ class OatDumper {
bool dump_raw_mapping_table_;
bool dump_raw_gc_map_;
std::set<uintptr_t> offsets_;
- UniquePtr<Disassembler> disassembler_;
+ std::unique_ptr<Disassembler> disassembler_;
};
class ImageDumper {
@@ -871,7 +871,7 @@ class ImageDumper {
os_ = saved_os;
}
os << "STATS:\n" << std::flush;
- UniquePtr<File> file(OS::OpenFileForReading(image_filename.c_str()));
+ std::unique_ptr<File> file(OS::OpenFileForReading(image_filename.c_str()));
if (file.get() == NULL) {
LOG(WARNING) << "Failed to find image in " << image_filename;
}
@@ -1190,7 +1190,7 @@ class ImageDumper {
std::vector<mirror::ArtMethod*> method_outlier;
std::vector<size_t> method_outlier_size;
std::vector<double> method_outlier_expansion;
- std::vector<std::pair<std::string, size_t> > oat_dex_file_sizes;
+ std::vector<std::pair<std::string, size_t>> oat_dex_file_sizes;
explicit Stats()
: oat_file_bytes(0),
@@ -1438,7 +1438,7 @@ class ImageDumper {
// threshold, we assume 2 bytes per instruction and 2 instructions per block.
kLargeMethodDexBytes = 16000
};
- UniquePtr<OatDumper> oat_dumper_;
+ std::unique_ptr<OatDumper> oat_dumper_;
std::ostream* os_;
gc::space::ImageSpace& image_space_;
const ImageHeader& image_header_;
@@ -1465,7 +1465,7 @@ static int oatdump(int argc, char** argv) {
const char* boot_image_filename = NULL;
std::string elf_filename_prefix;
std::ostream* os = &std::cout;
- UniquePtr<std::ofstream> out;
+ std::unique_ptr<std::ofstream> out;
bool dump_raw_mapping_table = false;
bool dump_raw_gc_map = false;
@@ -1548,7 +1548,7 @@ static int oatdump(int argc, char** argv) {
fprintf(stderr, "Failed to create runtime\n");
return EXIT_FAILURE;
}
- UniquePtr<Runtime> runtime(Runtime::Current());
+ std::unique_ptr<Runtime> runtime(Runtime::Current());
// Runtime::Create acquired the mutator_lock_ that is normally given away when we Runtime::Start,
// give it away now and then switch to a more manageable ScopedObjectAccess.
Thread::Current()->TransitionFromRunnableToSuspended(kNative);
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 @@ define build-libart
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 @@ $$(ENUM_OPERATOR_OUT_GEN): $$(GENERATED_SRC_DIR)/%_operator_out.cc : $(LOCAL_PAT
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 aa18c97..b22ca82 100644
--- a/runtime/arch/stub_test.cc
+++ b/runtime/arch/stub_test.cc
@@ -841,7 +841,7 @@ TEST_F(StubTest, AllocObject) {
// 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 @@ TEST(BitVector, Test) {
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 @@ namespace art {
// 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, MeanTest) {
}
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, VarianceTest) {
}
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, Percentile) {
}
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, UpdateRange) {
}
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, Reset) {
}
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, MultipleCreateHist) {
}
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, SingleValue) {
}
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, CappingPercentiles) {
}
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 @@ std::vector<std::string> gVerboseMethods;
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 @@ class LogMessage {
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 @@ class RandomAccessFileTest : public testing::Test {
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 @@ class RandomAccessFileTest : public testing::Test {
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 @@ class RandomAccessFileTest : public testing::Test {
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 @@ class RandomAccessFileTest : public testing::Test {
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 382aba3..0cc6b41 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 @@ const DexFile* ClassLinker::FindDexFileInOatLocation(const char* dex_location,
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 @@ class ScopedFlock {
}
private:
- UniquePtr<File> file_;
+ std::unique_ptr<File> file_;
DISALLOW_COPY_AND_ASSIGN(ScopedFlock);
};
@@ -784,7 +783,7 @@ const DexFile* ClassLinker::FindOrCreateOatFileForDexLocation(const char* dex_lo
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 @@ bool ClassLinker::VerifyOatFileChecksums(const OatFile* oat_file,
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 DexFile* ClassLinker::VerifyAndOpenDexFileFromOatFile(const std::string& o
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 @@ mirror::DexCache* ClassLinker::AllocDexCache(Thread* self, const DexFile& dex_fi
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 @@ mirror::Class* ClassLinker::CreateProxyClass(ScopedObjectAccessAlreadyRunnable&
{
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 @@ mirror::Class* ClassLinker::CreateProxyClass(ScopedObjectAccessAlreadyRunnable&
}
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::Class* ClassLinker::CreateProxyClass(ScopedObjectAccessAlreadyRunnable&
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 @@ void ClassLinker::ConstructFieldMap(const DexFile& dex_file, const DexFile::Clas
}
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 @@ bool ClassLinker::LinkSuperClass(const Handle<mirror::Class>& klass) {
// 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 @@ bool ClassLinker::LinkVirtualMethods(const Handle<mirror::Class>& klass) {
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::LinkVirtualMethods(const Handle<mirror::Class>& klass) {
}
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 @@ bool ClassLinker::LinkInterfaceMethods(const Handle<mirror::Class>& klass,
}
// 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 @@ bool ClassLinker::LinkInterfaceMethods(const Handle<mirror::Class>& klass,
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 @@ bool ClassLinker::LinkInterfaceMethods(const Handle<mirror::Class>& klass,
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 4760f13..54805be 100644
--- a/runtime/class_linker.h
+++ b/runtime/class_linker.h
@@ -487,7 +487,7 @@ class ClassLinker {
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)
@@ -497,14 +497,14 @@ class ClassLinker {
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)
@@ -571,7 +571,7 @@ class ClassLinker {
// 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 @@ class ScratchFile {
private:
std::string filename_;
- UniquePtr<File> file_;
+ std::unique_ptr<File> file_;
};
class CommonRuntimeTest : public testing::Test {
@@ -304,7 +304,7 @@ class CommonRuntimeTest : public testing::Test {
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 @@ JDWP::JdwpError Dbg::GetOwnedMonitors(JDWP::ObjectId thread_id,
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 @@ JDWP::JdwpError Dbg::GetThisObject(JDWP::ObjectId thread_id, JDWP::FrameId frame
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 @@ JDWP::JdwpError Dbg::GetLocalValue(JDWP::ObjectId thread_id, JDWP::FrameId frame
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 @@ JDWP::JdwpError Dbg::SetLocalValue(JDWP::ObjectId thread_id, JDWP::FrameId frame
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 @@ class StringTable {
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 @@ bool DexFile::GetChecksum(const char* filename, uint32_t* checksum, std::string*
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 @@ bool DexFile::GetChecksum(const char* filename, uint32_t* checksum, std::string*
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 @@ bool DexFile::DisableWrite() const {
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 DexFile* DexFile::OpenFile(int fd, const char* location, bool verify,
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::OpenMemory(const std::string& location,
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 @@ const DexFile* DexFile::OpenMemory(const byte* base,
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 DexFile::DecodeDebugInfo(const CodeItem* code_item, bool is_static, uint32_
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 @@ class DexFile {
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 @@ static inline byte* DecodeBase64(const char* src, size_t* dst_size) {
*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 @@ static const DexFile* OpenDexFileBase64(const char* base64,
// 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 @@ static const DexFile* OpenDexFileBase64(const char* base64,
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 @@ static bool IsDataSectionType(uint32_t map_type) {
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 @@ bool DexFileVerifier::CheckIntraCodeItem() {
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 @@ namespace art {
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 @@ class DexMethodIterator {
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(File* file, bool writable, bool program_header_only)
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 @@ bool ElfFile::Load(bool executable, std::string* error_msg) {
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 @@ bool ElfFile::Load(bool executable, std::string* error_msg) {
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 @@ void ElfFile::GdbJITSupport() {
// 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 @@ class ElfFile {
// 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 @@ class BuildQuickArgumentVisitor FINAL : public QuickArgumentVisitor {
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 @@ class RememberForGcArgumentVisitor FINAL : public QuickArgumentVisitor {
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 @@ class AtomicStack {
public:
// Capacity is how many elements we can store in the stack.
static AtomicStack* Create(const std::string& name, size_t capacity) {
- UniquePtr<AtomicStack> mark_stack(new AtomicStack(name, capacity));
+ std::unique_ptr<AtomicStack> mark_stack(new AtomicStack(name, capacity));
mark_stack->Init();
return mark_stack.release();
}
@@ -215,7 +215,7 @@ class AtomicStack {
std::string name_;
// Memory mapping of the atomic stack.
- UniquePtr<MemMap> mem_map_;
+ std::unique_ptr<MemMap> mem_map_;
// Back index (index after the last element pushed).
AtomicInteger back_index_;
diff --git a/runtime/gc/accounting/card_table.cc b/runtime/gc/accounting/card_table.cc
index 714e6f7..43a173e 100644
--- a/runtime/gc/accounting/card_table.cc
+++ b/runtime/gc/accounting/card_table.cc
@@ -55,7 +55,7 @@ CardTable* CardTable::Create(const byte* heap_begin, size_t heap_capacity) {
size_t capacity = heap_capacity / kCardSize;
/* Allocate an extra 256 bytes to allow fixed low-byte of base */
std::string error_msg;
- UniquePtr<MemMap> mem_map(MemMap::MapAnonymous("card table", NULL,
+ std::unique_ptr<MemMap> mem_map(MemMap::MapAnonymous("card table", NULL,
capacity + 256, PROT_READ | PROT_WRITE,
false, &error_msg));
CHECK(mem_map.get() != NULL) << "couldn't allocate card table: " << error_msg;
diff --git a/runtime/gc/accounting/card_table.h b/runtime/gc/accounting/card_table.h
index 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 @@ class CardTable {
void VerifyCardTable();
// Mmapped pages for the card table
- UniquePtr<MemMap> mem_map_;
+ std::unique_ptr<MemMap> mem_map_;
// Value used to compute card table addresses from object addresses, see GetBiasedBegin
byte* const biased_begin_;
// Card table doesn't begin at the beginning of the mem_map_, instead it is displaced by offset
diff --git a/runtime/gc/accounting/gc_allocator.h b/runtime/gc/accounting/gc_allocator.h
index 7dd7cca..1d96112 100644
--- a/runtime/gc/accounting/gc_allocator.h
+++ b/runtime/gc/accounting/gc_allocator.h
@@ -73,7 +73,7 @@ class GcAllocatorImpl : public std::allocator<T> {
// GCAllocatorImpl<T> if kMeasureGCMemoryOverhead is true, std::allocator<T> otherwise.
template <typename T>
class GcAllocator : public TypeStaticIf<kMeasureGcMemoryOverhead, GcAllocatorImpl<T>,
- std::allocator<T> >::type {
+ std::allocator<T>>::type {
};
} // namespace accounting
diff --git a/runtime/gc/accounting/mod_union_table.cc b/runtime/gc/accounting/mod_union_table.cc
index 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 @@ class HeapBitmap;
// cleared between GC phases, reducing the number of dirty cards that need to be scanned.
class ModUnionTable {
public:
- typedef std::set<byte*, std::less<byte*>, GcAllocator<byte*> > CardSet;
+ typedef std::set<byte*, std::less<byte*>, GcAllocator<byte*>> CardSet;
explicit ModUnionTable(const std::string& name, Heap* heap, space::ContinuousSpace* space)
: name_(name),
@@ -126,7 +126,7 @@ class ModUnionTableReferenceCache : public ModUnionTable {
// Maps from dirty cards to their corresponding alloc space references.
SafeMap<const byte*, std::vector<mirror::HeapReference<mirror::Object>*>, std::less<const byte*>,
- GcAllocator<std::pair<const byte*, std::vector<mirror::HeapReference<mirror::Object>*> > > >
+ GcAllocator<std::pair<const byte*, std::vector<mirror::HeapReference<mirror::Object>*>>> >
references_;
};
diff --git a/runtime/gc/accounting/remembered_set.cc b/runtime/gc/accounting/remembered_set.cc
index 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 @@ namespace accounting {
// from the free list spaces to the bump pointer spaces.
class RememberedSet {
public:
- typedef std::set<byte*, std::less<byte*>, GcAllocator<byte*> > CardSet;
+ typedef std::set<byte*, std::less<byte*>, GcAllocator<byte*>> CardSet;
explicit RememberedSet(const std::string& name, Heap* heap, space::ContinuousSpace* space)
: name_(name), heap_(heap), space_(space) {}
diff --git a/runtime/gc/accounting/space_bitmap-inl.h b/runtime/gc/accounting/space_bitmap-inl.h
index 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 @@ SpaceBitmap<kAlignment>* SpaceBitmap<kAlignment>::Create(
// Round up since heap_capacity is not necessarily a multiple of kAlignment * kBitsPerWord.
const size_t bitmap_size = ComputeBitmapSize(heap_capacity);
std::string error_msg;
- UniquePtr<MemMap> mem_map(MemMap::MapAnonymous(name.c_str(), nullptr, bitmap_size,
+ std::unique_ptr<MemMap> mem_map(MemMap::MapAnonymous(name.c_str(), nullptr, bitmap_size,
PROT_READ | PROT_WRITE, false, &error_msg));
if (UNLIKELY(mem_map.get() == nullptr)) {
LOG(ERROR) << "Failed to allocate bitmap " << name << ": " << error_msg;
@@ -226,7 +226,7 @@ void SpaceBitmap<kAlignment>::WalkFieldsInOrder(SpaceBitmap<kAlignment>* visited
template<size_t kAlignment>
void SpaceBitmap<kAlignment>::InOrderWalk(ObjectCallback* callback, void* arg) {
- UniquePtr<SpaceBitmap<kAlignment>> visited(
+ std::unique_ptr<SpaceBitmap<kAlignment>> visited(
Create("bitmap for in-order walk", reinterpret_cast<byte*>(heap_begin_),
IndexToOffset(bitmap_size_ / kWordSize)));
CHECK(bitmap_begin_ != nullptr);
diff --git a/runtime/gc/accounting/space_bitmap.h b/runtime/gc/accounting/space_bitmap.h
index 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 @@ class SpaceBitmap {
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
// Backing storage for bitmap.
- UniquePtr<MemMap> mem_map_;
+ std::unique_ptr<MemMap> mem_map_;
// This bitmap itself, word sized for efficiency in scanning.
uword* const bitmap_begin_;
diff --git a/runtime/gc/accounting/space_bitmap_test.cc b/runtime/gc/accounting/space_bitmap_test.cc
index 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 @@ class SpaceBitmapTest : public CommonRuntimeTest {};
TEST_F(SpaceBitmapTest, Init) {
byte* heap_begin = reinterpret_cast<byte*>(0x10000000);
size_t heap_capacity = 16 * MB;
- UniquePtr<ContinuousSpaceBitmap> space_bitmap(
+ std::unique_ptr<ContinuousSpaceBitmap> space_bitmap(
ContinuousSpaceBitmap::Create("test bitmap", heap_begin, heap_capacity));
EXPECT_TRUE(space_bitmap.get() != NULL);
}
@@ -60,7 +60,7 @@ TEST_F(SpaceBitmapTest, ScanRange) {
byte* heap_begin = reinterpret_cast<byte*>(0x10000000);
size_t heap_capacity = 16 * MB;
- UniquePtr<ContinuousSpaceBitmap> space_bitmap(
+ std::unique_ptr<ContinuousSpaceBitmap> space_bitmap(
ContinuousSpaceBitmap::Create("test bitmap", heap_begin, heap_capacity));
EXPECT_TRUE(space_bitmap.get() != NULL);
@@ -120,7 +120,7 @@ void RunTest() NO_THREAD_SAFETY_ANALYSIS {
for (int i = 0; i < 5 ; ++i) {
- UniquePtr<ContinuousSpaceBitmap> space_bitmap(
+ std::unique_ptr<ContinuousSpaceBitmap> space_bitmap(
ContinuousSpaceBitmap::Create("test bitmap", heap_begin, heap_capacity));
for (int j = 0; j < 10000; ++j) {
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 @@ size_t RosAlloc::FreeFromRun(Thread* self, void* ptr, Run* run) {
// 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 @@ size_t RosAlloc::BulkFree(Thread* self, void** ptrs, size_t num_ptrs) {
#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 @@ size_t RosAlloc::BulkFree(Thread* self, void** ptrs, size_t num_ptrs) {
// 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 @@ size_t RosAlloc::BulkFree(Thread* self, void** ptrs, size_t num_ptrs) {
// 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 @@ void RosAlloc::Run::Verify(Thread* self, RosAlloc* rosalloc) {
} 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 @@ class RosAlloc {
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 @@ class RosAlloc {
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 @@ class MarkSweep : public GarbageCollector {
// 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 @@ class Heap {
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 @@ class Heap {
// 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 @@ class Heap {
};
// 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 @@ class Heap {
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 @@ TEST_F(HeapTest, GarbageCollectClassLinkerInit) {
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, GarbageCollectClassLinkerInit) {
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 @@ BumpPointerSpace* BumpPointerSpace::Create(const std::string& name, size_t capac
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 @@ ImageHeader* ImageSpace::ReadImageHeaderOrDie(const char* image_location,
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 @@ ImageSpace* ImageSpace::Init(const char* image_filename, const char* image_locat
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 @@ ImageSpace* ImageSpace::Init(const char* image_filename, const char* image_locat
}
// 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 @@ ImageSpace* ImageSpace::Init(const char* image_filename, const char* image_locat
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 @@ ImageSpace* ImageSpace::Init(const char* image_filename, const char* image_locat
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 @@ ImageSpace* ImageSpace::Init(const char* image_filename, const char* image_locat
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 @@ class ImageSpace : public MemMapSpace {
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 @@ class ImageSpace : public MemMapSpace {
// 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 @@ class LargeObjectMapSpace : public LargeObjectSpace {
// 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 @@ class FreeListSpace FINAL : public LargeObjectSpace {
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 @@ void LargeObjectSpaceTest::LargeObjectTest() {
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 @@ ZygoteSpace* MallocSpace::CreateZygoteSpace(const char* alloc_space_name, bool l
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 @@ class DiscontinuousSpace : public Space {
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 @@ class MemMapSpace : public ContinuousSpace {
}
// 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 @@ class ContinuousMemMapAllocSpace : public MemMapSpace, public AllocSpace {
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 @@ static inline size_t test_rand(size_t* seed) {
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 @@ void SpaceTest::SizeFootPrintGrowthLimitAndTrimBody(MallocSpace* space, intptr_t
// 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 @@ class Hprof {
}
}
- 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 @@ class IndirectReferenceTable {
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 @@ static void InstrumentationInstallStack(Thread* thread, void* arg)
}
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 @@ class InternTable {
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 @@ static JdwpError FinishInvoke(JdwpState*, Request& request, ExpandBuf* pReply,
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(const JdwpOptions* options)
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 @@ TEST_F(JniInternalTest, RegisterAndUnregisterNatives) {
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, SignedStream) {
}
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 @@ static bool CheckMapRequest(byte* expected_ptr, void* actual_ptr, size_t byte_co
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 @@ class MemMapTest : public testing::Test {
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 @@ TEST_F(MemMapTest, MapAnonymousEmpty) {
#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, MapAnonymousEmpty32bit) {
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 @@ TEST_F(MemMapTest, MapAnonymousExactAddr) {
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 @@ TEST_F(MemMapTest, MapAnonymousExactAddr) {
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, RemapAtEnd32bit) {
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 @@ TEST_F(MemMapTest, MapAnonymousOverflow) {
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 @@ TEST_F(MemMapTest, MapAnonymousOverflow) {
#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, MapAnonymousLow4GBExpectedTooHigh) {
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 uint32_t ArtMethod::GetDexMethodIndex() {
}
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 bd9d5ab..bb43328 100644
--- a/runtime/mirror/art_method.h
+++ b/runtime/mirror/art_method.h
@@ -408,13 +408,13 @@ class MANAGED ArtMethod : public Object {
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 DexCache* Class::GetDexCache() {
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 ArtMethod* Class::GetDirectMethod(int32_t i) {
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 @@ inline uint32_t Class::NumDirectMethods() {
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 ArtMethod* Class::GetVirtualMethodDuringLinking(uint32_t i) {
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 void Class::SetVTable(ObjectArray<ArtMethod>* new_vtable) {
}
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 ObjectArray<ArtField>* Class::GetIFields() {
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 ArtField* Class::GetStaticField(uint32_t i) // TODO: uint16_t
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 ArtField* Class::GetInstanceField(uint32_t i) { // TODO: uint16_t
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 @@ class MANAGED Class : public Object {
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 @@ class MANAGED Class : public Object {
// 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 @@ class MANAGED Class : public Object {
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 @@ class MANAGED Class : public Object {
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 @@ class MANAGED DexCache : public Object {
}
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 @@ class MANAGED DexCache : public Object {
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 @@ inline ObjectArray<T>* ObjectArray<T>::CopyOf(Thread* self, int32_t new_length)
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 @@ class ObjectTest : public CommonRuntimeTest {
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, Clone) {
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 @@ namespace mirror {
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 @@ void Monitor::Inflate(Thread* self, Thread* owner, mirror::Object* obj, int32_t
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 @@ static jboolean IsDexOptNeededInternal(JNIEnv* env, const char* filename,
// 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 @@ static jstring VMClassLoader_getBootClassPathResource(JNIEnv* env, jclass, jstri
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 @@ OatFile* OatFile::OpenMemory(std::vector<uint8_t>& oat_contents,
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 @@ OatFile* OatFile::Open(const std::string& filename,
//
// 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 @@ OatFile* OatFile::OpenDlopen(const std::string& elf_filename,
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 @@ OatFile* OatFile::OpenElfFile(File* file,
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 @@ class OatFile {
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::CreateEmptyFile(const char* name) {
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 @@ TEST_F(ParsedOptionsTest, ParsedOptions) {
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 @@ class BackgroundMethodSamplingProfiler {
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 dc42723..c08cc30 100644
--- a/runtime/reflection.cc
+++ b/runtime/reflection.cc
@@ -344,7 +344,7 @@ class ArgArray {
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 @@ void Runtime::StartDaemonThreads() {
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 @@ enum VisitRootFlags : uint8_t {
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 @@ class Runtime {
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 @@ namespace art {
// 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 @@ void SignalCatcher::Output(const std::string& s) {
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 8c057e3..ebf9078 100644
--- a/runtime/thread.cc
+++ b/runtime/thread.cc
@@ -933,7 +933,7 @@ static bool ShouldShowNativeStack(const Thread* thread)
}
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();
@@ -2148,7 +2148,7 @@ static void VerifyRoot(mirror::Object** root, void* /*arg*/, uint32_t /*thread_i
}
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 20830c2..62fa323 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 @@ class ThreadPoolWorker {
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 @@ ProfilerClockSource Trace::default_clock_source_ = kDefaultProfilerClockSource;
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 @@ void Trace::Start(const char* trace_filename, int trace_fd, int buffer_size, int
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 @@ class Trace FINAL : public instrumentation::InstrumentationListener {
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 @@ void GetThreadStack(pthread_t thread, void** stack_base, size_t* stack_size) {
}
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 @@ void DumpNativeStack(std::ostream& os, pid_t tid, const char* prefix,
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 @@ bool MethodVerifier::CodeFlowVerifyInstruction(uint32_t* start_guess) {
// 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 @@ bool MethodVerifier::UpdateRegisters(uint32_t next_insn, const RegisterLine* mer
}
}
} 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 @@ class PcToRegisterLineTable {
}
private:
- UniquePtr<RegisterLine*[]> register_lines_;
+ std::unique_ptr<RegisterLine*[]> register_lines_;
size_t size_;
};
@@ -617,14 +617,14 @@ class MethodVerifier {
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 @@ class MethodVerifier {
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 @@ MemMap* ZipEntry::ExtractToMemMap(const char* entry_filename, std::string* error
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 @@ ZipEntry* ZipArchive::Find(const char* name, std::string* error_msg) const {
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 @@ class ZipArchiveTest : public CommonRuntimeTest {};
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;
diff --git a/test/ReferenceMap/stack_walk_refmap_jni.cc b/test/ReferenceMap/stack_walk_refmap_jni.cc
index d8a0eef..48a6c61 100644
--- a/test/ReferenceMap/stack_walk_refmap_jni.cc
+++ b/test/ReferenceMap/stack_walk_refmap_jni.cc
@@ -15,8 +15,8 @@
*/
#include <stdio.h>
+#include <memory>
-#include "UniquePtrCompat.h"
#include "class_linker.h"
#include "dex_file-inl.h"
#include "gc_map.h"
diff --git a/test/StackWalk/stack_walk_jni.cc b/test/StackWalk/stack_walk_jni.cc
index d230ddd..3cf2d0b 100644
--- a/test/StackWalk/stack_walk_jni.cc
+++ b/test/StackWalk/stack_walk_jni.cc
@@ -15,8 +15,8 @@
*/
#include <stdio.h>
+#include <memory>
-#include "UniquePtrCompat.h"
#include "class_linker.h"
#include "gc_map.h"
#include "mirror/art_method.h"