diff options
author | Brian Carlstrom <bdc@google.com> | 2014-02-10 23:48:36 -0800 |
---|---|---|
committer | Brian Carlstrom <bdc@google.com> | 2014-02-24 14:24:12 -0800 |
commit | 6449c62e40ef3a9bb75f664f922555affb532ee4 (patch) | |
tree | 2f1b2120bd648c95dea32b68c8e168e42c8e24fd /compiler/driver/compiler_options.h | |
parent | 3fcf18e25241253f23efbeebe77b2a4c4a7c54d3 (diff) | |
download | art-6449c62e40ef3a9bb75f664f922555affb532ee4.zip art-6449c62e40ef3a9bb75f664f922555affb532ee4.tar.gz art-6449c62e40ef3a9bb75f664f922555affb532ee4.tar.bz2 |
Create CompilerOptions
Package up most compiler related options in CompilerOptions. Details include:
- Includes compiler filter, method thresholds, SEA IR mode.
- Excludes those needed during Runtime::Init such as CompilerCallbacks and VerificationResults.
- Pass CompilerOptions to CompilerDriver.
- Remove CompilerOptions from Runtime.
- Add ability to pass options for app and image dex2oat to runtime via
-Xcompiler-option and -Ximage-compiler-option respectively.
Other
- Replace 2x CompilerCallbacks implementations with one.
- Factor out execv code for use by both image and oat generation.
- More OatFile error_msg reporting.
- DCHECK for SuspendAll found trying to run valgrind.
Change-Id: Iecb57da907be0c856d00c3cd634b5042a229e620
Diffstat (limited to 'compiler/driver/compiler_options.h')
-rw-r--r-- | compiler/driver/compiler_options.h | 136 |
1 files changed, 136 insertions, 0 deletions
diff --git a/compiler/driver/compiler_options.h b/compiler/driver/compiler_options.h new file mode 100644 index 0000000..9f6745b --- /dev/null +++ b/compiler/driver/compiler_options.h @@ -0,0 +1,136 @@ +/* + * 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_COMPILER_DRIVER_COMPILER_OPTIONS_H_ +#define ART_COMPILER_DRIVER_COMPILER_OPTIONS_H_ + +namespace art { + +class CompilerOptions { + public: + enum CompilerFilter { + kInterpretOnly, // Compile nothing. + kSpace, // Maximize space savings. + kBalanced, // Try to get the best performance return on compilation investment. + kSpeed, // Maximize runtime performance. + kEverything // Force compilation (Note: excludes compilaton of class initializers). + }; + + // Guide heuristics to determine whether to compile method if profile data not available. + static const CompilerFilter kDefaultCompilerFilter = kSpeed; + static const size_t kDefaultHugeMethodThreshold = 10000; + static const size_t kDefaultLargeMethodThreshold = 600; + static const size_t kDefaultSmallMethodThreshold = 60; + static const size_t kDefaultTinyMethodThreshold = 20; + static const size_t kDefaultNumDexMethodsThreshold = 900; + + CompilerOptions() : + compiler_filter_(kDefaultCompilerFilter), + huge_method_threshold_(kDefaultHugeMethodThreshold), + large_method_threshold_(kDefaultLargeMethodThreshold), + small_method_threshold_(kDefaultSmallMethodThreshold), + tiny_method_threshold_(kDefaultTinyMethodThreshold), + num_dex_methods_threshold_(kDefaultNumDexMethodsThreshold) +#ifdef ART_SEA_IR_MODE + , sea_ir_mode_(false) +#endif + {} + + CompilerOptions(CompilerFilter compiler_filter, + size_t huge_method_threshold, + size_t large_method_threshold, + size_t small_method_threshold, + size_t tiny_method_threshold, + size_t num_dex_methods_threshold +#ifdef ART_SEA_IR_MODE + , bool sea_ir_mode +#endif + ) : // NOLINT(whitespace/parens) + compiler_filter_(compiler_filter), + huge_method_threshold_(huge_method_threshold), + large_method_threshold_(large_method_threshold), + small_method_threshold_(small_method_threshold), + tiny_method_threshold_(tiny_method_threshold), + num_dex_methods_threshold_(num_dex_methods_threshold) +#ifdef ART_SEA_IR_MODE + , sea_ir_mode_(sea_ir_mode) +#endif + {} + + CompilerFilter GetCompilerFilter() const { + return compiler_filter_; + } + + void SetCompilerFilter(CompilerFilter compiler_filter) { + compiler_filter_ = compiler_filter; + } + + size_t GetHugeMethodThreshold() const { + return huge_method_threshold_; + } + + size_t GetLargeMethodThreshold() const { + return large_method_threshold_; + } + + size_t GetSmallMethodThreshold() const { + return small_method_threshold_; + } + + size_t GetTinyMethodThreshold() const { + return tiny_method_threshold_; + } + + bool IsHugeMethod(size_t num_dalvik_instructions) const { + return num_dalvik_instructions > huge_method_threshold_; + } + + bool IsLargeMethod(size_t num_dalvik_instructions) const { + return num_dalvik_instructions > large_method_threshold_; + } + + bool IsSmallMethod(size_t num_dalvik_instructions) const { + return num_dalvik_instructions > small_method_threshold_; + } + + bool IsTinyMethod(size_t num_dalvik_instructions) const { + return num_dalvik_instructions > tiny_method_threshold_; + } + + size_t GetNumDexMethodsThreshold() const { + return num_dex_methods_threshold_; + } + +#ifdef ART_SEA_IR_MODE + bool GetSeaIrMode(); +#endif + + private: + CompilerFilter compiler_filter_; + size_t huge_method_threshold_; + size_t large_method_threshold_; + size_t small_method_threshold_; + size_t tiny_method_threshold_; + size_t num_dex_methods_threshold_; + +#ifdef ART_SEA_IR_MODE + bool sea_ir_mode_; +#endif +}; + +} // namespace art + +#endif // ART_COMPILER_DRIVER_COMPILER_OPTIONS_H_ |