summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2024-01-30 16:54:20 +0000
committer VladimĂ­r Marko <vmarko@google.com> 2024-02-14 16:22:12 +0000
commit1001c2ee0621d7299d4ffa65bb9c277cbb9ab114 (patch)
tree1061eeeeafa92ce3717957724a494753b4708fab
parentcf2efc7cd3415c07bda58a57f97870456ab51718 (diff)
Move `JitOptions` to its own file.
Test: m test-art-host-gtest Test: testrunner.py --host --optimizing --jit Change-Id: Id86a37ba6569b68487eb977df6656d4868255acc
-rw-r--r--compiler/optimizing/code_generator_arm64.cc1
-rw-r--r--compiler/optimizing/code_generator_arm_vixl.cc1
-rw-r--r--compiler/optimizing/instruction_builder.cc1
-rw-r--r--runtime/Android.bp1
-rw-r--r--runtime/art_method-inl.h5
-rw-r--r--runtime/gc/verification.cc2
-rw-r--r--runtime/jit/jit.cc94
-rw-r--r--runtime/jit/jit.h131
-rw-r--r--runtime/jit/jit_options.cc117
-rw-r--r--runtime/jit/jit_options.h160
-rw-r--r--runtime/jit/profiling_info_test.cc2
-rw-r--r--runtime/runtime_image.cc1
-rw-r--r--runtime/runtime_options.h2
13 files changed, 289 insertions, 229 deletions
diff --git a/compiler/optimizing/code_generator_arm64.cc b/compiler/optimizing/code_generator_arm64.cc
index e22b24ef2f..8974429955 100644
--- a/compiler/optimizing/code_generator_arm64.cc
+++ b/compiler/optimizing/code_generator_arm64.cc
@@ -37,6 +37,7 @@
#include "intrinsics_arm64.h"
#include "intrinsics_list.h"
#include "intrinsics_utils.h"
+#include "jit/profiling_info.h"
#include "linker/linker_patch.h"
#include "lock_word.h"
#include "mirror/array-inl.h"
diff --git a/compiler/optimizing/code_generator_arm_vixl.cc b/compiler/optimizing/code_generator_arm_vixl.cc
index 75fae4e859..0ed3f8b2c9 100644
--- a/compiler/optimizing/code_generator_arm_vixl.cc
+++ b/compiler/optimizing/code_generator_arm_vixl.cc
@@ -36,6 +36,7 @@
#include "intrinsics_arm_vixl.h"
#include "intrinsics_list.h"
#include "intrinsics_utils.h"
+#include "jit/profiling_info.h"
#include "linker/linker_patch.h"
#include "mirror/array-inl.h"
#include "mirror/class-inl.h"
diff --git a/compiler/optimizing/instruction_builder.cc b/compiler/optimizing/instruction_builder.cc
index ca0a8e81af..410d6fd0d0 100644
--- a/compiler/optimizing/instruction_builder.cc
+++ b/compiler/optimizing/instruction_builder.cc
@@ -33,6 +33,7 @@
#include "intrinsics.h"
#include "intrinsics_utils.h"
#include "jit/jit.h"
+#include "jit/profiling_info.h"
#include "mirror/dex_cache.h"
#include "oat/oat_file.h"
#include "optimizing_compiler_stats.h"
diff --git a/runtime/Android.bp b/runtime/Android.bp
index d481d300a2..17f09cf814 100644
--- a/runtime/Android.bp
+++ b/runtime/Android.bp
@@ -310,6 +310,7 @@ cc_defaults {
"jit/jit.cc",
"jit/jit_code_cache.cc",
"jit/jit_memory_region.cc",
+ "jit/jit_options.cc",
"jit/profile_saver.cc",
"jit/profiling_info.cc",
"jit/small_pattern_matcher.cc",
diff --git a/runtime/art_method-inl.h b/runtime/art_method-inl.h
index cca20879c2..297b540ab2 100644
--- a/runtime/art_method-inl.h
+++ b/runtime/art_method-inl.h
@@ -19,7 +19,6 @@
#include "art_method.h"
-#include "art_field.h"
#include "base/callee_save_type.h"
#include "class_linker-inl.h"
#include "common_throws.h"
@@ -32,9 +31,7 @@
#include "dex/signature.h"
#include "gc_root-inl.h"
#include "imtable-inl.h"
-#include "intrinsics_enum.h"
-#include "jit/jit.h"
-#include "jit/profiling_info.h"
+#include "jit/jit_options.h"
#include "mirror/class-inl.h"
#include "mirror/dex_cache-inl.h"
#include "mirror/object-inl.h"
diff --git a/runtime/gc/verification.cc b/runtime/gc/verification.cc
index 926156fd8f..858c62a6e3 100644
--- a/runtime/gc/verification.cc
+++ b/runtime/gc/verification.cc
@@ -19,6 +19,8 @@
#include <iomanip>
#include <sstream>
+#include <android-base/unique_fd.h>
+
#include "art_field-inl.h"
#include "base/file_utils.h"
#include "base/logging.h"
diff --git a/runtime/jit/jit.cc b/runtime/jit/jit.cc
index ea645a2688..54a56f2939 100644
--- a/runtime/jit/jit.cc
+++ b/runtime/jit/jit.cc
@@ -63,103 +63,9 @@ namespace jit {
static constexpr bool kEnableOnStackReplacement = true;
-// Maximum permitted threshold value.
-static constexpr uint32_t kJitMaxThreshold = std::numeric_limits<uint16_t>::max();
-
-static constexpr uint32_t kJitDefaultOptimizeThreshold = 0xffff;
-// Different optimization threshold constants. These default to the equivalent optimization
-// thresholds divided by 2, but can be overridden at the command-line.
-static constexpr uint32_t kJitStressDefaultOptimizeThreshold = kJitDefaultOptimizeThreshold / 2;
-static constexpr uint32_t kJitSlowStressDefaultOptimizeThreshold =
- kJitStressDefaultOptimizeThreshold / 2;
-
-static constexpr uint32_t kJitDefaultWarmupThreshold = 0x3fff;
-// Different warm-up threshold constants. These default to the equivalent warmup thresholds divided
-// by 2, but can be overridden at the command-line.
-static constexpr uint32_t kJitStressDefaultWarmupThreshold = kJitDefaultWarmupThreshold / 2;
-static constexpr uint32_t kJitSlowStressDefaultWarmupThreshold =
- kJitStressDefaultWarmupThreshold / 2;
-
-DEFINE_RUNTIME_DEBUG_FLAG(Jit, kSlowMode);
-
// JIT compiler
JitCompilerInterface* Jit::jit_compiler_ = nullptr;
-JitOptions* JitOptions::CreateFromRuntimeArguments(const RuntimeArgumentMap& options) {
- auto* jit_options = new JitOptions;
- jit_options->use_jit_compilation_ = options.GetOrDefault(RuntimeArgumentMap::UseJitCompilation);
- jit_options->use_profiled_jit_compilation_ =
- options.GetOrDefault(RuntimeArgumentMap::UseProfiledJitCompilation);
-
- jit_options->code_cache_initial_capacity_ =
- options.GetOrDefault(RuntimeArgumentMap::JITCodeCacheInitialCapacity);
- jit_options->code_cache_max_capacity_ =
- options.GetOrDefault(RuntimeArgumentMap::JITCodeCacheMaxCapacity);
- jit_options->dump_info_on_shutdown_ =
- options.Exists(RuntimeArgumentMap::DumpJITInfoOnShutdown);
- jit_options->profile_saver_options_ =
- options.GetOrDefault(RuntimeArgumentMap::ProfileSaverOpts);
- jit_options->thread_pool_pthread_priority_ =
- options.GetOrDefault(RuntimeArgumentMap::JITPoolThreadPthreadPriority);
- jit_options->zygote_thread_pool_pthread_priority_ =
- options.GetOrDefault(RuntimeArgumentMap::JITZygotePoolThreadPthreadPriority);
-
- // Set default optimize threshold to aid with checking defaults.
- jit_options->optimize_threshold_ =
- kIsDebugBuild
- ? (Jit::kSlowMode
- ? kJitSlowStressDefaultOptimizeThreshold
- : kJitStressDefaultOptimizeThreshold)
- : kJitDefaultOptimizeThreshold;
-
- // Set default warm-up threshold to aid with checking defaults.
- jit_options->warmup_threshold_ =
- kIsDebugBuild ? (Jit::kSlowMode
- ? kJitSlowStressDefaultWarmupThreshold
- : kJitStressDefaultWarmupThreshold)
- : kJitDefaultWarmupThreshold;
-
- if (options.Exists(RuntimeArgumentMap::JITOptimizeThreshold)) {
- jit_options->optimize_threshold_ = *options.Get(RuntimeArgumentMap::JITOptimizeThreshold);
- }
- DCHECK_LE(jit_options->optimize_threshold_, kJitMaxThreshold);
-
- if (options.Exists(RuntimeArgumentMap::JITWarmupThreshold)) {
- jit_options->warmup_threshold_ = *options.Get(RuntimeArgumentMap::JITWarmupThreshold);
- }
- DCHECK_LE(jit_options->warmup_threshold_, kJitMaxThreshold);
-
- if (options.Exists(RuntimeArgumentMap::JITPriorityThreadWeight)) {
- jit_options->priority_thread_weight_ =
- *options.Get(RuntimeArgumentMap::JITPriorityThreadWeight);
- if (jit_options->priority_thread_weight_ > jit_options->warmup_threshold_) {
- LOG(FATAL) << "Priority thread weight is above the warmup threshold.";
- } else if (jit_options->priority_thread_weight_ == 0) {
- LOG(FATAL) << "Priority thread weight cannot be 0.";
- }
- } else {
- jit_options->priority_thread_weight_ = std::max(
- jit_options->warmup_threshold_ / Jit::kDefaultPriorityThreadWeightRatio,
- static_cast<size_t>(1));
- }
-
- if (options.Exists(RuntimeArgumentMap::JITInvokeTransitionWeight)) {
- jit_options->invoke_transition_weight_ =
- *options.Get(RuntimeArgumentMap::JITInvokeTransitionWeight);
- if (jit_options->invoke_transition_weight_ > jit_options->warmup_threshold_) {
- LOG(FATAL) << "Invoke transition weight is above the warmup threshold.";
- } else if (jit_options->invoke_transition_weight_ == 0) {
- LOG(FATAL) << "Invoke transition weight cannot be 0.";
- }
- } else {
- jit_options->invoke_transition_weight_ = std::max(
- jit_options->warmup_threshold_ / Jit::kDefaultInvokeTransitionWeightRatio,
- static_cast<size_t>(1));
- }
-
- return jit_options;
-}
-
void Jit::DumpInfo(std::ostream& os) {
code_cache_->Dump(os);
cumulative_timings_.Dump(os);
diff --git a/runtime/jit/jit.h b/runtime/jit/jit.h
index e41675f1b4..64b522251d 100644
--- a/runtime/jit/jit.h
+++ b/runtime/jit/jit.h
@@ -24,14 +24,13 @@
#include "base/histogram-inl.h"
#include "base/macros.h"
#include "base/mutex.h"
-#include "base/runtime_debug.h"
#include "base/timing_logger.h"
#include "compilation_kind.h"
#include "handle.h"
#include "offsets.h"
#include "interpreter/mterp/nterp.h"
#include "jit/debugger_interface.h"
-#include "jit/profile_saver_options.h"
+#include "jit_options.h"
#include "obj_ptr.h"
#include "thread_pool.h"
@@ -62,130 +61,6 @@ class JitOptions;
static constexpr int16_t kJitCheckForOSR = -1;
static constexpr int16_t kJitHotnessDisabled = -2;
-// At what priority to schedule jit threads. 9 is the lowest foreground priority on device.
-// See android/os/Process.java.
-static constexpr int kJitPoolThreadPthreadDefaultPriority = 9;
-// At what priority to schedule jit zygote threads compiling profiles in the background.
-// 19 is the lowest background priority on device.
-// See android/os/Process.java.
-static constexpr int kJitZygotePoolThreadPthreadDefaultPriority = 19;
-
-class JitOptions {
- public:
- static JitOptions* CreateFromRuntimeArguments(const RuntimeArgumentMap& options);
-
- uint16_t GetOptimizeThreshold() const {
- return optimize_threshold_;
- }
-
- uint16_t GetWarmupThreshold() const {
- return warmup_threshold_;
- }
-
- uint16_t GetPriorityThreadWeight() const {
- return priority_thread_weight_;
- }
-
- uint16_t GetInvokeTransitionWeight() const {
- return invoke_transition_weight_;
- }
-
- size_t GetCodeCacheInitialCapacity() const {
- return code_cache_initial_capacity_;
- }
-
- size_t GetCodeCacheMaxCapacity() const {
- return code_cache_max_capacity_;
- }
-
- bool DumpJitInfoOnShutdown() const {
- return dump_info_on_shutdown_;
- }
-
- const ProfileSaverOptions& GetProfileSaverOptions() const {
- return profile_saver_options_;
- }
-
- bool GetSaveProfilingInfo() const {
- return profile_saver_options_.IsEnabled();
- }
-
- int GetThreadPoolPthreadPriority() const {
- return thread_pool_pthread_priority_;
- }
-
- int GetZygoteThreadPoolPthreadPriority() const {
- return zygote_thread_pool_pthread_priority_;
- }
-
- bool UseJitCompilation() const {
- return use_jit_compilation_;
- }
-
- bool UseProfiledJitCompilation() const {
- return use_profiled_jit_compilation_;
- }
-
- void SetUseJitCompilation(bool b) {
- use_jit_compilation_ = b;
- }
-
- void SetSaveProfilingInfo(bool save_profiling_info) {
- profile_saver_options_.SetEnabled(save_profiling_info);
- }
-
- void SetWaitForJitNotificationsToSaveProfile(bool value) {
- profile_saver_options_.SetWaitForJitNotificationsToSave(value);
- }
-
- void SetJitAtFirstUse() {
- use_jit_compilation_ = true;
- optimize_threshold_ = 0;
- }
-
- void SetUseBaselineCompiler() {
- use_baseline_compiler_ = true;
- }
-
- bool UseBaselineCompiler() const {
- return use_baseline_compiler_;
- }
-
- private:
- // We add the sample in batches of size kJitSamplesBatchSize.
- // This method rounds the threshold so that it is multiple of the batch size.
- static uint32_t RoundUpThreshold(uint32_t threshold);
-
- bool use_jit_compilation_;
- bool use_profiled_jit_compilation_;
- bool use_baseline_compiler_;
- size_t code_cache_initial_capacity_;
- size_t code_cache_max_capacity_;
- uint32_t optimize_threshold_;
- uint32_t warmup_threshold_;
- uint16_t priority_thread_weight_;
- uint16_t invoke_transition_weight_;
- bool dump_info_on_shutdown_;
- int thread_pool_pthread_priority_;
- int zygote_thread_pool_pthread_priority_;
- ProfileSaverOptions profile_saver_options_;
-
- JitOptions()
- : use_jit_compilation_(false),
- use_profiled_jit_compilation_(false),
- use_baseline_compiler_(false),
- code_cache_initial_capacity_(0),
- code_cache_max_capacity_(0),
- optimize_threshold_(0),
- warmup_threshold_(0),
- priority_thread_weight_(0),
- invoke_transition_weight_(0),
- dump_info_on_shutdown_(false),
- thread_pool_pthread_priority_(kJitPoolThreadPthreadDefaultPriority),
- zygote_thread_pool_pthread_priority_(kJitZygotePoolThreadPthreadDefaultPriority) {}
-
- DISALLOW_COPY_AND_ASSIGN(JitOptions);
-};
// Implemented and provided by the compiler library.
class JitCompilerInterface {
@@ -305,13 +180,9 @@ class JitThreadPool : public AbstractThreadPool {
class Jit {
public:
- static constexpr size_t kDefaultPriorityThreadWeightRatio = 1000;
- static constexpr size_t kDefaultInvokeTransitionWeightRatio = 500;
// How frequently should the interpreter check to see if OSR compilation is ready.
static constexpr int16_t kJitRecheckOSRThreshold = 101; // Prime number to avoid patterns.
- DECLARE_RUNTIME_DEBUG_FLAG(kSlowMode);
-
virtual ~Jit();
// Create JIT itself.
diff --git a/runtime/jit/jit_options.cc b/runtime/jit/jit_options.cc
new file mode 100644
index 0000000000..3c31d1dfcd
--- /dev/null
+++ b/runtime/jit/jit_options.cc
@@ -0,0 +1,117 @@
+/*
+ * Copyright 2024 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.
+ */
+
+#include "jit_options.h"
+
+#include "runtime_options.h"
+
+namespace art HIDDEN {
+namespace jit {
+
+// Maximum permitted threshold value.
+static constexpr uint32_t kJitMaxThreshold = std::numeric_limits<uint16_t>::max();
+
+static constexpr uint32_t kJitDefaultOptimizeThreshold = 0xffff;
+// Different optimization threshold constants. These default to the equivalent optimization
+// thresholds divided by 2, but can be overridden at the command-line.
+static constexpr uint32_t kJitStressDefaultOptimizeThreshold = kJitDefaultOptimizeThreshold / 2;
+static constexpr uint32_t kJitSlowStressDefaultOptimizeThreshold =
+ kJitStressDefaultOptimizeThreshold / 2;
+
+static constexpr uint32_t kJitDefaultWarmupThreshold = 0x3fff;
+// Different warm-up threshold constants. These default to the equivalent warmup thresholds divided
+// by 2, but can be overridden at the command-line.
+static constexpr uint32_t kJitStressDefaultWarmupThreshold = kJitDefaultWarmupThreshold / 2;
+static constexpr uint32_t kJitSlowStressDefaultWarmupThreshold =
+ kJitStressDefaultWarmupThreshold / 2;
+
+static constexpr size_t kDefaultPriorityThreadWeightRatio = 1000;
+static constexpr size_t kDefaultInvokeTransitionWeightRatio = 500;
+
+DEFINE_RUNTIME_DEBUG_FLAG(JitOptions, kSlowMode);
+
+JitOptions* JitOptions::CreateFromRuntimeArguments(const RuntimeArgumentMap& options) {
+ auto* jit_options = new JitOptions;
+ jit_options->use_jit_compilation_ = options.GetOrDefault(RuntimeArgumentMap::UseJitCompilation);
+ jit_options->use_profiled_jit_compilation_ =
+ options.GetOrDefault(RuntimeArgumentMap::UseProfiledJitCompilation);
+
+ jit_options->code_cache_initial_capacity_ =
+ options.GetOrDefault(RuntimeArgumentMap::JITCodeCacheInitialCapacity);
+ jit_options->code_cache_max_capacity_ =
+ options.GetOrDefault(RuntimeArgumentMap::JITCodeCacheMaxCapacity);
+ jit_options->dump_info_on_shutdown_ =
+ options.Exists(RuntimeArgumentMap::DumpJITInfoOnShutdown);
+ jit_options->profile_saver_options_ =
+ options.GetOrDefault(RuntimeArgumentMap::ProfileSaverOpts);
+ jit_options->thread_pool_pthread_priority_ =
+ options.GetOrDefault(RuntimeArgumentMap::JITPoolThreadPthreadPriority);
+ jit_options->zygote_thread_pool_pthread_priority_ =
+ options.GetOrDefault(RuntimeArgumentMap::JITZygotePoolThreadPthreadPriority);
+
+ // Set default optimize threshold to aid with checking defaults.
+ jit_options->optimize_threshold_ = kIsDebugBuild
+ ? (kSlowMode ? kJitSlowStressDefaultOptimizeThreshold : kJitStressDefaultOptimizeThreshold)
+ : kJitDefaultOptimizeThreshold;
+
+ // Set default warm-up threshold to aid with checking defaults.
+ jit_options->warmup_threshold_ = kIsDebugBuild
+ ? (kSlowMode ? kJitSlowStressDefaultWarmupThreshold : kJitStressDefaultWarmupThreshold)
+ : kJitDefaultWarmupThreshold;
+
+ if (options.Exists(RuntimeArgumentMap::JITOptimizeThreshold)) {
+ jit_options->optimize_threshold_ = *options.Get(RuntimeArgumentMap::JITOptimizeThreshold);
+ }
+ DCHECK_LE(jit_options->optimize_threshold_, kJitMaxThreshold);
+
+ if (options.Exists(RuntimeArgumentMap::JITWarmupThreshold)) {
+ jit_options->warmup_threshold_ = *options.Get(RuntimeArgumentMap::JITWarmupThreshold);
+ }
+ DCHECK_LE(jit_options->warmup_threshold_, kJitMaxThreshold);
+
+ if (options.Exists(RuntimeArgumentMap::JITPriorityThreadWeight)) {
+ jit_options->priority_thread_weight_ =
+ *options.Get(RuntimeArgumentMap::JITPriorityThreadWeight);
+ if (jit_options->priority_thread_weight_ > jit_options->warmup_threshold_) {
+ LOG(FATAL) << "Priority thread weight is above the warmup threshold.";
+ } else if (jit_options->priority_thread_weight_ == 0) {
+ LOG(FATAL) << "Priority thread weight cannot be 0.";
+ }
+ } else {
+ jit_options->priority_thread_weight_ = std::max(
+ jit_options->warmup_threshold_ / kDefaultPriorityThreadWeightRatio,
+ static_cast<size_t>(1));
+ }
+
+ if (options.Exists(RuntimeArgumentMap::JITInvokeTransitionWeight)) {
+ jit_options->invoke_transition_weight_ =
+ *options.Get(RuntimeArgumentMap::JITInvokeTransitionWeight);
+ if (jit_options->invoke_transition_weight_ > jit_options->warmup_threshold_) {
+ LOG(FATAL) << "Invoke transition weight is above the warmup threshold.";
+ } else if (jit_options->invoke_transition_weight_ == 0) {
+ LOG(FATAL) << "Invoke transition weight cannot be 0.";
+ }
+ } else {
+ jit_options->invoke_transition_weight_ = std::max(
+ jit_options->warmup_threshold_ / kDefaultInvokeTransitionWeightRatio,
+ static_cast<size_t>(1));
+ }
+
+ return jit_options;
+}
+
+} // namespace jit
+} // namespace art
diff --git a/runtime/jit/jit_options.h b/runtime/jit/jit_options.h
new file mode 100644
index 0000000000..be305b4d63
--- /dev/null
+++ b/runtime/jit/jit_options.h
@@ -0,0 +1,160 @@
+/*
+ * Copyright 2024 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_JIT_JIT_OPTIONS_H_
+#define ART_RUNTIME_JIT_JIT_OPTIONS_H_
+
+#include "base/macros.h"
+#include "base/runtime_debug.h"
+#include "profile_saver_options.h"
+
+namespace art HIDDEN {
+
+struct RuntimeArgumentMap;
+
+namespace jit {
+
+// At what priority to schedule jit threads. 9 is the lowest foreground priority on device.
+// See android/os/Process.java.
+static constexpr int kJitPoolThreadPthreadDefaultPriority = 9;
+// At what priority to schedule jit zygote threads compiling profiles in the background.
+// 19 is the lowest background priority on device.
+// See android/os/Process.java.
+static constexpr int kJitZygotePoolThreadPthreadDefaultPriority = 19;
+
+class JitOptions {
+ public:
+ DECLARE_RUNTIME_DEBUG_FLAG(kSlowMode);
+
+ static JitOptions* CreateFromRuntimeArguments(const RuntimeArgumentMap& options);
+
+ uint16_t GetOptimizeThreshold() const {
+ return optimize_threshold_;
+ }
+
+ uint16_t GetWarmupThreshold() const {
+ return warmup_threshold_;
+ }
+
+ uint16_t GetPriorityThreadWeight() const {
+ return priority_thread_weight_;
+ }
+
+ uint16_t GetInvokeTransitionWeight() const {
+ return invoke_transition_weight_;
+ }
+
+ size_t GetCodeCacheInitialCapacity() const {
+ return code_cache_initial_capacity_;
+ }
+
+ size_t GetCodeCacheMaxCapacity() const {
+ return code_cache_max_capacity_;
+ }
+
+ bool DumpJitInfoOnShutdown() const {
+ return dump_info_on_shutdown_;
+ }
+
+ const ProfileSaverOptions& GetProfileSaverOptions() const {
+ return profile_saver_options_;
+ }
+
+ bool GetSaveProfilingInfo() const {
+ return profile_saver_options_.IsEnabled();
+ }
+
+ int GetThreadPoolPthreadPriority() const {
+ return thread_pool_pthread_priority_;
+ }
+
+ int GetZygoteThreadPoolPthreadPriority() const {
+ return zygote_thread_pool_pthread_priority_;
+ }
+
+ bool UseJitCompilation() const {
+ return use_jit_compilation_;
+ }
+
+ bool UseProfiledJitCompilation() const {
+ return use_profiled_jit_compilation_;
+ }
+
+ void SetUseJitCompilation(bool b) {
+ use_jit_compilation_ = b;
+ }
+
+ void SetSaveProfilingInfo(bool save_profiling_info) {
+ profile_saver_options_.SetEnabled(save_profiling_info);
+ }
+
+ void SetWaitForJitNotificationsToSaveProfile(bool value) {
+ profile_saver_options_.SetWaitForJitNotificationsToSave(value);
+ }
+
+ void SetJitAtFirstUse() {
+ use_jit_compilation_ = true;
+ optimize_threshold_ = 0;
+ }
+
+ void SetUseBaselineCompiler() {
+ use_baseline_compiler_ = true;
+ }
+
+ bool UseBaselineCompiler() const {
+ return use_baseline_compiler_;
+ }
+
+ private:
+ // We add the sample in batches of size kJitSamplesBatchSize.
+ // This method rounds the threshold so that it is multiple of the batch size.
+ static uint32_t RoundUpThreshold(uint32_t threshold);
+
+ bool use_jit_compilation_;
+ bool use_profiled_jit_compilation_;
+ bool use_baseline_compiler_;
+ size_t code_cache_initial_capacity_;
+ size_t code_cache_max_capacity_;
+ uint32_t optimize_threshold_;
+ uint32_t warmup_threshold_;
+ uint16_t priority_thread_weight_;
+ uint16_t invoke_transition_weight_;
+ bool dump_info_on_shutdown_;
+ int thread_pool_pthread_priority_;
+ int zygote_thread_pool_pthread_priority_;
+ ProfileSaverOptions profile_saver_options_;
+
+ JitOptions()
+ : use_jit_compilation_(false),
+ use_profiled_jit_compilation_(false),
+ use_baseline_compiler_(false),
+ code_cache_initial_capacity_(0),
+ code_cache_max_capacity_(0),
+ optimize_threshold_(0),
+ warmup_threshold_(0),
+ priority_thread_weight_(0),
+ invoke_transition_weight_(0),
+ dump_info_on_shutdown_(false),
+ thread_pool_pthread_priority_(kJitPoolThreadPthreadDefaultPriority),
+ zygote_thread_pool_pthread_priority_(kJitZygotePoolThreadPthreadDefaultPriority) {}
+
+ DISALLOW_COPY_AND_ASSIGN(JitOptions);
+};
+
+} // namespace jit
+} // namespace art
+
+#endif // ART_RUNTIME_JIT_JIT_OPTIONS_H_
diff --git a/runtime/jit/profiling_info_test.cc b/runtime/jit/profiling_info_test.cc
index a8a95774d8..674cb73dcd 100644
--- a/runtime/jit/profiling_info_test.cc
+++ b/runtime/jit/profiling_info_test.cc
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+#include "profiling_info.h"
+
#include <gtest/gtest.h>
#include <stdio.h>
diff --git a/runtime/runtime_image.cc b/runtime/runtime_image.cc
index 0c85261829..b299b9b236 100644
--- a/runtime/runtime_image.cc
+++ b/runtime/runtime_image.cc
@@ -23,6 +23,7 @@
#include "android-base/stringprintf.h"
#include "android-base/strings.h"
#include "arch/instruction_set.h"
+#include "arch/instruction_set_features.h"
#include "base/arena_allocator.h"
#include "base/arena_containers.h"
#include "base/bit_utils.h"
diff --git a/runtime/runtime_options.h b/runtime/runtime_options.h
index 6ece459dad..3cadd09bf8 100644
--- a/runtime/runtime_options.h
+++ b/runtime/runtime_options.h
@@ -29,8 +29,8 @@
#include "gc/collector_type.h"
#include "gc/space/large_object_space.h"
#include "hidden_api.h"
-#include "jit/jit.h"
#include "jit/jit_code_cache.h"
+#include "jit/jit_options.h"
#include "jit/profile_saver_options.h"
#include "verifier/verifier_enums.h"