diff options
author | Ian Rogers <irogers@google.com> | 2014-03-01 09:16:49 -0800 |
---|---|---|
committer | Ian Rogers <irogers@google.com> | 2014-03-01 09:16:49 -0800 |
commit | 3d504075f7c1204d581923460754bf6d3714b13f (patch) | |
tree | e095ee11d308f264b3dfb9f4c510f14fe6b1259c /compiler/driver | |
parent | e4a74a6ac8d1486b1227504044a60002e69a9fec (diff) | |
download | art-3d504075f7c1204d581923460754bf6d3714b13f.tar.gz art-3d504075f7c1204d581923460754bf6d3714b13f.tar.bz2 art-3d504075f7c1204d581923460754bf6d3714b13f.zip |
Make out arguments non-reference types.
Also, tidy some portable related code.
Change-Id: I67c8aa52eef8b556ca117ecda1b1e75465ba06a5
Diffstat (limited to 'compiler/driver')
-rw-r--r-- | compiler/driver/compiler_driver.cc | 78 | ||||
-rw-r--r-- | compiler/driver/compiler_driver.h | 50 | ||||
-rw-r--r-- | compiler/driver/compiler_driver_test.cc | 2 |
3 files changed, 64 insertions, 66 deletions
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc index 1b284de9c..931055b6b 100644 --- a/compiler/driver/compiler_driver.cc +++ b/compiler/driver/compiler_driver.cc @@ -441,11 +441,11 @@ const std::vector<uint8_t>* CompilerDriver::CreateQuickToInterpreterBridge() con void CompilerDriver::CompileAll(jobject class_loader, const std::vector<const DexFile*>& dex_files, - TimingLogger& timings) { + TimingLogger* timings) { DCHECK(!Runtime::Current()->IsStarted()); UniquePtr<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); + PreCompile(class_loader, dex_files, thread_pool.get(), timings); + Compile(class_loader, dex_files, thread_pool.get(), timings); if (dump_stats_) { stats_->Dump(); } @@ -483,7 +483,7 @@ static DexToDexCompilationLevel GetDexToDexCompilationlevel( } } -void CompilerDriver::CompileOne(mirror::ArtMethod* method, TimingLogger& timings) { +void CompilerDriver::CompileOne(mirror::ArtMethod* method, TimingLogger* timings) { DCHECK(!Runtime::Current()->IsStarted()); Thread* self = Thread::Current(); jobject jclass_loader; @@ -510,7 +510,7 @@ void CompilerDriver::CompileOne(mirror::ArtMethod* method, TimingLogger& timings dex_files.push_back(dex_file); UniquePtr<ThreadPool> thread_pool(new ThreadPool("Compiler driver thread pool", 0U)); - PreCompile(jclass_loader, dex_files, *thread_pool.get(), timings); + PreCompile(jclass_loader, dex_files, thread_pool.get(), timings); // Can we run DEX-to-DEX compiler on this class ? DexToDexCompilationLevel dex_to_dex_compilation_level = kDontDexToDexCompile; @@ -531,7 +531,7 @@ void CompilerDriver::CompileOne(mirror::ArtMethod* method, TimingLogger& timings } void CompilerDriver::Resolve(jobject class_loader, const std::vector<const DexFile*>& dex_files, - ThreadPool& thread_pool, TimingLogger& timings) { + ThreadPool* thread_pool, TimingLogger* timings) { for (size_t i = 0; i != dex_files.size(); ++i) { const DexFile* dex_file = dex_files[i]; CHECK(dex_file != NULL); @@ -540,7 +540,7 @@ void CompilerDriver::Resolve(jobject class_loader, const std::vector<const DexFi } void CompilerDriver::PreCompile(jobject class_loader, const std::vector<const DexFile*>& dex_files, - ThreadPool& thread_pool, TimingLogger& timings) { + ThreadPool* thread_pool, TimingLogger* timings) { LoadImageClasses(timings); Resolve(class_loader, dex_files, thread_pool, timings); @@ -625,13 +625,13 @@ static bool RecordImageClassesVisitor(mirror::Class* klass, void* arg) } // Make a list of descriptors for classes to include in the image -void CompilerDriver::LoadImageClasses(TimingLogger& timings) +void CompilerDriver::LoadImageClasses(TimingLogger* timings) LOCKS_EXCLUDED(Locks::mutator_lock_) { if (!IsImage()) { return; } - timings.NewSplit("LoadImageClasses"); + timings->NewSplit("LoadImageClasses"); // Make a first class to load all classes explicitly listed in the file Thread* self = Thread::Current(); ScopedObjectAccess soa(self); @@ -713,9 +713,9 @@ void CompilerDriver::FindClinitImageClassesCallback(mirror::Object* object, void MaybeAddToImageClasses(object->GetClass(), compiler_driver->image_classes_.get()); } -void CompilerDriver::UpdateImageClasses(TimingLogger& timings) { +void CompilerDriver::UpdateImageClasses(TimingLogger* timings) { if (IsImage()) { - timings.NewSplit("UpdateImageClasses"); + timings->NewSplit("UpdateImageClasses"); // Update image_classes_ with classes for objects created by <clinit> methods. Thread* self = Thread::Current(); @@ -1368,13 +1368,13 @@ class ParallelCompilationManager { jobject class_loader, CompilerDriver* compiler, const DexFile* dex_file, - ThreadPool& thread_pool) + ThreadPool* thread_pool) : index_(0), class_linker_(class_linker), class_loader_(class_loader), compiler_(compiler), dex_file_(dex_file), - thread_pool_(&thread_pool) {} + thread_pool_(thread_pool) {} ClassLinker* GetClassLinker() const { CHECK(class_linker_ != NULL); @@ -1628,7 +1628,7 @@ static void ResolveType(const ParallelCompilationManager* manager, size_t type_i } void CompilerDriver::ResolveDexFile(jobject class_loader, const DexFile& dex_file, - ThreadPool& thread_pool, TimingLogger& timings) { + ThreadPool* thread_pool, TimingLogger* timings) { ClassLinker* class_linker = Runtime::Current()->GetClassLinker(); // TODO: we could resolve strings here, although the string table is largely filled with class @@ -1638,16 +1638,16 @@ void CompilerDriver::ResolveDexFile(jobject class_loader, const DexFile& dex_fil if (IsImage()) { // For images we resolve all types, such as array, whereas for applications just those with // classdefs are resolved by ResolveClassFieldsAndMethods. - timings.NewSplit("Resolve Types"); + timings->NewSplit("Resolve Types"); context.ForAll(0, dex_file.NumTypeIds(), ResolveType, thread_count_); } - timings.NewSplit("Resolve MethodsAndFields"); + timings->NewSplit("Resolve MethodsAndFields"); context.ForAll(0, dex_file.NumClassDefs(), ResolveClassFieldsAndMethods, thread_count_); } void CompilerDriver::Verify(jobject class_loader, const std::vector<const DexFile*>& dex_files, - ThreadPool& thread_pool, TimingLogger& timings) { + ThreadPool* thread_pool, TimingLogger* timings) { for (size_t i = 0; i != dex_files.size(); ++i) { const DexFile* dex_file = dex_files[i]; CHECK(dex_file != NULL); @@ -1702,8 +1702,8 @@ static void VerifyClass(const ParallelCompilationManager* manager, size_t class_ } void CompilerDriver::VerifyDexFile(jobject class_loader, const DexFile& dex_file, - ThreadPool& thread_pool, TimingLogger& timings) { - timings.NewSplit("Verify Dex File"); + ThreadPool* thread_pool, TimingLogger* timings) { + timings->NewSplit("Verify Dex File"); ClassLinker* class_linker = Runtime::Current()->GetClassLinker(); ParallelCompilationManager context(class_linker, class_loader, this, &dex_file, thread_pool); context.ForAll(0, dex_file.NumClassDefs(), VerifyClass, thread_count_); @@ -1805,8 +1805,8 @@ static void InitializeClass(const ParallelCompilationManager* manager, size_t cl } void CompilerDriver::InitializeClasses(jobject jni_class_loader, const DexFile& dex_file, - ThreadPool& thread_pool, TimingLogger& timings) { - timings.NewSplit("InitializeNoClinit"); + ThreadPool* thread_pool, TimingLogger* timings) { + timings->NewSplit("InitializeNoClinit"); ClassLinker* class_linker = Runtime::Current()->GetClassLinker(); ParallelCompilationManager context(class_linker, jni_class_loader, this, &dex_file, thread_pool); size_t thread_count; @@ -1825,7 +1825,7 @@ void CompilerDriver::InitializeClasses(jobject jni_class_loader, const DexFile& void CompilerDriver::InitializeClasses(jobject class_loader, const std::vector<const DexFile*>& dex_files, - ThreadPool& thread_pool, TimingLogger& timings) { + ThreadPool* thread_pool, TimingLogger* timings) { for (size_t i = 0; i != dex_files.size(); ++i) { const DexFile* dex_file = dex_files[i]; CHECK(dex_file != NULL); @@ -1834,7 +1834,7 @@ void CompilerDriver::InitializeClasses(jobject class_loader, } void CompilerDriver::Compile(jobject class_loader, const std::vector<const DexFile*>& dex_files, - ThreadPool& thread_pool, TimingLogger& timings) { + ThreadPool* thread_pool, TimingLogger* timings) { for (size_t i = 0; i != dex_files.size(); ++i) { const DexFile* dex_file = dex_files[i]; CHECK(dex_file != NULL); @@ -1916,8 +1916,8 @@ void CompilerDriver::CompileClass(const ParallelCompilationManager* manager, siz } void CompilerDriver::CompileDexFile(jobject class_loader, const DexFile& dex_file, - ThreadPool& thread_pool, TimingLogger& timings) { - timings.NewSplit("Compile Dex File"); + ThreadPool* thread_pool, TimingLogger* timings) { + timings->NewSplit("Compile Dex File"); ParallelCompilationManager context(Runtime::Current()->GetClassLinker(), class_loader, this, &dex_file, thread_pool); context.ForAll(0, dex_file.NumClassDefs(), CompilerDriver::CompileClass, thread_count_); @@ -2037,38 +2037,38 @@ bool CompilerDriver::RequiresConstructorBarrier(Thread* self, const DexFile* dex bool CompilerDriver::WriteElf(const std::string& android_root, bool is_host, const std::vector<const art::DexFile*>& dex_files, - OatWriter& oat_writer, + OatWriter* oat_writer, art::File* file) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { return compiler_backend_->WriteElf(file, oat_writer, dex_files, android_root, is_host, *this); } void CompilerDriver::InstructionSetToLLVMTarget(InstructionSet instruction_set, - std::string& target_triple, - std::string& target_cpu, - std::string& target_attr) { + std::string* target_triple, + std::string* target_cpu, + std::string* target_attr) { switch (instruction_set) { case kThumb2: - target_triple = "thumb-none-linux-gnueabi"; - target_cpu = "cortex-a9"; - target_attr = "+thumb2,+neon,+neonfp,+vfp3,+db"; + *target_triple = "thumb-none-linux-gnueabi"; + *target_cpu = "cortex-a9"; + *target_attr = "+thumb2,+neon,+neonfp,+vfp3,+db"; break; case kArm: - target_triple = "armv7-none-linux-gnueabi"; + *target_triple = "armv7-none-linux-gnueabi"; // TODO: Fix for Nexus S. - target_cpu = "cortex-a9"; + *target_cpu = "cortex-a9"; // TODO: Fix for Xoom. - target_attr = "+v7,+neon,+neonfp,+vfp3,+db"; + *target_attr = "+v7,+neon,+neonfp,+vfp3,+db"; break; case kX86: - target_triple = "i386-pc-linux-gnu"; - target_attr = ""; + *target_triple = "i386-pc-linux-gnu"; + *target_attr = ""; break; case kMips: - target_triple = "mipsel-unknown-linux"; - target_attr = "mips32r2"; + *target_triple = "mipsel-unknown-linux"; + *target_attr = "mips32r2"; break; default: diff --git a/compiler/driver/compiler_driver.h b/compiler/driver/compiler_driver.h index 1bd2c1b20..5a5fc36f2 100644 --- a/compiler/driver/compiler_driver.h +++ b/compiler/driver/compiler_driver.h @@ -108,11 +108,11 @@ class CompilerDriver { ~CompilerDriver(); void CompileAll(jobject class_loader, const std::vector<const DexFile*>& dex_files, - TimingLogger& timings) + TimingLogger* timings) LOCKS_EXCLUDED(Locks::mutator_lock_); // Compile a single Method. - void CompileOne(mirror::ArtMethod* method, TimingLogger& timings) + void CompileOne(mirror::ArtMethod* method, TimingLogger* timings) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); VerificationResults* GetVerificationResults() const { @@ -123,16 +123,15 @@ class CompilerDriver { return method_inliner_map_; } - const InstructionSet& GetInstructionSet() const { + InstructionSet GetInstructionSet() const { return instruction_set_; } - const InstructionSetFeatures& GetInstructionSetFeatures() const { + InstructionSetFeatures GetInstructionSetFeatures() const { return instruction_set_features_; } const CompilerOptions& GetCompilerOptions() const { - DCHECK(compiler_options_ != nullptr); return *compiler_options_; } @@ -275,21 +274,21 @@ class CompilerDriver { support_boot_image_fixup_ = support_boot_image_fixup; } - ArenaPool& GetArenaPool() { - return arena_pool_; + ArenaPool* GetArenaPool() { + return &arena_pool_; } bool WriteElf(const std::string& android_root, bool is_host, const std::vector<const DexFile*>& dex_files, - OatWriter& oat_writer, + OatWriter* oat_writer, File* file); - // TODO: move to a common home for llvm helpers once quick/portable are merged + // TODO: move to a common home for llvm helpers once quick/portable are merged. static void InstructionSetToLLVMTarget(InstructionSet instruction_set, - std::string& target_triple, - std::string& target_cpu, - std::string& target_attr); + std::string* target_triple, + std::string* target_cpu, + std::string* target_attr); void SetCompilerContext(void* compiler_context) { compiler_context_ = compiler_context; @@ -310,8 +309,8 @@ class CompilerDriver { return dump_passes_; } - CumulativeLogger& GetTimingsLogger() const { - return *timings_logger_; + CumulativeLogger* GetTimingsLogger() const { + return timings_logger_; } class PatchInformation { @@ -507,43 +506,42 @@ class CompilerDriver { SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); void PreCompile(jobject class_loader, const std::vector<const DexFile*>& dex_files, - ThreadPool& thread_pool, TimingLogger& timings) + ThreadPool* thread_pool, TimingLogger* timings) LOCKS_EXCLUDED(Locks::mutator_lock_); - void LoadImageClasses(TimingLogger& timings); + void LoadImageClasses(TimingLogger* timings); // Attempt to resolve all type, methods, fields, and strings // referenced from code in the dex file following PathClassLoader // ordering semantics. void Resolve(jobject class_loader, const std::vector<const DexFile*>& dex_files, - ThreadPool& thread_pool, TimingLogger& timings) + ThreadPool* thread_pool, TimingLogger* timings) LOCKS_EXCLUDED(Locks::mutator_lock_); void ResolveDexFile(jobject class_loader, const DexFile& dex_file, - ThreadPool& thread_pool, TimingLogger& timings) + ThreadPool* thread_pool, TimingLogger* timings) LOCKS_EXCLUDED(Locks::mutator_lock_); void Verify(jobject class_loader, const std::vector<const DexFile*>& dex_files, - ThreadPool& thread_pool, TimingLogger& timings); + ThreadPool* thread_pool, TimingLogger* timings); void VerifyDexFile(jobject class_loader, const DexFile& dex_file, - ThreadPool& thread_pool, TimingLogger& timings) + ThreadPool* thread_pool, TimingLogger* timings) LOCKS_EXCLUDED(Locks::mutator_lock_); void InitializeClasses(jobject class_loader, const std::vector<const DexFile*>& dex_files, - ThreadPool& thread_pool, TimingLogger& timings) + ThreadPool* thread_pool, TimingLogger* timings) LOCKS_EXCLUDED(Locks::mutator_lock_); void InitializeClasses(jobject class_loader, const DexFile& dex_file, - ThreadPool& thread_pool, TimingLogger& timings) + ThreadPool* thread_pool, TimingLogger* timings) LOCKS_EXCLUDED(Locks::mutator_lock_, compiled_classes_lock_); - void UpdateImageClasses(TimingLogger& timings) - LOCKS_EXCLUDED(Locks::mutator_lock_); + void UpdateImageClasses(TimingLogger* timings) LOCKS_EXCLUDED(Locks::mutator_lock_); static void FindClinitImageClassesCallback(mirror::Object* object, void* arg) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); void Compile(jobject class_loader, const std::vector<const DexFile*>& dex_files, - ThreadPool& thread_pool, TimingLogger& timings); + ThreadPool* thread_pool, TimingLogger* timings); void CompileDexFile(jobject class_loader, const DexFile& dex_file, - ThreadPool& thread_pool, TimingLogger& timings) + ThreadPool* thread_pool, TimingLogger* timings) LOCKS_EXCLUDED(Locks::mutator_lock_); void CompileMethod(const DexFile::CodeItem* code_item, uint32_t access_flags, InvokeType invoke_type, uint16_t class_def_idx, uint32_t method_idx, diff --git a/compiler/driver/compiler_driver_test.cc b/compiler/driver/compiler_driver_test.cc index 34806ce29..2b3af6281 100644 --- a/compiler/driver/compiler_driver_test.cc +++ b/compiler/driver/compiler_driver_test.cc @@ -40,7 +40,7 @@ class CompilerDriverTest : public CommonCompilerTest { timings.StartSplit("CompileAll"); compiler_driver_->CompileAll(class_loader, Runtime::Current()->GetCompileTimeClassPath(class_loader), - timings); + &timings); MakeAllExecutable(class_loader); timings.EndSplit(); } |