diff options
author | 2018-11-07 15:39:48 +0000 | |
---|---|---|
committer | 2018-11-08 10:26:57 +0000 | |
commit | 1a2a5cd58b7b667b664a7c20a4887a6cd89b4776 (patch) | |
tree | 8f92ca17ba6f8324881f52aa741ad5ed0f87016a /compiler/driver | |
parent | a5175541c197e7bf9b03651ea5da4e64a2ac2d27 (diff) |
Move profile compilation info to CompilerOptions.
Remove one HInliner dependency on the CompilerDriver.
Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Change-Id: If6f0ab864095641b5697c8c6f5100520f91d5e53
Diffstat (limited to 'compiler/driver')
-rw-r--r-- | compiler/driver/compiled_method_storage_test.cc | 3 | ||||
-rw-r--r-- | compiler/driver/compiler_driver.cc | 26 | ||||
-rw-r--r-- | compiler/driver/compiler_driver.h | 10 | ||||
-rw-r--r-- | compiler/driver/compiler_options.cc | 1 | ||||
-rw-r--r-- | compiler/driver/compiler_options.h | 8 |
5 files changed, 26 insertions, 22 deletions
diff --git a/compiler/driver/compiled_method_storage_test.cc b/compiler/driver/compiled_method_storage_test.cc index 5e2f444a24..8b35bd3cb1 100644 --- a/compiler/driver/compiled_method_storage_test.cc +++ b/compiler/driver/compiled_method_storage_test.cc @@ -33,8 +33,7 @@ TEST(CompiledMethodStorage, Deduplicate) { Compiler::kOptimizing, /* image_classes */ nullptr, /* thread_count */ 1u, - /* swap_fd */ -1, - /* profile_compilation_info */ nullptr); + /* swap_fd */ -1); CompiledMethodStorage* storage = driver.GetCompiledMethodStorage(); ASSERT_TRUE(storage->DedupeEnabled()); // The default. diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc index 8c276bb706..f8e2dff25a 100644 --- a/compiler/driver/compiler_driver.cc +++ b/compiler/driver/compiler_driver.cc @@ -248,8 +248,7 @@ CompilerDriver::CompilerDriver( Compiler::Kind compiler_kind, HashSet<std::string>* image_classes, size_t thread_count, - int swap_fd, - const ProfileCompilationInfo* profile_compilation_info) + int swap_fd) : compiler_options_(compiler_options), verification_results_(verification_results), compiler_(Compiler::Create(this, compiler_kind)), @@ -261,7 +260,6 @@ CompilerDriver::CompilerDriver( stats_(new AOTCompilationStats), compiler_context_(nullptr), compiled_method_storage_(swap_fd), - profile_compilation_info_(profile_compilation_info), max_arena_alloc_(0), dex_to_dex_compiler_(this) { DCHECK(compiler_options_ != nullptr); @@ -731,9 +729,11 @@ void CompilerDriver::ResolveConstStrings(const std::vector<const DexFile*>& dex_ continue; } + const ProfileCompilationInfo* profile_compilation_info = + GetCompilerOptions().GetProfileCompilationInfo(); const bool is_startup_class = - profile_compilation_info_ != nullptr && - profile_compilation_info_->ContainsClass(*dex_file, accessor.GetClassIdx()); + profile_compilation_info != nullptr && + profile_compilation_info->ContainsClass(*dex_file, accessor.GetClassIdx()); for (const ClassAccessor::Method& method : accessor.GetMethods()) { const bool is_clinit = (method.GetAccessFlags() & kAccConstructor) != 0 && @@ -741,8 +741,8 @@ void CompilerDriver::ResolveConstStrings(const std::vector<const DexFile*>& dex_ const bool is_startup_clinit = is_startup_class && is_clinit; if (only_startup_strings && - profile_compilation_info_ != nullptr && - (!profile_compilation_info_->GetMethodHotness(method.GetReference()).IsStartup() && + profile_compilation_info != nullptr && + (!profile_compilation_info->GetMethodHotness(method.GetReference()).IsStartup() && !is_startup_clinit)) { continue; } @@ -981,12 +981,14 @@ bool CompilerDriver::ShouldCompileBasedOnProfile(const MethodReference& method_r return true; } // If we are using a profile filter but do not have a profile compilation info, compile nothing. - if (profile_compilation_info_ == nullptr) { + const ProfileCompilationInfo* profile_compilation_info = + GetCompilerOptions().GetProfileCompilationInfo(); + if (profile_compilation_info == nullptr) { return false; } // Compile only hot methods, it is the profile saver's job to decide what startup methods to mark // as hot. - bool result = profile_compilation_info_->GetMethodHotness(method_ref).IsHot(); + bool result = profile_compilation_info->GetMethodHotness(method_ref).IsHot(); if (kDebugProfileGuidedCompilation) { LOG(INFO) << "[ProfileGuidedCompilation] " @@ -2644,10 +2646,12 @@ void CompilerDriver::Compile(jobject class_loader, const std::vector<const DexFile*>& dex_files, TimingLogger* timings) { if (kDebugProfileGuidedCompilation) { + const ProfileCompilationInfo* profile_compilation_info = + GetCompilerOptions().GetProfileCompilationInfo(); LOG(INFO) << "[ProfileGuidedCompilation] " << - ((profile_compilation_info_ == nullptr) + ((profile_compilation_info == nullptr) ? "null" - : profile_compilation_info_->DumpInfo(dex_files)); + : profile_compilation_info->DumpInfo(dex_files)); } dex_to_dex_compiler_.ClearState(); diff --git a/compiler/driver/compiler_driver.h b/compiler/driver/compiler_driver.h index f42e555410..b0f2dac683 100644 --- a/compiler/driver/compiler_driver.h +++ b/compiler/driver/compiler_driver.h @@ -99,8 +99,7 @@ class CompilerDriver { Compiler::Kind compiler_kind, HashSet<std::string>* image_classes, size_t thread_count, - int swap_fd, - const ProfileCompilationInfo* profile_compilation_info); + int swap_fd); ~CompilerDriver(); @@ -266,10 +265,6 @@ class CompilerDriver { return &compiled_method_storage_; } - const ProfileCompilationInfo* GetProfileCompilationInfo() const { - return profile_compilation_info_; - } - // Is `boot_image_filename` the name of a core image (small boot // image used for ART testing only)? static bool IsCoreImageFilename(const std::string& boot_image_filename) { @@ -419,9 +414,6 @@ class CompilerDriver { CompiledMethodStorage compiled_method_storage_; - // Info for profile guided compilation. - const ProfileCompilationInfo* const profile_compilation_info_; - size_t max_arena_alloc_; // Compiler for dex to dex (quickening). diff --git a/compiler/driver/compiler_options.cc b/compiler/driver/compiler_options.cc index 6b0e45629b..be8e10e41e 100644 --- a/compiler/driver/compiler_options.cc +++ b/compiler/driver/compiler_options.cc @@ -60,6 +60,7 @@ CompilerOptions::CompilerOptions() dump_pass_timings_(false), dump_stats_(false), top_k_profile_threshold_(kDefaultTopKProfileThreshold), + profile_compilation_info_(nullptr), verbose_methods_(), abort_on_hard_verifier_failure_(false), abort_on_soft_verifier_failure_(false), diff --git a/compiler/driver/compiler_options.h b/compiler/driver/compiler_options.h index 4a6bbfaae6..77f84820e5 100644 --- a/compiler/driver/compiler_options.h +++ b/compiler/driver/compiler_options.h @@ -42,6 +42,7 @@ class VerifierDepsTest; class DexFile; enum class InstructionSet; class InstructionSetFeatures; +class ProfileCompilationInfo; class CompilerOptions final { public: @@ -218,6 +219,10 @@ class CompilerOptions final { return compile_pic_; } + const ProfileCompilationInfo* GetProfileCompilationInfo() const { + return profile_compilation_info_; + } + bool HasVerboseMethods() const { return !verbose_methods_.empty(); } @@ -370,6 +375,9 @@ class CompilerOptions final { // When using a profile file only the top K% of the profiled samples will be compiled. double top_k_profile_threshold_; + // Info for profile guided compilation. + const ProfileCompilationInfo* profile_compilation_info_; + // Vector of methods to have verbose output enabled for. std::vector<std::string> verbose_methods_; |