diff options
Diffstat (limited to 'compiler')
45 files changed, 140 insertions, 139 deletions
diff --git a/compiler/Android.mk b/compiler/Android.mk index 8592aaa4e0..cb900eac61 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 7a91e47fb1..fb6c625926 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 c3c9961e70..23cd250678 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 e523d647ce..2c231e1212 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 70159cae9f..35d777ec7a 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 f714ecd3ad..c3b8d120d2 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 7049f8cf2c..0c2b6a7e01 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 ebac871b2d..2b1c4207e8 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 1c9e2e2127..508f1c70bd 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 85a2d04306..778a92d4d2 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 8e8a593192..749a2356eb 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 6f812384e4..d58015a979 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 5f89c214f2..5aa093a494 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 e19f3cf237..01c8f80dd2 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 93feb2934e..eb62f1b577 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 f3db41fb53..abca659cce 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 fe3a4e62b0..4efd27d476 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 571a091c8e..404e3f8692 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 b0fa63ccb5..8c06c9f3d3 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 ccc26a1baf..4c093c7738 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 aa4a5b2c07..0e2721014a 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 3c1a47b001..955e5d2614 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 d7de6f044e..e637cfbe1d 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 0babfe3a56..92be147a40 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 e261ee6cfc..70144c80fc 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 f8df2bbd8c..aff155affc 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 561d00fac0..9927fe1aa3 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 02d6fa5489..7664a7f635 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 df895ee07d..5990e8caea 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 c2211fb92c..cc74deb7be 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 cf28db3bfc..25c9b20514 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 78bdb4dbfb..741c2d7748 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 58aa6fd545..f11fb6ed23 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 ce35d0fae2..a7ee82edd3 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 7a41d87423..8c20aa8d06 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 d40990e86b..7684bb189d 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 290bf2519d..5fa0ccb143 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 d7d21ad05a..a5d681919d 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 0734b21f12..2b25f568d1 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 d03b99ff5a..24378b41aa 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 0f4a9a44e7..ab4999a2bc 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 1b050cf88d..754496b332 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 7cc253ccdb..4c52174936 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 c6fefde7c7..5deb6614d5 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 ccec7bafa4..bf8dd1fca7 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 |